This commit is contained in:
2022-12-28 10:21:00 +00:00
parent 2d4a55dee0
commit d1f80f1f7f
7 changed files with 76 additions and 138 deletions
+9 -7
View File
@@ -3,20 +3,22 @@ module Dodge.Render.Lights (
) where
import Data.Maybe
import Dodge.Data.Universe
import Dodge.Data.LWorld
import Dodge.Data.CamPos
import Dodge.Data.Config
import Geometry
import qualified IntMapHelp as IM
import Control.Lens
lightsToRender :: Configuration -> World -> [(Point3, Float, Point3)]
lightsToRender cfig w =
mapMaybe getLS (IM.elems $ w ^. cWorld . lWorld . lightSources)
++ mapMaybe getTLS (w ^. cWorld . lWorld . tempLightSources)
lightsToRender :: Configuration -> CamPos -> LWorld -> [(Point3, Float, Point3)]
lightsToRender cfig campos w =
mapMaybe getLS (IM.elems $ w ^. lightSources)
++ mapMaybe getTLS (w ^. tempLightSources)
where
getLS = getlsparam . _lsParam
getTLS = getlsparam . _tlsParam
cbox = w ^. cWorld . camPos . camBoundBox
cpos = w ^. cWorld . camPos . camCenter
cbox = campos ^. camBoundBox
cpos = campos ^. camCenter
getlsparam ls
| not (pointInPolygon lpos cbox) && extraculltest = Nothing
| otherwise = Just (_lsPos ls, rad ^ (2 :: Int), _lsCol ls)