Add wall drawing capability (for shadows)
This commit is contained in:
@@ -508,6 +508,18 @@ wallsForGloom w = map (\(x:y:_) -> (screenShift x,screenShift y)) $
|
||||
where screenShift x = zoom *.* rotateV (0 - _cameraRot w) (x -.- _cameraPos w)
|
||||
zoom = _cameraZoom w
|
||||
|
||||
wallsForGloom' :: World -> [(Point2,Point2,Point2,Point2)]
|
||||
wallsForGloom' w = map (wallPairToFour . _wlLine) $ filter (not . _wlIsSeeThrough)
|
||||
$ IM.elems $ wallsNearZones (zoneOfDoubleScreen w) w
|
||||
|
||||
where wallPairToFour (x:y:_) = (ss x,ss y,ss $ x +.+ n,ss $ y+.+ n)
|
||||
where n = 20 *.* (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'
|
||||
-- the ss transformation would possibly be better done using a matrix in the
|
||||
-- shader
|
||||
zoom = _cameraZoom w
|
||||
|
||||
lightsForGloom :: World -> [(Point2,Float,Float)]
|
||||
lightsForGloom w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempLightSources w)
|
||||
|
||||
Reference in New Issue
Block a user