Cleanup
This commit is contained in:
+11
-19
@@ -92,7 +92,7 @@ doDrawing' win pdata u = do
|
||||
nCloudVs'
|
||||
(V.fromList $ w ^. cWorld . lWorld . dusts)
|
||||
-- bind wall points, silhouette data, surface geometry
|
||||
bufferShaderLayers shadV pokeCounts
|
||||
bufferShaderLayers pokeCounts shadV
|
||||
bufferPokedVBO (_vboShapes pdata) nShapeVs
|
||||
bufferPokedVBO (pdata ^. winVBO) nWins
|
||||
bufferPokedVBO (pdata ^. wallVBO) trueNWalls
|
||||
@@ -108,12 +108,7 @@ doDrawing' win pdata u = do
|
||||
glDepthFunc GL_LESS
|
||||
-- clear depth and stencil buffers
|
||||
glStencilMask 255 -- to alter the entire stencil
|
||||
glClearNamedFramebufferfi
|
||||
(pdata ^. fboBase . _1 . unFBO)
|
||||
GL_DEPTH_STENCIL
|
||||
0
|
||||
1
|
||||
0
|
||||
glClearNamedFramebufferfi (pdata ^. fboBase . _1 . unFBO) GL_DEPTH_STENCIL 0 1 0
|
||||
-- draw wall occlusions from the camera's point of view
|
||||
glStencilFunc GL_NOTEQUAL 128 255
|
||||
glStencilOp GL_KEEP GL_KEEP GL_REPLACE
|
||||
@@ -131,8 +126,7 @@ doDrawing' win pdata u = do
|
||||
glClearNamedFramebufferfv (pdata ^. fboBase . _1 . unFBO) GL_COLOR 0
|
||||
withArray [0, 0, 0, 0] $
|
||||
glClearNamedFramebufferfv (pdata ^. fboBase . _1 . unFBO) GL_COLOR 2
|
||||
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $
|
||||
glNamedFramebufferDrawBuffers (pdata ^. fboBase . _1 . unFBO) 3
|
||||
-- glNamedFramebufferDrawBuffers set in preloadRender
|
||||
--draw walls onto base buffer
|
||||
glEnable GL_CULL_FACE
|
||||
glUseProgram (pdata ^. pullWallShader)
|
||||
@@ -144,19 +138,15 @@ doDrawing' win pdata u = do
|
||||
-- draw chasm shader blocking floor
|
||||
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
|
||||
-- probably don't want to set the drawbuffer to GL_NONE, but not sure
|
||||
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
|
||||
glDisable GL_CULL_FACE
|
||||
--draw floor onto base buffer
|
||||
glUseProgram (pdata ^. floorShader)
|
||||
glStencilFunc GL_EQUAL 0 255
|
||||
glDrawArrays GL_TRIANGLES 0 (fromIntegral nFls)
|
||||
--glDisable GL_STENCIL_TEST
|
||||
glEnable GL_BLEND
|
||||
--draw lightmap into its own buffer
|
||||
createLightMap
|
||||
@@ -171,9 +161,11 @@ doDrawing' win pdata u = do
|
||||
(pdata ^. fboBase . _2 . _3)
|
||||
lightPoints
|
||||
pdata
|
||||
-- no longer need base positions/normals
|
||||
withArray [GL_COLOR_ATTACHMENT1,GL_COLOR_ATTACHMENT2] $
|
||||
glInvalidateNamedFramebufferData (pdata ^. fboBase . _1 . unFBO) 2
|
||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
||||
--apply lightmap to base buffer
|
||||
glDisable GL_CULL_FACE
|
||||
glDepthFunc GL_ALWAYS
|
||||
glDepthMask GL_FALSE
|
||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBase . _1 . unFBO)
|
||||
@@ -299,8 +291,7 @@ doDrawing' win pdata u = do
|
||||
--draw windows into window textures
|
||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboWindow . _1 . unFBO)
|
||||
glBindTextureUnit 3 (pdata ^. fboPos . _2 . unTO)
|
||||
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1] $
|
||||
glNamedFramebufferDrawBuffers (pdata ^. fboWindow . _1 . unFBO) 2
|
||||
-- glNamedFramebufferDrawBuffers should be set in preloadRender
|
||||
withArray [0, 0, 0, 0] $
|
||||
glClearNamedFramebufferfv (pdata ^. fboWindow . _1 . unFBO) GL_COLOR 0
|
||||
withArray [0, 0, 0, 0] $
|
||||
@@ -315,10 +306,11 @@ doDrawing' win pdata u = do
|
||||
-- with all source alphas 0.25, alpha -> 0.5
|
||||
glBlendFunc GL_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||
glUseProgram $ pdata ^. windowPullShader
|
||||
glBindVertexArray $ pdata ^. dummyVAO
|
||||
-- don't need cloud postions/normals any more
|
||||
withArray [GL_COLOR_ATTACHMENT0] $
|
||||
glInvalidateNamedFramebufferData (pdata ^. fboPos . _1 . unFBO) 1
|
||||
glDrawArrays GL_TRIANGLES 0 (fromIntegral nWins * 12)
|
||||
glDisable GL_DEPTH_CLAMP
|
||||
glDisable GL_CULL_FACE
|
||||
glInvalidateBufferData (pdata ^. vboShapes . vboName)
|
||||
--apply lightmap to cloud buffer
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
||||
|
||||
Reference in New Issue
Block a user