Prevent cloud "pop" when an overlapping cloud fades out to nothing
This commit is contained in:
@@ -10,7 +10,8 @@ import Geometry
|
||||
testEvent :: World -> World
|
||||
testEvent w = w
|
||||
& cWorld . lWorld . worldEvents .~ SoundStart BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing :
|
||||
[MakeStartCloudAt (V3 (cx + x) (cy + y) 5) | x <- [-5, -4 .. 5], y <- [-5, -4 .. 5]]
|
||||
--[MakeStartCloudAt (V3 (cx + x) (cy + y) 5) | x <- [-5, -4 .. 5], y <- [-5, -4 .. 5]]
|
||||
[MakeStartCloudAt (V3 (cx + x) (cy + y) 5) | x <- [0], y <- [0]]
|
||||
where
|
||||
V2 cx cy = w ^?! cWorld . lWorld . creatures . ix 0 . crPos
|
||||
|
||||
|
||||
+16
-6
@@ -234,7 +234,7 @@ doDrawing' win pdata u = do
|
||||
glDepthFunc GL_ALWAYS
|
||||
glBindTexture GL_TEXTURE_2D (pdata ^. fboBloom . _2 . unTO)
|
||||
glDisable GL_BLEND
|
||||
drawShader (_bloomBlurShader pdata) 4
|
||||
drawFullShader (_bloomBlurShader pdata) 4
|
||||
replicateM_ 9 $ pingPongBetween (_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
|
||||
glEnable GL_BLEND
|
||||
setViewportSize (round winx `div` resFact) (round winy `div` resFact)
|
||||
@@ -264,7 +264,7 @@ doDrawing' win pdata u = do
|
||||
(fromIntegral nCloudIs)
|
||||
GL_UNSIGNED_SHORT
|
||||
nullPtr
|
||||
drawShader (_windowShader pdata) nWins
|
||||
drawFullShader (_windowShader pdata) nWins
|
||||
when (_graphics_cloud_shadows cfig) $ do
|
||||
----render transparency depths
|
||||
glDepthMask GL_TRUE
|
||||
@@ -286,7 +286,8 @@ doDrawing' win pdata u = do
|
||||
-- the idea is to (roughly) get the average position
|
||||
--glBlendFunci 1 GL_ONE_MINUS_DST_ALPHA GL_DST_ALPHA
|
||||
-- or, if we order the clouds, just get the top pos
|
||||
glBlendFunci 1 GL_ONE GL_ZERO
|
||||
--glBlendFunci 1 GL_ONE GL_ZERO
|
||||
glBlendFuncSeparatei 1 GL_SRC_ALPHA GL_ONE GL_ONE GL_ONE
|
||||
-- and to sum the normals (based on the alpha)
|
||||
glBlendFunci 2 GL_SRC_ALPHA GL_ONE
|
||||
-- just get the top normal
|
||||
@@ -298,7 +299,15 @@ doDrawing' win pdata u = do
|
||||
(fromIntegral nCloudIs)
|
||||
GL_UNSIGNED_SHORT
|
||||
nullPtr
|
||||
drawShader (_windowShader pdata) nWins
|
||||
drawFullShader (_windowShader pdata) nWins
|
||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboPos . _1 . unFBO)
|
||||
withArray [0,0,0,0] $ \ptr -> glClearNamedFramebufferfv
|
||||
(pdata ^. fboPos . _1 . unFBO)
|
||||
GL_COLOR
|
||||
0
|
||||
ptr
|
||||
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _2 . unTO)
|
||||
drawShader (pdata ^. alphaDivideShader) 4
|
||||
glEnable GL_BLEND
|
||||
----draw lightmap for cloud buffer
|
||||
glDepthMask GL_FALSE
|
||||
@@ -313,7 +322,8 @@ doDrawing' win pdata u = do
|
||||
nSilIndices
|
||||
nIndices
|
||||
(_graphics_object_shadows $ _uvConfig u)
|
||||
(pdata ^. fboCloud . _2 . _2)
|
||||
--(pdata ^. fboCloud . _2 . _2)
|
||||
(pdata ^. fboPos . _2)
|
||||
(pdata ^. fboCloud . _2 . _3)
|
||||
glInvalidateBufferData (pdata ^. vboShapes . vboName)
|
||||
--apply lightmap to cloud buffer
|
||||
@@ -352,7 +362,7 @@ doDrawing' win pdata u = do
|
||||
bindDrawDist (RadialDistortion (V2 a b) (V2 c d) (V2 e f) g) = do
|
||||
pokeArray (shadVBOptr $ _barrelShader pdata) [a, b, c, d, e, f, g]
|
||||
bufferPokedVBO (snd $ _barrelShader pdata) 1
|
||||
drawShader (fst $ _barrelShader pdata) 1
|
||||
drawFullShader (fst $ _barrelShader pdata) 1
|
||||
fboList =
|
||||
take (length rds - 1) (concat (repeat [fst $ _fbo2 pdata, fst $ _fbo3 pdata]))
|
||||
++ [FBO 0]
|
||||
|
||||
Reference in New Issue
Block a user