Commit before attempting to implement immutable buffer storage (openGL)
This commit is contained in:
+7
-5
@@ -150,7 +150,7 @@ renderShadows ::
|
||||
RenderData ->
|
||||
IO ()
|
||||
renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture lightPoints pdata = do
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
|
||||
glBindFramebuffer GL_FRAMEBUFFER $ pdata ^. fboLighting . _1 . unFBO --(_unFBO (fst (_fboLighting pdata)))
|
||||
let llinesShad = _lightingLineShadowShader pdata
|
||||
lcapShad = _lightingCapShader pdata
|
||||
lwallShad = _lightingWallShadShader pdata
|
||||
@@ -166,9 +166,7 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
||||
GL_COLOR
|
||||
0
|
||||
ptr
|
||||
-- for each of the lights:
|
||||
-- 1. stencil out the shadows from this light's point of view
|
||||
-- 2. calculate lighting based on each fragment's position and normal
|
||||
-- setup stencil and blending
|
||||
glBlendFunc GL_ZERO GL_ONE_MINUS_SRC_COLOR
|
||||
glEnable GL_STENCIL_TEST
|
||||
glStencilOpSeparate GL_FRONT GL_KEEP GL_KEEP GL_INCR_WRAP
|
||||
@@ -176,6 +174,9 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
||||
-- bind world position texture-- these will be used by the lighting shader
|
||||
glBindTextureUnit 0 (positiontexture ^. unTO)
|
||||
glBindTextureUnit 1 (normaltexture ^. unTO)
|
||||
-- for each of the lights:
|
||||
-- 1. stencil out the shadows from this light's point of view
|
||||
-- 2. calculate lighting based on each fragment's position and normal
|
||||
flip VFSM.mapM_ (VFSM.fromList lightPoints) $ \(V3 x y z, rad, V3 r g b) -> do
|
||||
glDepthFunc GL_LESS
|
||||
-- setup stencil
|
||||
@@ -226,7 +227,7 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
||||
--draw lightmap itself
|
||||
glDepthFunc GL_ALWAYS
|
||||
glDisable GL_CULL_FACE
|
||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_FALSE
|
||||
glStencilFunc GL_EQUAL 0 255
|
||||
glUseProgram (ltextShad ^. shaderUINT) --Just (_shadProg ltextShad)
|
||||
glUniform3f 0 x y z
|
||||
@@ -238,6 +239,7 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
||||
(fromIntegral (4 :: Int))
|
||||
--cleanup: may not be necessary, depending on what comes after...
|
||||
glDisable GL_STENCIL_TEST
|
||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
||||
|
||||
lightsToArray :: [(Point3, Float, Point3)] -> [Float]
|
||||
lightsToArray xs =
|
||||
|
||||
Reference in New Issue
Block a user