Set windows to blend, fix depth of walls again
This commit is contained in:
+24
-8
@@ -48,23 +48,25 @@ renderPicture' pdata rot zoom trans@(tranx,trany) wins@(winx,winy) wallPointsCol
|
||||
) :: IO (GLmatrix GLfloat)
|
||||
|
||||
createLightMap pdata rot zoom trans wins wallPoints lightPoints viewFroms pmat
|
||||
|
||||
ticksAfterLighting <- SDL.ticks
|
||||
|
||||
renderBackground pdata rot zoom trans wins
|
||||
|
||||
renderWalls pdata wallPointsCol pmat
|
||||
|
||||
setWallDepth pdata wallPoints (viewFromx,viewFromy) pmat
|
||||
|
||||
depthFunc $= Just Lequal
|
||||
|
||||
renderFoldable pdata $ picToLTree (Just 0) pic
|
||||
|
||||
|
||||
-- reset blend so that light map doesn't apply
|
||||
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
|
||||
renderFoldable pdata $ picToLTree (Just 1) pic
|
||||
|
||||
-- set drawing for on top
|
||||
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
|
||||
-- blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
|
||||
|
||||
renderFoldable pdata $ picToLTree (Just 2) pic
|
||||
|
||||
@@ -83,6 +85,26 @@ renderWalls pdata wps pmat = do
|
||||
$= pmat
|
||||
drawShader (_wallFaceShader pdata) n
|
||||
|
||||
setWallDepth :: RenderData -> [(Point2,Point2)] -> (Float,Float) -> GLmatrix GLfloat -> IO Word32
|
||||
setWallDepth pdata wallPoints (viewFromx,viewFromy) pmat = do
|
||||
startTicks <- SDL.ticks
|
||||
colorMask $= (Color4 Disabled Disabled Disabled Disabled)
|
||||
nWalls <- F.foldM (pokeShader $ _wallShadowShader pdata) wallPoints
|
||||
bindShaderBuffers [_wallShadowShader pdata] [nWalls]
|
||||
|
||||
currentProgram $= Just (_shaderProgram $ _wallShadowShader pdata)
|
||||
uniform (head $ fromJust $ _shaderCustomUnis $ _wallShadowShader pdata)
|
||||
$= Vector2 viewFromx viewFromy
|
||||
uniform ( (fromJust $ _shaderCustomUnis $ _wallShadowShader pdata) !! 1)
|
||||
$= pmat
|
||||
uniform ( (fromJust $ _shaderCustomUnis $ _wallShadowShader pdata) !! 2)
|
||||
$= (0 :: Float)
|
||||
-- cullFace $= Just Front
|
||||
drawShader (_wallShadowShader pdata) nWalls
|
||||
colorMask $= (Color4 Enabled Enabled Enabled Enabled)
|
||||
endTicks <- SDL.ticks
|
||||
return $ endTicks - startTicks
|
||||
|
||||
createLightMap :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
|
||||
[(Point2,Point2)] -> [Point4] ->
|
||||
(Float,Float) -> GLmatrix GLfloat -> IO ()
|
||||
@@ -116,7 +138,6 @@ createLightMap pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints
|
||||
cullFace $= Just Back
|
||||
drawShader (_wallShadowShader pdata) nWalls
|
||||
|
||||
|
||||
depthMask $= Disabled
|
||||
blendFunc $= (Zero, OneMinusSrcAlpha)
|
||||
-- blendFuncSeparate $= ((Zero,Zero),(Zero, OneMinusSrcAlpha))
|
||||
@@ -163,11 +184,6 @@ createLightMap pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints
|
||||
cullFace $= Nothing
|
||||
stencilTest $= Disabled
|
||||
|
||||
startWallTicks <- SDL.ticks
|
||||
wallPokeEnd <- SDL.ticks
|
||||
ticksS <- SDL.ticks
|
||||
ticksAfterL <- SDL.ticks
|
||||
|
||||
blend $= Disabled
|
||||
|
||||
-- blendFunc $= (Zero,One)
|
||||
|
||||
Reference in New Issue
Block a user