Cleanup shaders
This commit is contained in:
+8
-12
@@ -70,6 +70,7 @@ renderLightingNoShadows positiontexture normaltexture lightPoints pdata = do
|
||||
glStencilOpSeparate GL_FRONT GL_KEEP GL_KEEP GL_INCR_WRAP
|
||||
glStencilOpSeparate GL_BACK GL_KEEP GL_KEEP GL_DECR_WRAP
|
||||
flip VFSM.mapM_ (VFSM.fromList lightPoints) $ \(V3 x y z, rad, V3 r g b) -> do
|
||||
withArray [x,y,z,1,r,g,b,rad] $ glNamedBufferSubData (pdata ^. lightUBO) 0 32
|
||||
glDepthFunc GL_LESS
|
||||
-- setup stencil
|
||||
glColorMask GL_FALSE GL_FALSE GL_FALSE GL_FALSE
|
||||
@@ -88,14 +89,8 @@ renderLightingNoShadows positiontexture normaltexture lightPoints pdata = do
|
||||
glBindTextureUnit 1 (normaltexture ^. unTO)
|
||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
||||
glStencilFunc GL_EQUAL 0 255
|
||||
glUseProgram (ltextShad ^. shaderUINT)
|
||||
glUniform3f 0 x y z
|
||||
glUniform4f 1 r g b rad
|
||||
glBindVertexArray $ ltextShad ^. shaderVAO . vaoName
|
||||
glDrawArrays
|
||||
(_unPrimitiveMode (_shaderPrimitive ltextShad))
|
||||
0
|
||||
(fromIntegral (4 :: Int))
|
||||
glUseProgram ltextShad
|
||||
glDrawArrays GL_TRIANGLES 0 6
|
||||
--cleanup: may not be necessary, depending on what comes after...
|
||||
glDisable GL_CULL_FACE
|
||||
glStencilFunc GL_NOTEQUAL 128 255
|
||||
@@ -200,7 +195,7 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
||||
glDisable GL_CULL_FACE
|
||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_FALSE
|
||||
glStencilFunc GL_EQUAL 0 255
|
||||
glUseProgram (ltextShad ^. shaderUINT)
|
||||
glUseProgram ltextShad
|
||||
glDrawArrays GL_TRIANGLES 0 6
|
||||
--cleanup: may not be necessary, depending on what comes after...
|
||||
-- glDisable GL_STENCIL_TEST
|
||||
@@ -213,15 +208,16 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
||||
pingPongBetween ::
|
||||
(FBO, TO) ->
|
||||
(FBO, TO) ->
|
||||
Shader ->
|
||||
GLuint ->
|
||||
IO ()
|
||||
pingPongBetween (fb1, to1) (fb2, to2) fs = do
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO fb2)
|
||||
glBindTextureUnit 0 (_unTO to1)
|
||||
drawShader fs 4
|
||||
glUseProgram fs
|
||||
glDrawArrays GL_TRIANGLES 0 6
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO fb1)
|
||||
glBindTextureUnit 0 (_unTO to2)
|
||||
drawShader fs 4
|
||||
glDrawArrays GL_TRIANGLES 0 6
|
||||
|
||||
renderLayer ::
|
||||
Layer ->
|
||||
|
||||
Reference in New Issue
Block a user