I'm not sure what the correct way to write this is:
vec3 plane_a_point_1 = vec3(0.791629, 0.901993, 0.380778);
vec3 plane_a_normal = vec3(0.3298,0.81282,-0.48016);
vec3 vector_from_plane_a_point_1_to_p = p - plane_a_point_1;
float plane_a_result = dot(vector_from_plane_a_point_1_to_p, plane_a_normal);
vec3 plane_b_point_1 = vec3(0.827042, 0.776654, 0.506066);
vec3 plane_b_normal = vec3(0.3298,0.81281,-0.48017);
vec3 vector_from_plane_b_point_1_to_p = p - plane_b_point_1;
float plane_b_result = dot(vector_from_plane_b_point_1_to_p, plane_b_normal);
vec3 plane_c_point_1 = vec3(0.130028, 0.61924, 0.447717);
vec3 plane_c_normal = vec3(0.32981,0.81281,-0.48018);
vec3 vector_from_plane_c_point_1_to_p = p - plane_c_point_1;
float plane_c_result = dot(vector_from_plane_c_point_1_to_p, plane_c_normal);
if (overlap_plane_a_result > -0.001 && overlap_plane_a_result < 0.001) {
discard;
}
else if (overlap_plane_b_result > -0.001 && overlap_plane_b_result < 0.001) {
discard;
}
else if (overlap_plane_c_result > -0.001 && overlap_plane_c_result < 0.001) {
discard;
}
I actually tons of these planes that I'm hiding. I'm just wondering if there is a way to optimize this code? Maybe I shouldn't use if else?