Add alternate shadow volume rendering pathway (layered geo)

This commit is contained in:
2023-03-12 09:29:36 +00:00
parent 184df01ff8
commit b88a8d5776
7 changed files with 52 additions and 53 deletions
+16 -19
View File
@@ -199,36 +199,33 @@ instanceLightMap cfig pdata lightPoints nWalls nSils nCaps toPos = do
--draw wall shadows
glUseProgram (_shadProg' lwallShad)
glBindVertexArray $ lwallShad ^. shadVAO' . vaoName -- Just (_vao $ _shadVAO lwallShad)
-- glDrawArrays
-- (marshalEPrimitiveMode $ _shadPrim' lwallShad)
-- 0
-- (fromIntegral nWalls)
glDrawArrays
(marshalEPrimitiveMode $ _shadPrim' lwallShad)
0
(fromIntegral nWalls)
--draw silhouette shadows
glUseProgram (_shadProg' llinesShad)
glBindVertexArray (_vaoName $ _shadVAO' llinesShad)
-- glDrawElements
-- (marshalEPrimitiveMode $ _shadPrim' llinesShad)
-- (fromIntegral nSils)
-- GL_UNSIGNED_SHORT
-- nullPtr
glDrawElements
(marshalEPrimitiveMode $ _shadPrim' llinesShad)
(fromIntegral nSils)
GL_UNSIGNED_SHORT
nullPtr
--draw caps on the near plane as required
glEnable GL_CULL_FACE
glCullFace GL_BACK
glUseProgram (_shadProg' lcapShad)
glBindVertexArray $ lcapShad ^. shadVAO' . vaoName --Just (_vao $ _shadVAO lcapShad)
-- glDrawElements
-- (marshalEPrimitiveMode $ _shadPrim' lcapShad)
-- (fromIntegral nCaps)
-- GL_UNSIGNED_SHORT
-- nullPtr
-- --draw lightmap itself
glDrawElements
(marshalEPrimitiveMode $ _shadPrim' lcapShad)
(fromIntegral nCaps)
GL_UNSIGNED_SHORT
nullPtr
--draw lightmap itself
glEnable GL_DEPTH_TEST
glDepthFunc GL_ALWAYS
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
glStencilFunc GL_EQUAL 0 255
-- delete vvvv
glDisable GL_STENCIL_TEST
-- delete ^^^^
glUseProgram (pdata ^. shadowLightShader . shadProg')
-- bind world position texture
bindTO toPos
@@ -237,7 +234,7 @@ instanceLightMap cfig pdata lightPoints nWalls nSils nCaps toPos = do
glDrawArrays
(marshalEPrimitiveMode $ pdata ^. shadowLightShader . shadPrim')
0
(fromIntegral (4 :: Int))
1
-- this was the end of the loop
glDisable GL_CULL_FACE