add cuboid and handle empty compounds

This commit is contained in:
zomseffen 2025-04-11 11:35:57 +02:00
parent 4a81ae6440
commit 62e4062cbf
5 changed files with 200 additions and 15 deletions

Binary file not shown.

View file

@ -250,6 +250,25 @@ void main() {
continue;
}
if (component_type == 2) {
// handle cone
vec3 size = vec3(uintBitsToFloat(compounds[component_index + 9]), uintBitsToFloat(compounds[component_index + 10]), uintBitsToFloat(compounds[component_index + 11]));
vec3 direction1 = component_rot_mat * vec3(size.x, 0.0, 0.0) / 2.0;
vec3 direction2 = component_rot_mat * vec3(0.0, size.y, 0.0) / 2.0;
vec3 direction3 = component_rot_mat * vec3(0.0, 0.0, size.z) / 2.0;
vec3 diff = check_pos - component_pos;
float factor1 = dot(direction1, diff) / dot(direction1, direction1);
float factor2 = dot(direction2, diff) / dot(direction2, direction2);
float factor3 = dot(direction3, diff) / dot(direction3, direction3);
render = (-1.0 <= factor1 && factor1 <= 1.0) && (-1.0 <= factor2 && factor2 <= 1.0) && (-1.0 <= factor3 && factor3 <= 1.0);
if (render) {
color = vec3(float(component_color.x) / 255.0, float(component_color.y) / 255.0, float(component_color.z) / 255.0);
break;
}
continue;
}
}
//handle excluded shapes
@ -304,6 +323,24 @@ void main() {
}
continue;
}
if (component_type == 2) {
// handle cone
vec3 size = vec3(uintBitsToFloat(compounds[component_index + 9]), uintBitsToFloat(compounds[component_index + 10]), uintBitsToFloat(compounds[component_index + 11]));
vec3 direction1 = component_rot_mat * vec3(size.x, 0.0, 0.0) / 2.0;
vec3 direction2 = component_rot_mat * vec3(0.0, size.y, 0.0) / 2.0;
vec3 direction3 = component_rot_mat * vec3(0.0, 0.0, size.z) / 2.0;
vec3 diff = check_pos - component_pos;
float factor1 = dot(direction1, diff) / dot(direction1, direction1);
float factor2 = dot(direction2, diff) / dot(direction2, direction2);
float factor3 = dot(direction3, diff) / dot(direction3, direction3);
render = render && !((-1.0 <= factor1 && factor1 <= 1.0) && (-1.0 <= factor2 && factor2 <= 1.0) && (-1.0 <= factor3 && factor3 <= 1.0));
if (!render) {
break;
}
continue;
}
}
if (render) {