Add dependencies, play around with clouds/transparency layer

This commit is contained in:
2021-09-01 03:04:41 +01:00
parent db5c27a3ed
commit 82551328a1
10 changed files with 96 additions and 54 deletions
+18 -23
View File
@@ -57,18 +57,14 @@ doDrawing pdata w = do
$
--youSil w ++
_foregroundEdgeVerx w
-- poke foreground geometry and floor
let addC (V2 xx yy) = V3 xx yy 0
nsurfVs <- pokePoint3s (shadVBOptr $ _lightingSurfaceShader pdata)
$
--youBox w ++
concatMap polyToGeoRender (foregroundPics w)
++ polyToTris (map addC $ screenPolygon w)
-- poke foreground geometry for caps
nCaps <- pokePoint3s (shadVBOptr $ _lightingCapShader pdata)
$ concatMap polyToGeoRender (foregroundPics w)
-- bind wall points, silhouette data, surface geometry
uncurry bindShaderBuffers $ unzip
[ ( _wallTextureShader pdata, nWalls)
, (_lightingLineShadowShader pdata, nSils)
, (_lightingSurfaceShader pdata, nsurfVs)
, (_lightingCapShader pdata, nCaps)
]
-- set the coordinate uniform ready for drawing elements using world coordinates
bufferUBO $ perspectiveMatrixb rot camzoom trans wins viewFroms
@@ -79,15 +75,9 @@ doDrawing pdata w = do
clear [ColorBuffer,DepthBuffer]
depthFunc $= Just Less
-- draw wall occlusions from the camera's point of view
currentProgram $= Just (_shaderProgram $ _lightingSurfaceShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingSurfaceShader pdata)
$= viewFrom3d
currentProgram $= Just (_shaderProgram $ _lightingOccludeShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingOccludeShader pdata)
$= viewFrom3d
currentProgram $= Just (_shaderProgram $ _lightingWallShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingWallShader pdata)
$= viewFrom3d
drawShader (_lightingOccludeShader pdata) nWalls
--draw walls onto base buffer
if w ^. config . wall_textured
@@ -124,23 +114,29 @@ doDrawing pdata w = do
viewport $= (Position 0 0
, divideSize (w ^. config . shadow_resolution) $ Size (round $ fstV2 wins) (round $ sndV2 wins))
--
-- depthMask $= Enabled
-- this is not ideal if the original is not divisible by 2
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSils
createLightMap pdata lightPoints nWalls nSils nCaps
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
bindFramebuffer Framebuffer $= fst (_fboColor pdata)
clearColor $= Color4 0 0 0 0
clear [ColorBuffer]
depthFunc $= Just Lequal
depthMask $= Disabled
blendFuncSeparate $= ((SrcAlpha,OneMinusSrcAlpha),(SrcAlpha,One))
--blendFuncSeparate $= ((OneMinusDstAlpha,OneMinusSrcAlpha),(One,OneMinusSrcAlpha))
--blendFunc $= (One,OneMinusSrcAlpha)
--blendFunc $= (SrcAlpha,One)
--blendFunc $= (SrcAlphaSaturate,One)
--blendFunc $= (SrcAlphaSaturate,OneMinusSrcAlpha)
blendColor $= Color4 1 1 1 0.80
blendFuncSeparate $= ((SrcAlphaSaturate,One),(ConstantAlpha,ConstantAlpha))
--blendFunc $= (SrcAlphaSaturate,SrcAlphaSaturate)
clearColor $= Color4 0.5 0.5 0.5 0
clear [ColorBuffer]
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
blendFuncSeparate $= ((SrcAlpha,OneMinusSrcAlpha),(One,OneMinusSrcAlpha))
--blendFuncSeparate $= ((SrcAlphaSaturate,OneMinusSrcAlpha),(One,OneMinusSrcAlpha))
renderLayer 2 shadV layerCounts
renderWindows pdata windowPoints
clearColor $= Color4 0 0 0 0
depthMask $= Enabled
depthMask $= Disabled
@@ -179,7 +175,6 @@ doDrawing pdata w = do
textureBinding Texture2D $= Just (snd $ _fboColor pdata)
drawShader (_fullscreenShader pdata) 4
--renderLayer 2 shadV layerCounts
renderWindows pdata windowPoints
depthFunc $= Just Lequal
viewport $= (Position 0 0, Size (round $ fstV2 wins) (round $ sndV2 wins))
+1 -1
View File
@@ -281,7 +281,7 @@ makeGasCloud pos vel w = w
theCloud = Cloud
{ _clPos = pos
, _clVel = vel
, _clPict = \_ -> setLayer 2 . setDepth 30 $ color (withAlpha 0.1 col)
, _clPict = \_ -> setLayer 2 . setDepth 30 $ color (withAlpha 0.05 col)
$ circleSolid 20
, _clRad = 10
, _clTimer = 400