Add toggle for shadows on clouds

This commit is contained in:
2021-09-03 23:47:22 +01:00
parent fd85093833
commit 1ab3f1773c
6 changed files with 38 additions and 43 deletions
+23 -30
View File
@@ -56,10 +56,8 @@ doDrawing pdata w = do
-- poke wall points and colors
nWalls <- poke224s (shadVBOptr $ _wallTextureShader pdata) wallPointsCol
nSils <- pokePoint3s (shadVBOptr $ _lightingLineShadowShader pdata)
$
--youSil w ++
creatureSilhouettes w ++
_foregroundEdgeVerx w
$ creatureSilhouettes w
++ _foregroundEdgeVerx w
-- poke foreground geometry for caps
nCaps <- pokePoint3s (shadVBOptr $ _lightingCapShader pdata)
$ concatMap polyToGeoRender (foregroundPics w)
@@ -132,30 +130,29 @@ doDrawing pdata w = do
depthMask $= Disabled
clearColor $= Color4 0.5 0.5 0.5 0
--blendFunc $= (SrcAlphaSaturate,One)
blendFuncSeparate $= ((SrcAlpha,OneMinusSrcAlpha),(One,OneMinusSrcAlpha))
--blendColor $= Color4 0.5 0.5 0.5 0.5
blendFuncSeparate $= ((SrcAlphaSaturate,One) , (One,OneMinusSrcAlpha))
--blendFuncSeparate $= ((SrcAlpha,OneMinusSrcAlpha),(One,OneMinusSrcAlpha))
drawBuffers $= [FBOColorAttachment 0,NoBuffers]
clear [ColorBuffer]
renderLayer 2 shadV layerCounts
renderWindows pdata windowPoints
----render transparency depths
depthMask $= Enabled
blend $= Disabled
drawBuffers $= [NoBuffers,FBOColorAttachment 1]
renderLayer 2 shadV layerCounts
renderWindows pdata windowPoints
-- --downscale transparency depths
-- bindFramebuffer Framebuffer $= fst (_fboHalf3 pdata)
-- bindTO (snd $ snd $ _fboCloud pdata)
-- depthFunc $= Just Always
-- drawShader (_fullscreenShader pdata) 4
----draw lightmap for cloud buffer
depthMask $= Disabled
blend $= Enabled
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSils nCaps (snd $ snd $ _fboCloud pdata)
-- createLightMap pdata lightPoints nWalls nSils nCaps (snd $ _fboHalf3 pdata)
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
if (_cloud_shadows $ _config w)
then do
----render transparency depths
depthMask $= Enabled
blend $= Disabled
drawBuffers $= [NoBuffers,FBOColorAttachment 1]
renderLayer 2 shadV layerCounts
renderWindows pdata windowPoints
----draw lightmap for cloud buffer
depthMask $= Disabled
blend $= Enabled
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSils nCaps (snd $ snd $ _fboCloud pdata)
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
else return ()
--apply lightmap to cloud buffer
clearColor $= Color4 0 0 0 0
bindFramebuffer Framebuffer $= fst (_fboCloud pdata)
@@ -192,12 +189,11 @@ doDrawing pdata w = do
rds -> do
let bindDrawDist :: (Point2,Point2,Point2,Float) -> IO ()
bindDrawDist ( V2 a b , V2 c d , V2 e f , g) = do
pokeArray (shadVBOptr $ _barrelShader pdata)
[a,b,c,d,e,f,g]
pokeArray (shadVBOptr $ _barrelShader pdata) [a,b,c,d,e,f,g]
bindShaderBuffers [_barrelShader pdata] [1]
drawShader (_barrelShader pdata) 1
fboList = take (length rds - 1) (concat (repeat [fst $ _fbo2 pdata,fst $ _fbo3 pdata]))
++ [defaultFramebufferObject]
++ [defaultFramebufferObject]
toList = fst (snd (_fboBase pdata)) : concat (repeat [snd $ _fbo2 pdata,snd $ _fbo3 pdata])
bindings = zipWith (>>) (map bindFBO fboList) (map bindTO toList)
activeTexture $= TextureUnit 1
@@ -209,13 +205,10 @@ doDrawing pdata w = do
depthMask $= Disabled
blend $= Enabled
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
renderFoldable shadV $ fixedCoordPictures w
depthMask $= Enabled
eTicks <- SDL.ticks
return (eTicks - sTicks)
--------------------------------------------------------------------------------
-- note: currently assume there is only one UBO, we only bind it once at setup
bufferUBO :: [Float] -> IO ()