Add aggressive light culling
This commit is contained in:
@@ -2,17 +2,24 @@ module Dodge.Render.Lights
|
||||
( lightsForGloom
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.CullBox
|
||||
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)
|
||||
lightsForGloom :: Configuration -> World -> [(Point3,Float,Point3)]
|
||||
lightsForGloom cfig w = mapMaybe getLS (IM.elems $ _lightSources w)
|
||||
++ mapMaybe getTLS (_tempLightSources w)
|
||||
where
|
||||
getLS = getlsparam . _lsParam
|
||||
getTLS = getlsparam . _tlsParam
|
||||
cbox = cullBox cfig w
|
||||
getlsparam ls
|
||||
| not (pointInPolygon lpos cbox) = Nothing
|
||||
| dist (_cameraCenter w) (fst2 $ _lsPos ls) > _viewDistance w + _lsRad ls = Nothing
|
||||
| otherwise = Just ( _lsPos ls, _lsRad ls^(2::Int) , _lsCol ls)
|
||||
where
|
||||
lpos = xyV3 $ _lsPos ls
|
||||
rad = _lsRad ls
|
||||
fst2 (V3 a b _) = V2 a b
|
||||
|
||||
Reference in New Issue
Block a user