Rendering optimisations (mainly inlining)

This commit is contained in:
jgk
2021-07-31 23:38:37 +02:00
parent d7649b951b
commit 54c912224b
7 changed files with 92 additions and 34 deletions
+1 -2
View File
@@ -49,7 +49,6 @@ doDrawing pdata w = do
(wallPointsCol,windowPoints) = wallsAndWindows w
lightPoints = lightsForGloom w
viewFroms = _cameraViewFrom w
pic = worldPictures w
-- bind as much data into vbos as feasible at this point
-- poke wall points and colors
nWalls <- poke224s (shadVBOptr $ _wallTextureShader pdata) wallPointsCol
@@ -79,7 +78,7 @@ doDrawing pdata w = do
_ <- renderFoldable pdata $ polysToPic $ foregroundPics w
vnums <- pokeBindFoldableLayer pdata pic
vnums <- pokeBindFoldableLayer pdata $ worldPictures w
let shads = _pictureShaders pdata
renderLayer 0 shads vnums
+6 -3
View File
@@ -21,9 +21,12 @@ import Data.List (partition)
import qualified Data.IntMap.Lazy as IM
worldPictures :: World -> Picture
worldPictures w =
concat (IM.elems $ _decorations w) ++ testPic w ++ concat
[ concatMap (dbArg _pjDraw) . IM.elems $ _projectiles w
worldPictures w = concat $
(IM.elems $ _decorations w) ++
(map (dbArg _pjDraw) . IM.elems $ _projectiles w) ++
(map (crDraw w) . IM.elems $ _creatures w) ++
(map (dbArg _ptDraw) $ _particles w) ++
[ testPic w
, concatMap drawItem . IM.elems $ _floorItems w
, concatMap (crDraw w) . IM.elems $ _creatures w
, concatMap clDraw . reverse $ _clouds w
+3 -3
View File
@@ -72,14 +72,14 @@ makeExplosionAt p w
. explosionFlashAt p
$ makeShockwaveAt [] p 50 10 1 white w
where
fVs = replicateM 75 (randInCirc 1) & evalState $ _randGen w
fPs'' = replicateM 75 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w
fVs = replicateM 15 (randInCirc 1) & evalState $ _randGen w
fPs'' = replicateM 15 (fmap (15 *.*.*) randInHemisphere) & evalState $ _randGen w
(fPs',zs) = let (a,b,c) = unzip3 $ map fromV3 fPs''
in (zipWith V2 a b, c)
fPs = map (pushAgainstWalls . (+.+) p . (*.*) 0.5) fPs'
inversePushOut v = (15 - magV v) * 0.01 *.* v
fVs' = zipWith (+.+) fVs $ map inversePushOut fPs'
sizes = randomRs (2,6) $ _randGen w
sizes = randomRs (2,9) $ _randGen w
times = randomRs (20,25) $ _randGen w
mF q z v size time = makeFlameletTimed q z v Nothing size time
newFs = zipWith5 mF fPs zs (fmap (3 *.*) fVs') sizes times