Reduce number of wall points sent for shadows

This commit is contained in:
jgk
2021-02-27 02:27:43 +01:00
parent 3b4b387943
commit 33ebc1556d
2 changed files with 23 additions and 7 deletions
+15 -3
View File
@@ -559,11 +559,11 @@ displayHP n w = translate (halfWidth w-70) (halfHeight w-40) $
testPic w = blank
wallsForGloom' :: World -> [(Point2,Point2,Point2,Point2)]
wallsForGloom' w = map (wallPairToFour . _wlLine) $ filter (not . _wlIsSeeThrough)
wallsForGloom' :: World -> [(Point2,Point2)]
wallsForGloom' w = map (wallPairBack . _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 wallPairBack (x:y:_) = (ss $ x +.+ n,ss $ 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)
@@ -571,6 +571,18 @@ wallsForGloom' w = map (wallPairToFour . _wlLine) $ filter (not . _wlIsSeeThroug
-- the ss transformation would possibly be better done using a matrix in the
-- shader
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 = 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'
---- the ss transformation would possibly be better done using a matrix in the
---- shader
-- zoom = _cameraZoom w
lightsForGloom' :: World -> [(Point4)]
lightsForGloom' w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempLightSources w)