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