37 lines
822 B
Haskell
37 lines
822 B
Haskell
module Dodge.Default.LightSource where
|
|
import Dodge.Data
|
|
import Picture
|
|
import Geometry
|
|
import LensHelp
|
|
|
|
defaultLS :: LightSource
|
|
defaultLS = LS
|
|
{ _lsID = 0
|
|
, _lsParam = LSParam
|
|
{ _lsPos = V3 0 0 50
|
|
, _lsRad = 700
|
|
, _lsCol = 0.6
|
|
}
|
|
, _lsDir = 0
|
|
, _lsPict = 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
|
|
{ _lsPos = 0
|
|
, _lsRad = 0
|
|
, _lsCol = 0.5
|
|
}
|
|
, _tlsUpdate = f
|
|
, _tlsTime = 1
|
|
}
|
|
where
|
|
f _ t
|
|
| _tlsTime t <= 0 = Nothing
|
|
| otherwise = Just $ t & tlsTime -~ 1
|