Further cleanup

This commit is contained in:
2021-09-01 19:35:25 +01:00
parent ce4c3bd231
commit d0aeeed5c3
4 changed files with 24 additions and 42 deletions
+5 -6
View File
@@ -47,21 +47,20 @@ createLightMap pdata lightPoints nWalls nSils nCaps toPos = do
clearColor $= Color4 1 1 1 1
clear [ColorBuffer]
-- for each of the lights:
-- stencil out the walls from this light's point of view
-- draw fading lightmap circles on the floor
-- draw fading lightmaps on the walls
-- 1. stencil out the walls from this light's point of view
-- 2. calculate lighting based on each fragment's position
blendFunc $= (Zero, OneMinusSrcColor)
stencilTest $= Enabled
flip VS.mapM_ (VS.fromList lightPoints) $ \(V3 x y z,rad,V3 r g b) -> do
depthFunc $= Just Less
-- stencil out shadows
-- setup stencil
colorMask $= Color4 Disabled Disabled Disabled Disabled
clear [StencilBuffer]
cullFace $= Nothing
stencilOpSeparate Front $= (OpKeep,OpKeep,OpIncrWrap)
stencilOpSeparate Back $= (OpKeep,OpKeep,OpDecrWrap)
stencilFunc $= (Always, 0, 255)
--draw wall whadows
--draw wall shadows
currentProgram $= Just (_shaderProgram $ _lightingOccludeShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingOccludeShader pdata)
$= Vector3 x y z
@@ -79,7 +78,7 @@ createLightMap pdata lightPoints nWalls nSils nCaps toPos = do
drawShader (_lightingCapShader pdata) nCaps
--draw lightmap itself
depthFunc $= Just Always
cullFace $= Nothing
--cullFace $= Nothing
bindTO toPos
colorMask $= Color4 Enabled Enabled Enabled Enabled
stencilOp $= (OpKeep,OpKeep,OpKeep)