To openglraw

This commit is contained in:
2023-03-09 21:08:37 +00:00
parent 2388715d52
commit 46158bca15
+31 -30
View File
@@ -100,8 +100,8 @@ doDrawing win pdata u = do
--bindFramebuffer Framebuffer $= fst (_fboBase pdata)
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboBase pdata)))
glClearColor 0 0 0 0
clear [ColorBuffer, DepthBuffer]
depthFunc $= Just Less
glClear $ sum [GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT]
glDepthFunc GL_LESS
-- draw wall occlusions from the camera's point of view
-- currentProgram $= lwShad ^? shadProg -- Just (_shadProg lwShad)
-- uniform (_shadUnis lwShad V.! 0) $= viewFrom3d
@@ -155,57 +155,58 @@ doDrawing win pdata u = do
--textureBinding Texture2D $= Just (snd $ _fboLighting pdata)
--textureBinding Texture2D $= pdata ^? fboLighting . _2 -- Just (snd $ _fboLighting pdata)
glBindTexture GL_TEXTURE_2D (pdata ^. fboLighting . _2 . unTO) -- Just (snd $ _fboLighting pdata)
blend $= Enabled
glEnable GL_BLEND
blendFunc $= (Zero, OneMinusSrcColor)
drawShader (_fullscreenShader pdata) 4
--draw bloom onto bloom buffer
--bindFramebuffer Framebuffer $= pdata ^. fboBloom . _1 --fst (_fboBloom pdata)
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBloom . _1 . unFBO)
clear [ColorBuffer]
depthFunc $= Just Less
glClear GL_COLOR_BUFFER_BIT
glDepthFunc GL_LESS
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
depthMask $= Disabled
glDepthMask GL_FALSE
renderLayer BloomNoZWrite shadV layerCounts
depthMask $= Enabled
glDepthMask GL_TRUE
renderLayer BloomLayer shadV layerCounts
--depthMask $= Enabled
--glDepthMask GL_TRUE
--setup downscale viewport for blurring bloom
setViewportSize (round winx `div` (2 * resFact)) (round winy `div` (2 * resFact))
--bindFramebuffer Framebuffer $= fst (_fboHalf1 pdata)
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboHalf1 pdata)))
depthFunc $= Just Always
glDepthFunc GL_ALWAYS
--textureBinding Texture2D $= pdata ^? fboBloom . _2 -- Just (snd $ _fboBloom pdata)
glBindTexture GL_TEXTURE_2D (pdata ^. fboBloom . _2 . unTO) -- Just (snd $ _fboBloom pdata)
blend $= Disabled
glDisable GL_BLEND
drawShader (_bloomBlurShader pdata) 4
replicateM_ 9 $ pingPongBetween (_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
blend $= Enabled
glEnable GL_BLEND
setViewportSize (round winx `div` resFact) (round winy `div` resFact)
--draw clouds onto cloud buffer
--bindFramebuffer Framebuffer $= fst (_fboCloud pdata)
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
depthFunc $= Just Lequal
depthMask $= Disabled
glDepthFunc GL_LEQUAL
glDepthMask GL_FALSE
glClearColor 0.5 0.5 0.5 0
--blendFunc $= (SrcAlphaSaturate,One)
--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]
glClear GL_COLOR_BUFFER_BIT
renderLayer MidLayer shadV layerCounts
--renderWindows pdata windowPoints
drawShader (_windowShader pdata) nWins
when (_graphics_cloud_shadows cfig) $ do
----render transparency depths
depthMask $= Enabled
blend $= Disabled
drawBuffers $= [NoBuffers, FBOColorAttachment 1]
glDepthMask GL_TRUE
glDisable GL_BLEND
withArray [GL_NONE, GL_COLOR_ATTACHMENT1] $ \ptr -> glDrawBuffers 2 ptr
--drawBuffers $= [NoBuffers, FBOColorAttachment 1]
renderLayer MidLayer shadV layerCounts
drawShader (_windowShader pdata) nWins
----draw lightmap for cloud buffer
depthMask $= Disabled
blend $= Enabled
glDepthMask GL_FALSE
glEnable GL_BLEND
--bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
createLightMap
@@ -223,12 +224,12 @@ doDrawing win pdata u = do
glClearColor 0 0 0 0
--bindFramebuffer Framebuffer $= fst (_fboCloud pdata)
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
depthMask $= Disabled
glDepthMask GL_FALSE
drawBuffers $= [FBOColorAttachment 0, NoBuffers]
depthFunc $= Just Always
glDepthFunc GL_ALWAYS
--textureBinding Texture2D $= Just (snd $ _fboLighting pdata)
glBindTexture GL_TEXTURE_2D (_unTO . snd $ _fboLighting pdata)
blend $= Enabled
glEnable GL_BLEND
--blendFunc $= (Zero, OneMinusSrcAlpha)
blendFuncSeparate $= ((Zero, OneMinusSrcColor), (Zero, One))
drawShader (_fullscreenShader pdata) 4
@@ -237,7 +238,7 @@ doDrawing win pdata u = do
--bindFramebuffer Framebuffer $= fst (_fboBase pdata)
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboBase pdata)))
--Draw blurred bloom onto base buffer
blend $= Enabled
glEnable GL_BLEND
blendFunc $= (SrcAlpha, One)
--textureBinding Texture2D $= Just (snd $ _fboHalf1 pdata)
glBindTexture GL_TEXTURE_2D (_unTO . snd $ _fboHalf1 pdata)
@@ -249,7 +250,7 @@ doDrawing win pdata u = do
drawShader (_fullscreenShader pdata) 4
--set viewport for radial distortion
setViewportSize (round winx) (round winy)
depthFunc $= Just Always
glDepthFunc GL_ALWAYS
blendFunc $= (One, Zero)
-- perform any radial distortion
case w ^. cWorld . lWorld . distortions of
@@ -273,19 +274,19 @@ doDrawing win pdata u = do
activeTexture $= TextureUnit 1
zipWithM_ (>>) bindings $ map bindDrawDist rds
activeTexture $= TextureUnit 0
depthFunc $= Just Always
blend $= Enabled
glDepthFunc GL_ALWAYS
glEnable GL_BLEND
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
renderLayer DebugLayer shadV layerCounts
-- draw overlay
depthFunc $= Just Always
depthMask $= Disabled
blend $= Enabled
glDepthFunc GL_ALWAYS
glDepthMask GL_FALSE
glEnable GL_BLEND
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
bufferUBO $ isoMatrix 0 1 (V2 0 0) (V2 2 2)
renderLayer FixedCoordLayer shadV layerCounts
renderFoldable shadV $ fixedCoordPictures u
depthMask $= Enabled
glDepthMask GL_TRUE
when (debugOn Show_ms_frame $ _uvConfig u) $
renderFoldable
(_pictureShaders pdata)