Use texture array for character rendering, condense rendering

This commit is contained in:
2023-03-23 14:08:07 +00:00
parent 68b43f29ff
commit 3350a8dc30
9 changed files with 80 additions and 42 deletions
+10 -5
View File
@@ -2,6 +2,8 @@ module Dodge.Render.ShapePicture (
worldSPic,
) where
import Dodge.Render.Picture
import Dodge.Data.Universe
import Control.Lens
import Control.Monad (guard)
import Data.Foldable
@@ -41,9 +43,9 @@ import ShapePicture
import ShortShow
import Sound.Data
worldSPic :: Configuration -> World -> SPic
worldSPic cfig w =
(mempty, extraPics cfig w)
worldSPic :: Configuration -> Universe -> SPic
worldSPic cfig u =
(mempty, extraPics cfig u)
<> foldup drawProp' (filtOn _prPos _props)
<> foldup drawProjectile (filtOn _prjPos _projectiles)
<> foldup (shiftDraw _blPos _blDir (drawBlock . _blDraw)) (filtOn _blPos _blocks)
@@ -56,6 +58,7 @@ worldSPic cfig w =
<> aimDelaySweep cfig w
<> anyTargeting cfig w
where
w = _uvWorld u
foldup = foldMap'
filtOn f g = IM.filter (pointIsClose . f) (g (_lWorld (_cWorld w)))
pointIsClose = cullPoint cfig w
@@ -144,9 +147,10 @@ cullPoint cfig w p
| debugOn Close_shape_culling cfig = pointInPolygon p (w ^. cWorld . camPos . camBoundBox)
| otherwise = dist (w ^. cWorld . camPos . camCenter) p < (w ^. cWorld . camPos . camViewDistance)
extraPics :: Configuration -> World -> Picture
extraPics cfig w =
extraPics :: Configuration -> Universe -> Picture
extraPics cfig u =
pictures (_decorations lw)
<> setLayer FixedCoordLayer (fixedCoordPictures u)
<> concatMapPic drawTractorBeam (_tractorBeams lw)
<> concatMapPic drawLinearShockwave (_linearShockwaves lw)
<> concatMapPic drawShockwave (_shockwaves lw)
@@ -167,6 +171,7 @@ extraPics cfig w =
<> viewClipBounds cfig w
<> debugDraw cfig w
where
w = u ^. uvWorld
lw = w ^. cWorld . lWorld
debugDraw :: Configuration -> World -> Picture