Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+14 -14
View File
@@ -1,27 +1,27 @@
module Dodge.Render.Lights
( lightsToRender
) where
import Dodge.Data
--import Dodge.CullBox
import Geometry
module Dodge.Render.Lights (
lightsToRender,
) where
import Data.Maybe
import Dodge.Data.Universe
import Geometry
import qualified IntMapHelp as IM
lightsToRender :: Configuration -> World -> [(Point3,Float,Point3)]
lightsToRender cfig w = mapMaybe getLS (IM.elems $ _lightSources (_cWorld w))
++ mapMaybe getTLS (_tempLightSources (_cWorld w))
where
getLS = getlsparam . _lsParam
getTLS = getlsparam . _tlsParam
lightsToRender :: Configuration -> World -> [(Point3, Float, Point3)]
lightsToRender cfig w =
mapMaybe getLS (IM.elems $ _lightSources (_cWorld w))
++ mapMaybe getTLS (_tempLightSources (_cWorld w))
where
getLS = getlsparam . _lsParam
getTLS = getlsparam . _tlsParam
cbox = _boundBox (_cWorld w)
cpos = _cameraCenter (_cWorld w)
getlsparam ls
| not (pointInPolygon lpos cbox) && extraculltest = Nothing
| otherwise = Just ( _lsPos ls, rad^(2::Int) , _lsCol ls)
| otherwise = Just (_lsPos ls, rad ^ (2 :: Int), _lsCol ls)
where
lpos = xyV3 $ _lsPos ls
rad = _lsRad ls
rad = _lsRad ls
extraculltest
| debugOn Cull_more_lights cfig = True
| otherwise = isNothing (intersectSegPolyFirst lpos (lpos +.+ rad *.* normalizeV (cpos -.- lpos)) cbox)