Hack interaction between clouds and bloom

This commit is contained in:
2025-06-25 12:01:46 +01:00
parent 04e046ea82
commit b285e44dee
2 changed files with 27 additions and 6 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ chemFuelPouch =
defaultHeldItem & itType .~ AMMOMAG CHEMFUELPOUCH
& itUse .~ UseNothing
& itConsumables
?~ 1000
?~ 100000
bulletSynthesizer :: Item
bulletSynthesizer = makeAttach BULLETSYNTH & itUse .~ UseAttach (APInt 0)
+26 -5
View File
@@ -222,6 +222,20 @@ doDrawing' win pdata u = do
renderLayer BloomNoZWrite shadV pokeCounts
glDepthMask GL_TRUE
renderLayer BloomLayer shadV pokeCounts
-- draw clouds for transparency to block off some alpha
glDepthMask GL_FALSE
glBlendColor 0 0 0 0.2 -- using this and GL_CONSTANT_ALPHA below
-- can allow for some underlighting of the clouds
glBlendFuncSeparate GL_ZERO GL_ONE GL_CONSTANT_ALPHA GL_ONE_MINUS_SRC_ALPHA
glUseProgram (pdata ^. cloudShader . shaderUINT)
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
glDrawElements
(pdata ^. cloudShader . shaderPrimitive . unPrimitiveMode)
(fromIntegral nCloudIs)
GL_UNSIGNED_SHORT
nullPtr
glDepthMask GL_TRUE
--setup downscale viewport for blurring bloom
--setViewportSize (round winx `div` (2 * resFact)) (round winy `div` (2 * resFact))
setViewport _graphics_downsize_resolution cfig
@@ -267,7 +281,8 @@ doDrawing' win pdata u = do
glDepthMask GL_TRUE
glDepthFunc GL_ALWAYS
glDisable GL_BLEND
withArray [GL_NONE, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $ \ptr -> glDrawBuffers 3 ptr
withArray [GL_NONE, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2]
$ \ptr -> glDrawBuffers 3 ptr
withArray [0, 0, 0, 0] $ \ptr ->
glClearNamedFramebufferfv
(pdata ^. fboCloud . _1 . unFBO)
@@ -305,6 +320,7 @@ doDrawing' win pdata u = do
glDepthMask GL_FALSE
drawShader (pdata ^. alphaDivideShader) 4
----draw lightmap for cloud buffer
glDepthMask GL_TRUE
glDepthFunc GL_LESS
glEnable GL_BLEND
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
@@ -328,17 +344,22 @@ doDrawing' win pdata u = do
glBlendFuncSeparate GL_ZERO GL_ONE_MINUS_SRC_COLOR GL_ZERO GL_ONE
drawShader (_fullscreenShader pdata) 4
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
-- bind base buffer for drawing bloom then clouds
-- bind base buffer for drawing clouds and bloom
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboBase pdata)))
--draw shadowed clouds onto base buffer
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _1 . unTO)
drawShader (_fullscreenShader pdata) 4
--Draw blurred bloom onto base buffer
glEnable GL_BLEND
glBlendFunc GL_SRC_ALPHA GL_ONE
glBindTextureUnit 0 (_unTO . snd $ _fboHalf1 pdata)
drawShader (_fullscreenShader pdata) 4
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
--draw shadowed clouds onto base buffer
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _1 . unTO)
drawShader (_fullscreenShader pdata) 4
--set viewport for radial distortion
--setViewportSize (round winx) (round winy)
setViewport (const FullRes) cfig