Remove inputs to wallShadow shader

This commit is contained in:
jgk
2021-03-19 01:01:22 +01:00
parent e6dd845511
commit e079289349
3 changed files with 3 additions and 42 deletions
+1 -30
View File
@@ -1,8 +1,7 @@
#version 430 core
layout (points) in;
layout (triangle_strip, max_vertices = 12) out;
layout (triangle_strip, max_vertices = 4) out;
in vec4 vBackPoss[];
uniform vec2 lightPos;
uniform mat4 worldMat;
@@ -14,40 +13,12 @@ void emitLine (vec2 pa)
EmitVertex();
}
float isLHS (vec2 startV, vec2 testV)
{
return sign( -startV.x * testV.y + startV.y * testV.x);
}
void main()
{
vec4 frontL4 = worldMat * vec4(gl_in[0].gl_Position.xy, 0 ,1);
vec4 frontR4 = worldMat * vec4(gl_in[0].gl_Position.zw, 0 ,1);
vec2 frontL = frontL4.xy;
vec2 frontR = frontR4.xy;
vec4 backR4 = worldMat * vec4(vBackPoss[0].xy, 0 ,1);
vec4 backL4 = worldMat * vec4(vBackPoss[0].zw, 0 ,1);
vec2 backL = backL4.xy;
vec2 backR = backR4.xy;
// if (isLHS( lightPos - frontL, frontR - frontL) < 0)
// // if (isLHS( lightPos - backL, backR - backL) < 0)
// {
// // emitLine (frontL);
// // emitLine (backL);
// // emitLine (frontL);
// // emitLine (frontR);
// // emitLine (backR);
// // emitLine (frontR);
//
// emitLine (backR);
// emitLine (backL);
// }
// else
// {
// emitLine (backR);
// emitLine (backL);
// }
emitLine (frontR);
emitLine (frontL);
-10
View File
@@ -1,17 +1,7 @@
#version 430 core
layout (location = 0) in vec4 poss;
layout (location = 1) in vec4 backPoss;
out vec4 vBackPoss;
//uniform vec2 winSize;
//uniform float zoom;
//uniform float rotation;
//uniform vec2 translation;
//uniform mat4 worldMat;
void main()
{
gl_Position = poss;
vBackPoss = backPoss;
}
+2 -2
View File
@@ -45,7 +45,7 @@ preloadRender = do
bgShad <- makeTextureShader "background" [vert,geom,frag] [(0,4),(1,2)] Points pokeBGStrat
"data/texture/smudgedDirt.png"
wsShad <- makeShaderCustomUnis "wallShadow" [vert,geom,frag] [(0,4),(1,4)] Points pokeWPStrat
wsShad <- makeShaderCustomUnis "wallShadow" [vert,geom,frag] [(0,4)] Points pokeWPStrat
["lightPos"]
wlLightShad <- makeShaderCustomUnis "wallLight" [vert,frag] [(0,3)] TriangleStrip pokeLightWallStrat
@@ -172,7 +172,7 @@ geom = GeometryShader
frag = FragmentShader
pokeWPStrat :: (Point2,Point2,Point2,Point2) -> [[[Float]]]
pokeWPStrat ((x,y),(z,w),(a,b),(c,d)) = [[[x,y,z,w],[a,b,c,d]]]
pokeWPStrat ((x,y),(z,w),(a,b),(c,d)) = [[[x,y,z,w]]]
pokeLightWallStrat :: Point3 -> [[[Float]]]
pokeLightWallStrat (x,y,z) = [[[x,y,z]]]