Files
loop/src/Dodge/LightSource.hs
T
2025-11-23 19:08:22 +00:00

48 lines
1.3 KiB
Haskell

module Dodge.LightSource (
lsColPosRad,
lsColPos,
lsPosCol,
lsPosRad,
lsColPosID,
-- destroyLS,
destroyLSFlashAt,
) where
import Dodge.Data.World
import Dodge.Material.Sound
import Dodge.WorldEvent.Sound
import Geometry.Data
import Geometry.Vector
import LensHelp
lsPosRad :: Point3 -> Float -> LightSource
lsPosRad = lsColPosRad 0.75
lsColPosID :: Point3 -> Point3 -> Int -> LightSource
lsColPosID col p i = lsColPos col p & lsID .~ i
lsColPos :: Point3 -> Point3 -> LightSource
lsColPos col pos = lsColPosRad col pos 250
lsPosCol :: Point3 -> Point3 -> LightSource
lsPosCol pos col = lsColPos col pos
lsColPosRad :: Point3 -> Point3 -> Float -> LightSource
lsColPosRad col p r = LS 0 $ LSParam p r col
--destroyLS :: Int -> World -> World
--destroyLS lsid w =
-- w
-- & cWorld . lWorld . lightSources . at lsid .~ Nothing
-- & destroyLSFlashAt p3
-- where
-- -- & soundOriginsIDsAt [MaterialSound Glass n | n <- [0, 1, 2]] (destroyMatS Glass) (xyV3 p3)
--
-- ls = w ^?! cWorld . lWorld . lightSources . ix lsid -- unsafe
-- p3 = _lsPos $ _lsParam ls
destroyLSFlashAt :: Point3 -> World -> World
destroyLSFlashAt x =
(cWorld . lWorld . worldEvents .:~ MakeTempLightFade 0.05 (LSParam x 150 1) 20)
. soundOriginsIDsAt [MaterialSound Glass n | n <- [0, 1, 2]] (destroyMatS Glass) (xyV3 x)