Refactor light sources

This commit is contained in:
2022-07-21 16:21:35 +01:00
parent cf5ec4a261
commit aabd8a2cb8
8 changed files with 71 additions and 45 deletions
+2 -13
View File
@@ -1,8 +1,6 @@
module Dodge.Default.LightSource where
import Dodge.Data
import Picture
import Geometry
import LensHelp
defaultLS :: LightSource
defaultLS = LS
@@ -13,13 +11,8 @@ defaultLS = LS
, _lsCol = 0.6
}
, _lsDir = 0
, _lsPict = defLSPic
, _lsPict = DefaultLightSourceDraw --defLSPic
}
defLSPic :: LightSource -> Picture
defLSPic ls = setLayer BloomNoZWrite . translate3 (_lsPos $ _lsParam ls) . color col $ circleSolid 4
where
col = V4 r g b 2
V3 r g b = _lsCol $ _lsParam ls
defaultTLS :: TempLightSource
defaultTLS = TLS
{ _tlsParam = LSParam
@@ -27,10 +20,6 @@ defaultTLS = TLS
, _lsRad = 0
, _lsCol = 0.5
}
, _tlsUpdate = f
, _tlsUpdate = TimerTLS
, _tlsTime = 1
}
where
f t
| _tlsTime t <= 0 = Nothing
| otherwise = Just $ t & tlsTime -~ 1