Provisional working coloured lights
This commit is contained in:
+2
-2
@@ -142,12 +142,12 @@ data LightSource = LS
|
||||
, _lsPos :: !Point3
|
||||
, _lsDir :: !Float
|
||||
, _lsRad :: !Float
|
||||
, _lsIntensity :: !Float
|
||||
, _lsIntensity :: !Point3
|
||||
}
|
||||
data TempLightSource = TLS
|
||||
{ _tlsPos :: !Point3
|
||||
, _tlsRad :: !Float
|
||||
, _tlsIntensity :: !Float
|
||||
, _tlsIntensity :: !Point3
|
||||
, _tlsUpdate :: World -> TempLightSource -> (World, Maybe TempLightSource)
|
||||
}
|
||||
data Creature = Creature
|
||||
|
||||
@@ -25,15 +25,19 @@ tLightFade :: Int -> Float -> (Int -> Float) -> Point2 -> TempLightSource
|
||||
tLightFade 0 rmax intensityF (V2 x y) = TLS
|
||||
{ _tlsPos = V3 x y 0
|
||||
, _tlsRad = rmax
|
||||
, _tlsIntensity = intensityF 0
|
||||
, _tlsIntensity = f $ intensityF 0
|
||||
, _tlsUpdate = \w _ -> (w, Nothing)
|
||||
}
|
||||
where
|
||||
f x' = V3 x' x' x'
|
||||
tLightFade i rmax intensityF p@(V2 x y) = TLS
|
||||
{ _tlsPos = V3 x y 0
|
||||
, _tlsRad = rmax
|
||||
, _tlsIntensity = intensityF i
|
||||
, _tlsIntensity = f $ intensityF i
|
||||
, _tlsUpdate = \w _ -> (w, Just $ tLightFade (i-1) rmax intensityF p)
|
||||
}
|
||||
where
|
||||
f x' = V3 x' x' x'
|
||||
|
||||
tLightRad
|
||||
:: Int
|
||||
|
||||
@@ -220,7 +220,7 @@ wallsToList :: [((Point2,Point2),Point4)] -> [Float]
|
||||
wallsToList = concatMap (\((V2 a b,V2 c d),V4 e f g h) -> [a,b,c,d,e,f,g,h])
|
||||
|
||||
|
||||
lightsForGloom :: World -> [(Point3,Float,Float)]
|
||||
lightsForGloom :: World -> [(Point3,Float,Point3)]
|
||||
lightsForGloom w = map getLS (IM.elems $ _lightSources w) ++ map getTLS (_tempLightSources w)
|
||||
where
|
||||
getLS ls = ( _lsPos ls, _lsRad ls , _lsIntensity ls)
|
||||
|
||||
Reference in New Issue
Block a user