This commit is contained in:
2022-06-18 00:18:18 +01:00
parent a7c03671d3
commit 6a095d3de6
12 changed files with 49 additions and 36 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
module Dodge.Render.Lights
( lightsForGloom
( lightsToRender
) where
import Dodge.Data
import Dodge.CullBox
@@ -8,8 +8,8 @@ import Geometry
import Data.Maybe
import qualified Data.IntMap.Lazy as IM
lightsForGloom :: Configuration -> World -> [(Point3,Float,Point3)]
lightsForGloom cfig w = mapMaybe getLS (IM.elems $ _lightSources w)
lightsToRender :: Configuration -> World -> [(Point3,Float,Point3)]
lightsToRender cfig w = mapMaybe getLS (IM.elems $ _lightSources w)
++ mapMaybe getTLS (_tempLightSources w)
where
getLS = getlsparam . _lsParam
+1 -1
View File
@@ -73,7 +73,7 @@ optionValueOffset u mo = case _moString mo u of
Right (s,_) -> length s
darkenBackground :: Configuration -> Picture
darkenBackground = color (withAlpha 0.5 black) . polygon . screenBox
darkenBackground = color (withAlpha 0.5 black) . polygon . reverse . screenBox
drawTitle :: Configuration -> String -> Picture
drawTitle cfig = placeString (-hw + 30) (hh - 50) 0.4
+12 -6
View File
@@ -41,12 +41,12 @@ worldSPic cfig w =
<> foldMap mcSPic (filtOn _mcPos _machines)
where
filtOn f g = IM.filter (pointIsClose . f) (g w)
--pointIsClose p = dist camCen p < _viewDistance w
pointIsClose = cullPoint w
--camCen = _cameraCenter w
pointIsClose = cullPoint cfig w
cullPoint :: World -> Point2 -> Bool
cullPoint w p = pointInPolygon p (_boundBox w)
cullPoint :: Configuration -> World -> Point2 -> Bool
cullPoint cfig w p
| debugOn Close_shape_culling cfig = pointInPolygon p (_boundBox w)
| otherwise = dist (_cameraCenter w) p < _viewDistance w
extraShapes :: World -> Shape
extraShapes = _foregroundShape
@@ -69,9 +69,15 @@ extraPics cfig w = pictures (_decorations w)
<> drawWallIDs cfig w
<> drawPathing cfig w
<> drawCrInfo cfig w
<> drawBoundingBox cfig w
testPic :: Configuration -> World -> Picture
testPic cfig w = setLayer DebugLayer $ color green $ line $ (x:xs) ++ [x]
testPic _ _ = mempty
drawBoundingBox :: Configuration -> World -> Picture
drawBoundingBox cfig w
| debugOn Show_bound_box cfig = setLayer DebugLayer $ color green $ line $ (x:xs) ++ [x]
| otherwise = mempty
where
(x:xs) = cullBox cfig w