Refactor light sources
This commit is contained in:
+13
-19
@@ -24,23 +24,23 @@ import Dodge.Material.Sound
|
||||
lsPosRad :: Point3 -> Float -> LightSource
|
||||
lsPosRad = lsColPosRad 0.75
|
||||
|
||||
tlsTimeRadFunPos :: Int -> Float -> (Int -> Float) -> Point3 -> TempLightSource
|
||||
tlsTimeRadFunPos :: Int -> Float -> TLSIntensity -> Point3 -> TempLightSource
|
||||
tlsTimeRadFunPos t rmax intensityF p = TLS
|
||||
{ _tlsParam = LSParam
|
||||
{ _lsPos = p
|
||||
, _lsRad = rmax
|
||||
, _lsCol = f $ intensityF t
|
||||
, _lsCol = 0 -- intensityF t
|
||||
}
|
||||
, _tlsUpdate = upF
|
||||
, _tlsUpdate = IntensityTLS intensityF
|
||||
, _tlsTime = t
|
||||
}
|
||||
where
|
||||
upF tls
|
||||
| _tlsTime tls <= 0 = Nothing
|
||||
| otherwise = Just $ tls
|
||||
& tlsTime -~ 1
|
||||
& tlsParam . lsCol .~ f (intensityF (_tlsTime tls) )
|
||||
f x' = V3 x' x' x'
|
||||
-- upF tls
|
||||
-- | _tlsTime tls <= 0 = Nothing
|
||||
-- | otherwise = Just $ tls
|
||||
-- & tlsTime -~ 1
|
||||
-- & tlsParam . lsCol .~ f (intensityF (_tlsTime tls) )
|
||||
-- f x' = V3 x' x' x'
|
||||
|
||||
lsPosColRad :: Point3 -> Point3 -> Float -> LightSource
|
||||
lsPosColRad p col = lsColPosRad col p
|
||||
@@ -79,14 +79,9 @@ tlsTimeRadColPos t rmax col (V3 x y z) = TLS
|
||||
, _lsRad = rmax
|
||||
, _lsCol = col
|
||||
}
|
||||
, _tlsUpdate = upF
|
||||
, _tlsUpdate = TimerTLS
|
||||
, _tlsTime = t
|
||||
}
|
||||
where
|
||||
upF tls
|
||||
| _tlsTime tls <= 0 = Nothing
|
||||
| otherwise = Just $ tls
|
||||
& tlsTime -~ 1
|
||||
|
||||
makeTlsTimeRadColPos :: Int -> Float -> Point3 -> Point3 -> World -> World
|
||||
makeTlsTimeRadColPos i rad (V3 r g b) p = tempLightSources .:~ tlsTimeRadColPos i rad (V3 r g b) p
|
||||
@@ -101,9 +96,8 @@ destroyLS lsid w = w
|
||||
p3 = _lsPos $ _lsParam ls
|
||||
|
||||
destroyLSFlashAt :: Point3 -> World -> World
|
||||
destroyLSFlashAt (V3 x' y' z') = tempLightSources .:~ tlsTimeRadFunPos 20 150 intensityFunc (addZ z' p)
|
||||
destroyLSFlashAt (V3 x' y' z') = tempLightSources .:~ tlsTimeRadFunPos 20 150
|
||||
(TLSFade 1 10)
|
||||
(addZ z' p)
|
||||
where
|
||||
p = V2 x' y'
|
||||
intensityFunc x
|
||||
| x < 10 = 1 / (10 - fromIntegral x)
|
||||
| otherwise = 1
|
||||
|
||||
Reference in New Issue
Block a user