module Dodge.Render.Lights ( lightsToRender ) where import Dodge.Data --import Dodge.CullBox import Geometry import Data.Maybe import qualified IntMapHelp as IM lightsToRender :: Configuration -> World -> [(Point3,Float,Point3)] lightsToRender cfig w = mapMaybe getLS (IM.elems $ _lightSources w) ++ mapMaybe getTLS (_tempLightSources w) where getLS = getlsparam . _lsParam getTLS = getlsparam . _tlsParam cbox = _boundBox w cpos = _cameraCenter w getlsparam ls | not (pointInPolygon lpos cbox) && extraculltest = Nothing | otherwise = Just ( _lsPos ls, rad^(2::Int) , _lsCol ls) where lpos = xyV3 $ _lsPos ls rad = _lsRad ls extraculltest | debugOn Cull_more_lights cfig = True | otherwise = isNothing (intersectSegPolyFirst lpos (lpos +.+ rad *.* normalizeV (cpos -.- lpos)) cbox)