Refactor, try to limit dependencies
This commit is contained in:
+14
-14
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user