2024-05-04 15:24:42 +02:00
|
|
|
#version 450
|
|
|
|
|
|
|
|
layout(points) in;
|
2024-05-18 10:52:47 +02:00
|
|
|
layout(triangle_strip, max_vertices=12) out;
|
2024-05-04 15:24:42 +02:00
|
|
|
|
|
|
|
layout(binding = 0) uniform UniformBufferObject {
|
|
|
|
mat4 model;
|
|
|
|
mat4 geom_rot;
|
|
|
|
mat4 view;
|
|
|
|
mat4 proj;
|
2024-06-02 15:25:11 +02:00
|
|
|
bool[16] use_geom_shader;
|
2024-05-04 15:24:42 +02:00
|
|
|
} ubo;
|
|
|
|
|
|
|
|
layout(location = 0) in vec3 geoColor[];
|
|
|
|
layout(location = 1) in vec2 geoTexCoord[];
|
2024-09-09 19:23:09 +02:00
|
|
|
layout(location = 2) in vec3 geoSize[];
|
2024-05-04 15:24:42 +02:00
|
|
|
|
|
|
|
layout(location = 0) out vec3 fragColor;
|
|
|
|
layout(location = 1) out vec2 fragTexCoord;
|
|
|
|
|
2024-05-18 10:52:47 +02:00
|
|
|
bool ignore_scalars = false;
|
|
|
|
|
2024-05-04 15:24:42 +02:00
|
|
|
void main () {
|
|
|
|
mat4 geom_rotation = ubo.geom_rot;
|
|
|
|
//back
|
2024-05-18 10:52:47 +02:00
|
|
|
vec4 normal_back = geom_rotation * vec4(0, 0, -1, 0);
|
|
|
|
float scalar_back = dot(normal_back, vec4(1, 0, 0, 0));
|
|
|
|
|
|
|
|
if (scalar_back <= 0 || ignore_scalars){
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
EndPrimitive();
|
|
|
|
}
|
2024-05-04 15:24:42 +02:00
|
|
|
|
|
|
|
//front
|
2024-05-18 10:52:47 +02:00
|
|
|
vec4 normal_front = geom_rotation * vec4(0, 0, 1, 0);
|
|
|
|
float scalar_front = dot(normal_front, vec4(1, 0, 0, 0));
|
|
|
|
if (scalar_front <= 0 || ignore_scalars) {
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
EndPrimitive();
|
|
|
|
}
|
2024-05-04 15:24:42 +02:00
|
|
|
//up
|
2024-05-18 10:52:47 +02:00
|
|
|
vec4 normal_up = geom_rotation * vec4(0, 1, 0, 0);
|
|
|
|
float scalar_up = dot(normal_up, vec4(1, 0, 0, 0));
|
|
|
|
|
|
|
|
if (scalar_up <= 0 || ignore_scalars) {
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
EndPrimitive();
|
|
|
|
}
|
2024-05-04 15:24:42 +02:00
|
|
|
//down
|
2024-05-18 10:52:47 +02:00
|
|
|
vec4 normal_down = geom_rotation * vec4(0, -1, 0, 0);
|
|
|
|
float scalar_down = dot(normal_down, vec4(1, 0, 0, 0));
|
|
|
|
|
|
|
|
if (scalar_down <= 0 || ignore_scalars) {
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
EndPrimitive();
|
|
|
|
}
|
2024-05-04 15:24:42 +02:00
|
|
|
//left
|
2024-05-18 10:52:47 +02:00
|
|
|
vec4 normal_left = geom_rotation * vec4(-1, 0, 0, 0);
|
|
|
|
float scalar_left = dot(normal_left, vec4(1, 0, 0, 0));
|
|
|
|
|
|
|
|
if (scalar_left <= 0 || ignore_scalars) {
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(-geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
EndPrimitive();
|
|
|
|
}
|
2024-05-04 15:24:42 +02:00
|
|
|
//right
|
2024-05-18 10:52:47 +02:00
|
|
|
vec4 normal_right = geom_rotation * vec4(1, 0, 0, 0);
|
|
|
|
float scalar_right = dot(normal_right, vec4(1, 0, 0, 0));
|
|
|
|
|
|
|
|
if (scalar_right <= 0 || ignore_scalars) {
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, -geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
|
2024-09-15 14:02:00 +02:00
|
|
|
gl_Position = ubo.proj * ubo.view * (gl_in[0].gl_Position + geom_rotation * 0.5 * vec4(geoSize[0].x, geoSize[0].y, -geoSize[0].z, 0));
|
2024-05-18 10:52:47 +02:00
|
|
|
fragColor = geoColor[0];
|
|
|
|
fragTexCoord = geoTexCoord[0];
|
|
|
|
EmitVertex();
|
|
|
|
EndPrimitive();
|
|
|
|
}
|
2024-05-04 15:24:42 +02:00
|
|
|
}
|