Refactor framebuffer update

This commit is contained in:
2023-03-24 13:14:49 +00:00
parent bd9f32875e
commit 4d09927d42
9 changed files with 59 additions and 83 deletions
+7 -6
View File
@@ -46,9 +46,7 @@ sizeFBOs cfig rdata = do
(uncurry updateFBOTO (getWindowSize _graphics_downsize_resolution cfig) GL_LINEAR_MIPMAP_LINEAR GL_LINEAR GL_RGBA16F)
rdata'''
[fboHalf1, fboHalf2, fboHalf3]
newShadowFBO <- uncurry (resizeShadowFBO (rdata ^. fboShadow))
(getWindowSize _graphics_world_resolution cfig)
return $ rdata4 & fboShadow .~ newShadowFBO
resizeShadowFBO' cfig rdata4
resizeRBO ::
GLuint -> -- RenderbufferObject
@@ -113,13 +111,16 @@ updateFBOTO3 xsize ysize minfilt magfilt inFormat1 inFormat2 inFormat3 pdata tar
newfbo2 <- resizeFBOTO3 (pdata ^# target) xsize ysize minfilt magfilt inFormat1 inFormat2 inFormat3
return $ storing target newfbo2 pdata
resizeShadowFBO' :: Configuration -> RenderData -> IO RenderData
resizeShadowFBO' cfig = fboShadow (uncurry resizeShadowFBO (getWindowSize _graphics_world_resolution cfig))
-- note we only really "change" the texture objects
resizeShadowFBO ::
Int ->
Int ->
(FBO, (TO, TO)) ->
Int ->
Int ->
IO (FBO, (TO, TO))
resizeShadowFBO (fbo, (oldto1, oldto2)) x y = do
resizeShadowFBO x y (fbo, (oldto1, oldto2)) = do
glBindFramebuffer GL_FRAMEBUFFER (_unFBO fbo)
mglDelete glDeleteTextures $ _unTO oldto1
mglDelete glDeleteTextures $ _unTO oldto2