Refactor differing resolutions somewhat
This commit is contained in:
+24
-26
@@ -7,7 +7,7 @@ module Framebuffer.Update (
|
||||
sizeFBOs,
|
||||
) where
|
||||
|
||||
import Dodge.DownscaleSize
|
||||
import Dodge.Data.Config
|
||||
import Shader.Data
|
||||
import Framebuffer.Check
|
||||
import Control.Lens
|
||||
@@ -19,52 +19,45 @@ import Graphics.GL.Core45
|
||||
import Unsafe.Coerce
|
||||
|
||||
sizeFBOs ::
|
||||
-- | Scaled width
|
||||
Int ->
|
||||
-- | Scaled height
|
||||
Int ->
|
||||
-- | Full width
|
||||
Int ->
|
||||
-- | Full height
|
||||
Int ->
|
||||
Configuration ->
|
||||
RenderData ->
|
||||
IO RenderData
|
||||
sizeFBOs xsize ysize xfull yfull rdata = do
|
||||
resizeRBO (_rboBaseBloom rdata) xsize ysize
|
||||
rdata1 <- updateFBOTO3 xsize ysize GL_NEAREST GL_NEAREST GL_RGBA8 GL_RGBA16F GL_RGBA16F rdata fboBase
|
||||
rdata2 <- updateFBOTO3 xsize ysize GL_NEAREST GL_NEAREST GL_RGBA8 GL_RGBA16F GL_RGBA16F rdata1 fboCloud
|
||||
rdata' <- updateFBOTO xsize ysize GL_NEAREST GL_NEAREST GL_RGBA8 rdata2 fboLighting
|
||||
sizeFBOs cfig rdata = do
|
||||
uncurry (resizeRBO (_rboBaseBloom rdata)) (getWindowSize _graphics_world_resolution cfig)
|
||||
rdata1 <- uncurry updateFBOTO3 (getWindowSize _graphics_world_resolution cfig)
|
||||
GL_NEAREST GL_NEAREST GL_RGBA8 GL_RGBA16F GL_RGBA16F rdata fboBase
|
||||
rdata2 <- uncurry updateFBOTO3 (getWindowSize _graphics_world_resolution cfig)
|
||||
GL_NEAREST GL_NEAREST GL_RGBA8 GL_RGBA16F GL_RGBA16F rdata1 fboCloud
|
||||
rdata' <- uncurry updateFBOTO (getWindowSize _graphics_world_resolution cfig)
|
||||
GL_NEAREST GL_NEAREST GL_RGBA8 rdata2 fboLighting
|
||||
rdata'' <-
|
||||
foldM
|
||||
(updateFBOTO xsize ysize GL_LINEAR_MIPMAP_LINEAR GL_LINEAR GL_RGBA16F)
|
||||
(uncurry updateFBOTO (getWindowSize _graphics_world_resolution cfig)
|
||||
GL_LINEAR_MIPMAP_LINEAR GL_LINEAR GL_RGBA16F)
|
||||
rdata'
|
||||
[fboBloom, fboPos]
|
||||
rdata''' <-
|
||||
foldM
|
||||
(updateFBOTO xfull yfull GL_NEAREST GL_NEAREST GL_RGBA8)
|
||||
(uncurry updateFBOTO (getWindowSize _graphics_overlay_resolution cfig) GL_NEAREST GL_NEAREST GL_RGBA8)
|
||||
rdata''
|
||||
[fbo2, fbo3]
|
||||
rdata4 <-
|
||||
foldM
|
||||
(updateFBOTO (xfull `div` downSize) (yfull `div` downSize) GL_LINEAR_MIPMAP_LINEAR GL_LINEAR GL_RGBA16F)
|
||||
(uncurry updateFBOTO (getWindowSize _graphics_downsize_resolution cfig) GL_LINEAR_MIPMAP_LINEAR GL_LINEAR GL_RGBA16F)
|
||||
rdata'''
|
||||
[fboHalf1, fboHalf2, fboHalf3]
|
||||
newShadowFBO <- resizeShadowFBO (rdata ^. fboShadow) xsize ysize
|
||||
newShadowFBO <- uncurry (resizeShadowFBO (rdata ^. fboShadow))
|
||||
(getWindowSize _graphics_world_resolution cfig)
|
||||
return $ rdata4 & fboShadow .~ newShadowFBO
|
||||
|
||||
resizeRBO ::
|
||||
GLuint -> -- RenderbufferObject
|
||||
Int ->
|
||||
Int ->
|
||||
GLsizei ->
|
||||
GLsizei ->
|
||||
IO ()
|
||||
resizeRBO rboName xsize ysize = do
|
||||
let xsize' = fromIntegral xsize
|
||||
ysize' = fromIntegral ysize
|
||||
glNamedRenderbufferStorage
|
||||
resizeRBO rboName = glNamedRenderbufferStorage
|
||||
rboName
|
||||
GL_DEPTH24_STENCIL8
|
||||
xsize'
|
||||
ysize'
|
||||
|
||||
updateFBOTO ::
|
||||
Int ->
|
||||
@@ -228,3 +221,8 @@ initializeTexture2DArray fbo attachpoint x y z minfilt magfilt informat = do
|
||||
glTextureParameteri to1 GL_TEXTURE_MAG_FILTER (unsafeCoerce magfilt)
|
||||
glNamedFramebufferTexture (_unFBO fbo) attachpoint to1 0
|
||||
return to1
|
||||
|
||||
getWindowSize :: Integral a => (Configuration -> ResFactor) -> Configuration -> (a,a)
|
||||
getWindowSize f cfig = (g _windowX,g _windowY)
|
||||
where
|
||||
g h = fromIntegral $ round (h cfig) `div` resFactorNum (f cfig)
|
||||
|
||||
Reference in New Issue
Block a user