Reorganise render collections

This commit is contained in:
2021-11-01 02:15:22 +00:00
parent da346bc3a0
commit 7692421112
6 changed files with 76 additions and 186 deletions
+20
View File
@@ -0,0 +1,20 @@
module Dodge.Render.Lights
( lightsForGloom
) where
import Dodge.Data
import Geometry
import Data.Maybe
import qualified Data.IntMap.Lazy as IM
lightsForGloom :: World -> [(Point3,Float,Point3)]
lightsForGloom w = mapMaybe getLS (IM.elems $ _lightSources w) ++ mapMaybe getTLS (_tempLightSources w)
where
getLS ls
| dist campos (fst2 $ _lsPos ls) > 1000 = Nothing
| otherwise = Just ( _lsPos ls, _lsRad ls^(2::Int) , _lsIntensity ls)
getTLS ls
| dist campos (fst2 $ _tlsPos ls) > 1000 = Nothing
| otherwise = Just ( _tlsPos ls, _tlsRad ls^(2::Int), _tlsIntensity ls)
campos = _cameraCenter w
fst2 (V3 a b _) = V2 a b