Make wall points for shadows use matrix uniform transformation

This commit is contained in:
jgk
2021-02-27 02:36:52 +01:00
parent 33ebc1556d
commit 4a85177522
2 changed files with 11 additions and 6 deletions
+6 -2
View File
@@ -4,11 +4,15 @@ layout (triangle_strip, max_vertices = 10) out;
//in vec4 vBackPoss[];
uniform vec2 lightPos;
uniform mat4 worldMat;
void main()
{
vec2 posa = gl_in[0].gl_Position.xy;
vec2 posb = gl_in[0].gl_Position.zw;
vec4 posaa = worldMat * vec4(gl_in[0].gl_Position.xy, 0 ,1);
vec4 posba = worldMat * vec4(gl_in[0].gl_Position.zw, 0 ,1);
vec2 posa = posaa.xy;
vec2 posb = posba.xy;
// vec2 posc = vBackPoss[0].xy;
// vec2 posd = vBackPoss[0].zw;
+5 -4
View File
@@ -563,11 +563,12 @@ wallsForGloom' :: World -> [(Point2,Point2)]
wallsForGloom' w = map (wallPairBack . _wlLine) $ filter (not . _wlIsSeeThrough)
$ IM.elems $ wallsNearZones (zoneOfDoubleScreen w) w
where wallPairBack (x:y:_) = (ss $ x +.+ n,ss $ y+.+ n)
-- where wallPairBack (x:y:_) = (ss $ x +.+ n,ss $ y+.+ n)
where wallPairBack (x:y:_) = (x +.+ n,y+.+ n)
where n = 15 *.* (normalizeV $ vNormal $ y -.- x)
ss' v = rotateV (0 - _cameraRot w) (v -.- _cameraPos w)
ss'' (a,b) = (a*2*zoom / _windowX w,b*2*zoom / _windowY w)
ss = ss'' . ss'
-- ss' v = rotateV (0 - _cameraRot w) (v -.- _cameraPos w)
-- ss'' (a,b) = (a*2*zoom / _windowX w,b*2*zoom / _windowY w)
-- ss = ss'' . ss'
-- the ss transformation would possibly be better done using a matrix in the
-- shader
zoom = _cameraZoom w