Remove temporary light sources as separate entity

This commit is contained in:
2024-11-26 13:12:55 +00:00
parent e93a804559
commit cc302a6846
17 changed files with 243 additions and 241 deletions
+19 -19
View File
@@ -4,22 +4,22 @@ import Control.Lens
import Dodge.Data.LightSource
import Geometry
updateTempLightSource :: TLSUpdate -> TempLightSource -> Maybe TempLightSource
updateTempLightSource tlsu = case tlsu of
DestroyTLS -> const Nothing
TimerTLS -> timerTLS
IntensityTLS ConstantIntensity -> updateTempLightSource TimerTLS
IntensityTLS (TLSFade startcol x) -> fadeTLS startcol x
fadeTLS :: Point3 -> Int -> TempLightSource -> Maybe TempLightSource
fadeTLS startcol x tls
| t < 1 = Nothing
| t < x = Just $ tls & tlsParam . lsCol .~ (1 / fromIntegral (x - t)) *.*.* startcol
| otherwise = Just $ tls & tlsParam . lsCol .~ startcol -- this is wasteful, should be set once at begining
where
t = _tlsTime tls
timerTLS :: TempLightSource -> Maybe TempLightSource
timerTLS t
| _tlsTime t <= 0 = Nothing
| otherwise = Just $ t & tlsTime -~ 1
--updateTempLightSource :: TLSUpdate -> TempLightSource -> Maybe TempLightSource
--updateTempLightSource tlsu = case tlsu of
-- DestroyTLS -> const Nothing
-- TimerTLS -> timerTLS
-- IntensityTLS ConstantIntensity -> updateTempLightSource TimerTLS
-- IntensityTLS (TLSFade startcol x) -> fadeTLS startcol x
--
--fadeTLS :: Point3 -> Int -> TempLightSource -> Maybe TempLightSource
--fadeTLS startcol x tls
-- | t < 1 = Nothing
-- | t < x = Just $ tls & tlsParam . lsCol .~ (1 / fromIntegral (x - t)) *.*.* startcol
-- | otherwise = Just $ tls & tlsParam . lsCol .~ startcol -- this is wasteful, should be set once at begining
-- where
-- t = _tlsTime tls
--
--timerTLS :: TempLightSource -> Maybe TempLightSource
--timerTLS t
-- | _tlsTime t <= 0 = Nothing
-- | otherwise = Just $ t & tlsTime -~ 1