Refactor light sources

This commit is contained in:
2021-11-28 16:53:26 +00:00
parent 1d9dd3e4e0
commit 618653a86e
28 changed files with 169 additions and 155 deletions
+3 -2
View File
@@ -2,6 +2,7 @@ module Dodge.Placement.Instance.Sensor
( lightSensor
) where
import Color
import Dodge.LightSource
import Dodge.Data
import Dodge.LevelGen.Data
import Dodge.Default
@@ -24,7 +25,7 @@ damageSensor damF wdth upf ps = pContID ps ( PutLS theLS)
, _mcLSs = [lsid]
}
where
theLS = defaultLS { _lsPos = V3 0 0 30 , _lsIntensity = 0.1 }
theLS = lsPosCol (V3 0 0 30) (0.1)
lightSensor :: Float -> (Machine -> World -> World) -> PlacementSpot -> Placement
lightSensor = damageSensor senseLasering
@@ -46,7 +47,7 @@ sensorUpdate damF mc w = w & machines . ix mcid %~ upmc
(senseData,dam) = partitionEithers $ map damF $ _mcDamage mc
newSense = sum senseData
ni = fromIntegral x / 1000
upls = lsIntensity .~ V3 ni ni ni
upls = lsParam . lsCol .~ V3 ni ni ni
sensorSPic :: Float -> Machine -> SPic
sensorSPic wdth _ = ( colorSH yellow $ upperPrismPoly 25 (square wdth)