Make wall points for shadows use matrix uniform transformation
This commit is contained in:
@@ -4,11 +4,15 @@ layout (triangle_strip, max_vertices = 10) out;
|
|||||||
|
|
||||||
//in vec4 vBackPoss[];
|
//in vec4 vBackPoss[];
|
||||||
uniform vec2 lightPos;
|
uniform vec2 lightPos;
|
||||||
|
uniform mat4 worldMat;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 posa = gl_in[0].gl_Position.xy;
|
vec4 posaa = worldMat * vec4(gl_in[0].gl_Position.xy, 0 ,1);
|
||||||
vec2 posb = gl_in[0].gl_Position.zw;
|
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 posc = vBackPoss[0].xy;
|
||||||
// vec2 posd = vBackPoss[0].zw;
|
// vec2 posd = vBackPoss[0].zw;
|
||||||
|
|
||||||
|
|||||||
@@ -563,11 +563,12 @@ wallsForGloom' :: World -> [(Point2,Point2)]
|
|||||||
wallsForGloom' w = map (wallPairBack . _wlLine) $ filter (not . _wlIsSeeThrough)
|
wallsForGloom' w = map (wallPairBack . _wlLine) $ filter (not . _wlIsSeeThrough)
|
||||||
$ IM.elems $ wallsNearZones (zoneOfDoubleScreen w) w
|
$ 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)
|
where n = 15 *.* (normalizeV $ vNormal $ y -.- x)
|
||||||
ss' v = rotateV (0 - _cameraRot w) (v -.- _cameraPos w)
|
-- ss' v = rotateV (0 - _cameraRot w) (v -.- _cameraPos w)
|
||||||
ss'' (a,b) = (a*2*zoom / _windowX w,b*2*zoom / _windowY w)
|
-- ss'' (a,b) = (a*2*zoom / _windowX w,b*2*zoom / _windowY w)
|
||||||
ss = ss'' . ss'
|
-- ss = ss'' . ss'
|
||||||
-- the ss transformation would possibly be better done using a matrix in the
|
-- the ss transformation would possibly be better done using a matrix in the
|
||||||
-- shader
|
-- shader
|
||||||
zoom = _cameraZoom w
|
zoom = _cameraZoom w
|
||||||
|
|||||||
Reference in New Issue
Block a user