Add num_shadow_casters graphics parameter, allow cycle down enum options

This commit is contained in:
2023-02-26 23:38:58 +00:00
parent bf1bd5bb0b
commit 6b0f78d4eb
9 changed files with 203 additions and 151 deletions
+4 -1
View File
@@ -2,6 +2,7 @@ module Dodge.Render.Lights (
lightsToRender,
) where
import Data.List (sortOn)
import Data.Maybe
import Dodge.Data.LWorld
import Dodge.Data.CamPos
@@ -11,7 +12,9 @@ import qualified IntMapHelp as IM
import Control.Lens
lightsToRender :: Configuration -> CamPos -> LWorld -> [(Point3, Float, Point3)]
lightsToRender cfig campos w =
{-# INLINE lightsToRender #-}
lightsToRender cfig campos w = take (fromEnum $ cfig ^. graphics_num_shadow_casters) $
sortOn (\(_,x,_) -> negate x) $
mapMaybe getLS (IM.elems $ w ^. lightSources)
++ mapMaybe getTLS (w ^. tempLightSources)
where