First pass implementing exponentially fading lighting

This commit is contained in:
jgk
2021-02-22 13:45:59 +01:00
parent c75cda639b
commit e855d303e8
10 changed files with 117 additions and 49 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ lightAt p i =
,_lsPos = p
,_lsDir = 0
,_lsRad = 300
,_lsIntensity = 0.25
,_lsIntensity = 0.5
}
basicLS = PutLS ls dec
+12 -1
View File
@@ -513,7 +513,7 @@ wallsForGloom' w = map (wallPairToFour . _wlLine) $ filter (not . _wlIsSeeThroug
$ 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)
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'
@@ -521,6 +521,17 @@ wallsForGloom' w = map (wallPairToFour . _wlLine) $ filter (not . _wlIsSeeThroug
-- shader
zoom = _cameraZoom w
lightsForGloom' :: World -> [(Point4)]
lightsForGloom' w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempLightSources w)
where getLS ls = ( fst $ ssls ls, snd $ ssls ls, _lsRad ls , _lsIntensity ls)
getTLS ls = ( fst $ sstls ls,snd $ sstls ls, _tlsRad ls, _tlsIntensity ls)
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'
ssls = ss . _lsPos
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)