Draw chasms using vertex pulling
This commit is contained in:
+2
-6
@@ -145,16 +145,12 @@ doDrawing' win pdata u = do
|
||||
glUseProgram fs
|
||||
glDrawArrays GL_TRIANGLES 0 (fromIntegral nIndices)
|
||||
-- draw chasm shader blocking floor
|
||||
glUseProgram (pdata ^. chasmShader . shaderUINT)
|
||||
glBindVertexArray $ pdata ^. chasmShader . shaderVAO . vaoName
|
||||
glUseProgram (pdata ^. chasmShader)
|
||||
glDepthMask GL_FALSE
|
||||
glDrawBuffer GL_NONE
|
||||
glStencilOp GL_KEEP GL_KEEP GL_INCR
|
||||
with 0 $ glClearNamedFramebufferiv (pdata ^. fboBase . _1 . unFBO) GL_STENCIL 0
|
||||
glDrawArrays
|
||||
(_unPrimitiveMode $ pdata ^. chasmShader . shaderPrimitive)
|
||||
0
|
||||
(fromIntegral nchs)
|
||||
glDrawArrays GL_TRIANGLES 0 (fromIntegral nchs)
|
||||
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $
|
||||
glNamedFramebufferDrawBuffers (pdata ^. fboBase . _1 . unFBO) 3
|
||||
glDepthMask GL_TRUE
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user