Project wall shadows onto other walls
This commit is contained in:
+8
-37
@@ -467,43 +467,14 @@ displayHP n w = translate (halfWidth w-80) (halfHeight w-20) $
|
||||
scale 0.2 0.2 $ text $ reverse $ take 5 $ (++ repeat ' ') $ reverse $ show
|
||||
$ _crHP $ _creatures w IM.! n
|
||||
|
||||
wallsForGloom :: World -> [(Point2,Point2,Point2,Point2)]
|
||||
wallsForGloom :: World -> [(Point2,Point2)]
|
||||
wallsForGloom w = map (linePairs . _wlLine) $ filter (not . _wlIsSeeThrough)
|
||||
$ filter wallCastsShadow
|
||||
$ IM.elems $ wallsNearZones (zoneOfDoubleScreen w) w
|
||||
where linePairs (x:y:z:w:_) = (x,y,z,w)
|
||||
linePairs (x:y:_) = (x,y,x,y)
|
||||
where linePairs (x:y:_) = (x,y)
|
||||
wallCastsShadow wl = case wl ^? wlCastShadow of
|
||||
Just b -> b
|
||||
Nothing -> True
|
||||
--(AutoDoor {_wlCastShadow = b}) = b
|
||||
-- wallCastsShadow _ = True
|
||||
|
||||
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:_) = (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'
|
||||
-- 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)
|
||||
@@ -516,9 +487,9 @@ lightsForGloom' w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempL
|
||||
sstls = ss . _tlsPos
|
||||
zoom = _cameraZoom w
|
||||
|
||||
lightsForGloom :: World -> [(Point2,Float,Float)]
|
||||
lightsForGloom w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempLightSources w)
|
||||
where getLS ls = (screenShift $ _lsPos ls, _lsRad ls * zoom, _lsIntensity ls)
|
||||
getTLS ls = (screenShift $ _tlsPos ls, _tlsRad ls * zoom, _tlsIntensity ls)
|
||||
screenShift x = zoom *.* rotateV (0 - _cameraRot w) (x -.- _cameraPos w)
|
||||
zoom = _cameraZoom w
|
||||
--lightsForGloom :: World -> [(Point2,Float,Float)]
|
||||
--lightsForGloom w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempLightSources w)
|
||||
-- where getLS ls = (screenShift $ _lsPos ls, _lsRad ls * zoom, _lsIntensity ls)
|
||||
-- getTLS ls = (screenShift $ _tlsPos ls, _tlsRad ls * zoom, _tlsIntensity ls)
|
||||
-- screenShift x = zoom *.* rotateV (0 - _cameraRot w) (x -.- _cameraPos w)
|
||||
-- zoom = _cameraZoom w
|
||||
|
||||
+1
-1
@@ -548,7 +548,7 @@ deadEndRoom = Room
|
||||
]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = []
|
||||
, _rmPS = [PS (0,-20) 0 basicLS]
|
||||
, _rmPS = [PS (0,-10) 0 basicLS]
|
||||
, _rmBound = rectNSWE 20 (-20) (-30) 30
|
||||
}
|
||||
where lnks = [((0,30) ,0)
|
||||
|
||||
Reference in New Issue
Block a user