Unify shadow stencil tests, inverts shadow when light source occluded
This commit is contained in:
+4
-13
@@ -62,8 +62,9 @@ createLightMap pdata lightPoints nWalls nSils nsurfVs = do
|
||||
-- stencil out shadows
|
||||
colorMask $= Color4 Disabled Disabled Disabled Disabled
|
||||
clear [StencilBuffer]
|
||||
cullFace $= Just Back
|
||||
stencilOp $= (OpKeep,OpKeep,OpIncr)
|
||||
cullFace $= Nothing
|
||||
stencilOpSeparate Front $= (OpKeep,OpKeep,OpIncrWrap)
|
||||
stencilOpSeparate Back $= (OpKeep,OpKeep,OpDecrWrap)
|
||||
stencilFunc $= (Always, 0, 255)
|
||||
currentProgram $= Just (_shaderProgram $ _lightingOccludeShader pdata)
|
||||
uniform (head $ _shaderCustomUnis $ _lightingOccludeShader pdata)
|
||||
@@ -78,21 +79,11 @@ createLightMap pdata lightPoints nWalls nSils nsurfVs = do
|
||||
drawShader (_lightingLineShadowShader pdata) nSils
|
||||
depthClamp $= Disabled
|
||||
|
||||
cullFace $= Just Front
|
||||
stencilOp $= (OpKeep,OpKeep,OpDecr)
|
||||
currentProgram $= Just (_shaderProgram $ _lightingOccludeShader pdata)
|
||||
drawShader (_lightingOccludeShader pdata) nWalls
|
||||
|
||||
--stencilOp $= (OpKeep,OpIncr,OpKeep)
|
||||
currentProgram $= Just (_shaderProgram $ _lightingLineShadowShader pdata)
|
||||
depthClamp $= Enabled
|
||||
drawShader (_lightingLineShadowShader pdata) nSils
|
||||
depthClamp $= Disabled
|
||||
|
||||
-- draw geometry surfaces
|
||||
cullFace $= Just Back
|
||||
--colorMask $= Color4 Disabled Disabled Disabled Enabled
|
||||
colorMask $= Color4 Enabled Enabled Enabled Enabled
|
||||
stencilOp $= (OpKeep,OpKeep,OpKeep)
|
||||
stencilFunc $= (Equal, 0, 255)
|
||||
currentProgram $= Just (_shaderProgram $ _lightingSurfaceShader pdata)
|
||||
uniform (head $ _shaderCustomUnis $ _lightingSurfaceShader pdata)
|
||||
|
||||
Reference in New Issue
Block a user