Add indexed world modifications, example use in flicker lights

This commit is contained in:
2021-11-17 11:24:40 +00:00
parent 559d7e3a23
commit 9db091597d
10 changed files with 110 additions and 32 deletions
+3 -3
View File
@@ -14,7 +14,7 @@ import Data.Maybe
import Control.Lens
triggerSwitchSPic :: (Button -> SPic) -> PlacementSpot -> Placement
triggerSwitchSPic sdraw ps = plCont ps (PutTrigger (const False))
triggerSwitchSPic sdraw ps = psPtCont ps (PutTrigger (const False))
$ \tp -> Just $ pContID ps (PutButton (makeSwitchSPic sdraw (oneff $ trigid tp) (offeff $ trigid tp)))
(const Nothing)
where
@@ -23,7 +23,7 @@ triggerSwitchSPic sdraw ps = plCont ps (PutTrigger (const False))
offeff tid = triggers . ix tid .~ const False
triggerSwitchSPicLight :: (Button -> SPic) -> PlacementSpot -> Placement
triggerSwitchSPicLight sdraw ps = plCont ps (PutTrigger (const False))
triggerSwitchSPicLight sdraw ps = psPtCont ps (PutTrigger (const False))
$ \tp -> Just $ pContID fstLnkOut (PutLS thels)
$ \lsid -> Just
$ pContID ps (PutButton (makeSwitchSPic sdraw (oneff lsid $ trigid tp) (offeff lsid $ trigid tp)))
@@ -37,7 +37,7 @@ triggerSwitchSPicLight sdraw ps = plCont ps (PutTrigger (const False))
offeff lsid tid = eff lsid tid False (V3 0.5 0 0)
triggerSwitch :: Color -> PlacementSpot -> Placement
triggerSwitch col ps = plCont ps (PutTrigger (const False))
triggerSwitch col ps = psPtCont ps (PutTrigger (const False))
$ \tp -> Just $ pContID ps (PutButton (makeSwitch col col (oneff $ trigid tp) (offeff $ trigid tp)))
(const Nothing)
where
@@ -101,6 +101,12 @@ unusedLnkToPS rp = case rp of
UnusedLink p a -> Just $ PS p a
_ -> Nothing
spanLSLightI :: LightSource -> Float -> Point2 -> Point2 -> Placement
spanLSLightI ls h a b = ps0j (PutLS ls {_lsPos = V3 x y h})
$ sps0 $ PutForeground $ thinHighBar h a b
where
V2 x y = 0.5 *.* (a +.+ b)
spanColLightI :: Point3 -> Float -> Point2 -> Point2 -> Placement
spanColLightI col h a b = ps0j (PutLS $ colorLightAt col (V3 x y (h-5)) 0)
$ sps0 $ PutForeground $ thinHighBar h a b