51 lines
1.1 KiB
Text
51 lines
1.1 KiB
Text
#version 150 compatibility
|
|
#extension GL_EXT_geometry_shader4 : enable
|
|
|
|
layout(points) in;
|
|
layout(line_strip, max_vertices = 24) out;
|
|
|
|
in mat4 PM[];
|
|
in vec4 color_gs[];
|
|
|
|
out vec4 color;
|
|
|
|
int surface_side_handling(in vec3 position, inout vec3 normal, inout vec4 color);
|
|
|
|
void emit_vertex(in vec4 p)
|
|
{
|
|
gl_Position = gl_ProjectionMatrix * p;
|
|
EmitVertex();
|
|
}
|
|
|
|
void main()
|
|
{
|
|
color = color_gs[0];
|
|
vec4 C0 = PM[0] * vec4(-0.5, -0.5, -0.5, 1.0);
|
|
vec4 C1 = PM[0] * vec4(0.5, -0.5, -0.5, 1.0);
|
|
vec4 C2 = PM[0] * vec4(-0.5, 0.5, -0.5, 1.0);
|
|
vec4 C3 = PM[0] * vec4(0.5, 0.5, -0.5, 1.0);
|
|
vec4 C4 = PM[0] * vec4(-0.5, -0.5, 0.5, 1.0);
|
|
vec4 C5 = PM[0] * vec4(0.5, -0.5, 0.5, 1.0);
|
|
vec4 C6 = PM[0] * vec4(-0.5, 0.5, 0.5, 1.0);
|
|
vec4 C7 = PM[0] * vec4(0.5, 0.5, 0.5, 1.0);
|
|
emit_vertex(C0);
|
|
emit_vertex(C4);
|
|
emit_vertex(C6);
|
|
emit_vertex(C2);
|
|
emit_vertex(C0);
|
|
emit_vertex(C1);
|
|
emit_vertex(C5);
|
|
emit_vertex(C7);
|
|
emit_vertex(C3);
|
|
emit_vertex(C1);
|
|
EndPrimitive();
|
|
emit_vertex(C4);
|
|
emit_vertex(C5);
|
|
EndPrimitive();
|
|
emit_vertex(C6);
|
|
emit_vertex(C7);
|
|
EndPrimitive();
|
|
emit_vertex(C2);
|
|
emit_vertex(C3);
|
|
EndPrimitive();
|
|
}
|