diff --git a/shader/ceiling/stencil.geom b/shader/ceiling/stencil.geom new file mode 100644 index 000000000..853734121 --- /dev/null +++ b/shader/ceiling/stencil.geom @@ -0,0 +1,13 @@ +#version 450 core +layout(points) in; +layout(triangle_strip, max_vertices = 4) out; +layout(std140, binding = 0) uniform TheMat { mat4 theMat; }; +void main() { + vec2 p1 = gl_in[0].gl_Position.xy; + vec2 p2 = gl_in[0].gl_Position.zw; + gl_Position = theMat * vec4(p1,100,1); EmitVertex(); + gl_Position = theMat * vec4(p1,5000,1); EmitVertex(); + gl_Position = theMat * vec4(p2,100,1); EmitVertex(); + gl_Position = theMat * vec4(p2,5000,1); EmitVertex(); + EndPrimitive(); +} diff --git a/shader/ceiling/stencil.vert b/shader/ceiling/stencil.vert new file mode 100644 index 000000000..ffb827dbb --- /dev/null +++ b/shader/ceiling/stencil.vert @@ -0,0 +1,6 @@ +#version 450 core +layout (location = 0) in vec4 poss; +void main() +{ + gl_Position = poss; +} diff --git a/shader/wall/window.frag b/shader/wall/window.frag new file mode 100644 index 000000000..6bd962e34 --- /dev/null +++ b/shader/wall/window.frag @@ -0,0 +1,14 @@ +#version 450 core +layout (location=0) out vec4 fCol; +layout (location=1) out vec4 fPos; +layout (location=2) out vec4 fNorm; +in vec4 gColor; +in vec4 gPos; +void main() +{ + fCol = gColor; + //fPos = gPos;// + vec4(0,0,50,0); + //fNorm = vec4 (0,0,10,10); + fPos = vec4(0,0,50,1); + fNorm = vec4 (0,0,10,10); +} diff --git a/shader/wall/window.geom b/shader/wall/window.geom new file mode 100644 index 000000000..0feb2a704 --- /dev/null +++ b/shader/wall/window.geom @@ -0,0 +1,33 @@ +#version 450 core +layout (points) in; +layout (triangle_strip, max_vertices = 4) out; +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; +in vec4 vColor []; +out vec4 gColor; +out vec4 gPos; +// consider using isLHS to check if the wall is facing the center +// this needs the view from point +float isLHS (vec2 startV, vec2 testV) +{ + return sign( -startV.x * testV.y + startV.y * testV.x); +} + +void main() +{ + gColor = vColor[0]; + vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0,1); + vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1); + vec4 a1 = theMat * p1; + vec4 a2 = theMat * p2; +// if (0 > isLHS (a1.xy - a2.xy, a1.xy - "viewFromPoint")) { + vec4 p3 = vec4 (p1.xy,5000,1); //note the random z value, used for GL_DEPTH_CLAMP + vec4 p4 = vec4 (p2.xy,5000,1); + vec4 a3 = theMat * p3; + vec4 a4 = theMat * p4; + gPos = p1;gl_Position = a1; EmitVertex(); + gPos = p3;gl_Position = a3; EmitVertex(); + gPos = p2;gl_Position = a2; EmitVertex(); + gPos = p4;gl_Position = a4; EmitVertex(); + EndPrimitive(); +// } +} diff --git a/shader/wall/window.vert b/shader/wall/window.vert new file mode 100644 index 000000000..3e9883240 --- /dev/null +++ b/shader/wall/window.vert @@ -0,0 +1,9 @@ +#version 450 core +layout (location = 0) in vec4 poss; +layout (location = 1) in vec4 color; +out vec4 vColor; +void main() +{ + gl_Position = poss; + vColor = color; +}