Apply deferred shading to walls

This commit is contained in:
2021-09-01 00:51:50 +01:00
parent 1c587d4b9a
commit 4cd8b5aa1c
5 changed files with 22 additions and 19 deletions
+5 -7
View File
@@ -4,6 +4,7 @@ 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)
@@ -14,10 +15,8 @@ float isLHS (vec2 startV, vec2 testV)
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")) {
@@ -25,11 +24,10 @@ void main()
vec4 p4 = vec4 (p2.xy,100,1);
vec4 a3 = theMat * p3;
vec4 a4 = theMat * p4;
gl_Position = a1; EmitVertex();
gl_Position = a3; EmitVertex();
gl_Position = a2; EmitVertex();
gl_Position = a4; EmitVertex();
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();
// }
}