Draw chasms using vertex pulling

This commit is contained in:
2025-11-13 21:58:40 +00:00
parent ec1216e7eb
commit 836c0ba772
6 changed files with 25 additions and 22 deletions
+8 -2
View File
@@ -1,5 +1,7 @@
module Dodge.WorldLoad (postUniverseLoadSideEffect) where
import Shader.Parameters
import Graphics.GL.Core45
import Control.Lens
import Control.Monad
import Data.Preload.Render
@@ -16,8 +18,12 @@ postWorldLoad :: RenderData -> CWorld -> IO CWorld
postWorldLoad rdata cw = do
nfloorvxs <- foldM (pokeTile (rdata ^. floorVBO . vboPtr)) 0 (cw ^. cwTiles)
bufferPokedVBO (rdata ^. floorVBO) nfloorvxs
nchasmvxs <- foldM (pokeChasm (rdata ^. chasmVBO . vboPtr)) 0 (cw ^. chasms)
bufferPokedVBO (rdata ^. chasmVBO) nchasmvxs
let chbo = rdata ^. chasmVBO . vboName
chptr = rdata ^. chasmVBO . vboPtr
nchasmvxs <- foldM (pokeChasm chptr) 0 (cw ^. chasms)
glInvalidateBufferData chbo
glNamedBufferStorage chbo (fromIntegral $ 2 * nchasmvxs * floatSize) chptr 0
glBindBufferBase GL_SHADER_STORAGE_BUFFER 7 chbo
return $
cw & numberFloorVerxs .~ nfloorvxs
& numberChasmVerxs .~ nchasmvxs