Cleanup
This commit is contained in:
+49
-79
@@ -5,7 +5,6 @@
|
||||
-}
|
||||
module Framebuffer.Update (sizeFBOs) where
|
||||
|
||||
import Geometry.Data
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import Data.Preload.Render
|
||||
@@ -14,6 +13,7 @@ import Dodge.WindowSize
|
||||
import Foreign.Marshal.Array
|
||||
import Framebuffer.Check
|
||||
import GLHelp
|
||||
import Geometry.Data
|
||||
import Graphics.GL.Core45
|
||||
import Shader.Data
|
||||
import Unsafe.Coerce
|
||||
@@ -21,21 +21,22 @@ import Unsafe.Coerce
|
||||
sizeFBOs :: Config -> RenderData -> IO RenderData
|
||||
sizeFBOs cfig rdata =
|
||||
uncurryV (resizeRBO (_rboBaseBloom rdata)) (getWindowSize _gr_world_res cfig)
|
||||
>> fboBase (resizeFBOTO3'
|
||||
(getWindowSize _gr_world_res cfig)
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_RGB16F -- RGBAF not sure if the alpha is necessary here
|
||||
GL_RGB16F -- could possibly recover using depth in a clever way
|
||||
-- but probably not, because the projection matrix is
|
||||
-- not always on-center
|
||||
GL_RGBA8_SNORM)
|
||||
>> fboBase
|
||||
( resizeFBOTO3'
|
||||
(getWindowSize _gr_world_res cfig)
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_RGB16F -- RGBAF not sure if the alpha is necessary here
|
||||
GL_RGB16F -- could possibly recover using depth in a clever way
|
||||
-- but probably not, because the projection matrix is
|
||||
-- not always on-center
|
||||
GL_RGBA8_SNORM
|
||||
)
|
||||
rdata
|
||||
>>= flip
|
||||
(
|
||||
updateFBOTO3
|
||||
>>= fboCloud
|
||||
( resizeFBOTO3
|
||||
(getWindowSize _gr_world_res cfig)
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
@@ -43,42 +44,42 @@ sizeFBOs cfig rdata =
|
||||
GL_RGBA16F
|
||||
GL_RGBA16F
|
||||
)
|
||||
fboCloud
|
||||
>>= foldUpdateFBOTO
|
||||
_gr_world_res
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_RGBA8
|
||||
[fboLighting]
|
||||
>>= fboBloom (resizeFBOTO'
|
||||
(getWindowSize _gr_world_res cfig)
|
||||
3
|
||||
GL_LINEAR_MIPMAP_LINEAR
|
||||
GL_LINEAR
|
||||
GL_RGBA16F
|
||||
-- [fboBloom] -- fboPos probably doesn't need the alpha channel
|
||||
>>= fboBloom
|
||||
( resizeFBOTO'
|
||||
(getWindowSize _gr_world_res cfig)
|
||||
5
|
||||
GL_LINEAR_MIPMAP_LINEAR
|
||||
GL_LINEAR
|
||||
GL_RGBA16F
|
||||
-- [fboBloom] -- fboPos probably doesn't need the alpha channel
|
||||
)
|
||||
>>= fboPos
|
||||
( resizeFBOTO
|
||||
(getWindowSize _gr_world_res cfig)
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_RGBA16F -- possibly doesn't need the alpha channel...
|
||||
)
|
||||
>>= foldUpdateFBOTO
|
||||
_gr_world_res
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_RGBA16F
|
||||
[fboPos] -- fboPos probably doesn't need the alpha channel
|
||||
>>= foldUpdateFBOTO
|
||||
_gr_downsize_res
|
||||
GL_LINEAR_MIPMAP_LINEAR
|
||||
GL_LINEAR
|
||||
GL_RGBA16F
|
||||
[fboHalf1, fboHalf2]
|
||||
>>= flip
|
||||
( updateFBOTO2
|
||||
>>= fboWindow
|
||||
( resizeFBOTO2
|
||||
(getWindowSize _gr_world_res cfig)
|
||||
GL_NEAREST
|
||||
GL_NEAREST
|
||||
GL_RGBA8
|
||||
GL_RGBA8
|
||||
)
|
||||
fboWindow
|
||||
where
|
||||
updateFBOTO' f = updateFBOTO (getWindowSize f cfig)
|
||||
foldUpdateFBOTO f minfilt magfilt form =
|
||||
@@ -102,49 +103,10 @@ updateFBOTO ::
|
||||
ALens' RenderData (FBO, TO) ->
|
||||
IO RenderData
|
||||
updateFBOTO wsize minfilt magfilt form pdata target = do
|
||||
newfbo2 <- resizeFBOTO (pdata ^# target) wsize minfilt magfilt form
|
||||
return $ storing target newfbo2 pdata
|
||||
|
||||
-- note that the ordering of arguments is different to the other update
|
||||
-- functions... this all needs rethinking
|
||||
updateFBOTO2 ::
|
||||
V2 Int ->
|
||||
-- | minification filter
|
||||
GLenum ->
|
||||
-- | magnification filter
|
||||
GLenum ->
|
||||
-- | internal color format texture1
|
||||
GLenum ->
|
||||
-- | internal color format texture2
|
||||
GLenum ->
|
||||
RenderData ->
|
||||
ALens' RenderData (FBO, (TO, TO)) ->
|
||||
IO RenderData
|
||||
updateFBOTO2 wsize minfilt magfilt form1 form2 pdata target = do
|
||||
newfbo2 <- resizeFBOTO2 (pdata ^# target) wsize minfilt magfilt form1 form2
|
||||
return $ storing target newfbo2 pdata
|
||||
|
||||
updateFBOTO3 ::
|
||||
V2 Int ->
|
||||
-- | minification filter
|
||||
GLenum ->
|
||||
-- | magnification filter
|
||||
GLenum ->
|
||||
-- | internal color format texture1
|
||||
GLenum ->
|
||||
-- | internal color format texture2
|
||||
GLenum ->
|
||||
-- | internal color format texture3
|
||||
GLenum ->
|
||||
RenderData ->
|
||||
ALens' RenderData (FBO, (TO, TO, TO)) ->
|
||||
IO RenderData
|
||||
updateFBOTO3 wsize minfilt magfilt form1 form2 form3 pdata target = do
|
||||
newfbo2 <- resizeFBOTO3 (pdata ^# target) wsize minfilt magfilt form1 form2 form3
|
||||
newfbo2 <- resizeFBOTO wsize minfilt magfilt form (pdata ^# target)
|
||||
return $ storing target newfbo2 pdata
|
||||
|
||||
resizeFBOTO2 ::
|
||||
(FBO, (TO, TO)) ->
|
||||
V2 Int ->
|
||||
-- | minification filter
|
||||
GLenum ->
|
||||
@@ -154,8 +116,9 @@ resizeFBOTO2 ::
|
||||
GLenum ->
|
||||
-- | internal color format2
|
||||
GLenum ->
|
||||
(FBO, (TO, TO)) ->
|
||||
IO (FBO, (TO, TO))
|
||||
resizeFBOTO2 (fbo, (told1, told2)) wsize minfilt magfilt form1 form2 = do
|
||||
resizeFBOTO2 wsize minfilt magfilt form1 form2 (fbo, (told1, told2)) = do
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO fbo)
|
||||
mglDelete glDeleteTextures $ _unTO told1
|
||||
mglDelete glDeleteTextures $ _unTO told2
|
||||
@@ -167,7 +130,6 @@ resizeFBOTO2 (fbo, (told1, told2)) wsize minfilt magfilt form1 form2 = do
|
||||
return (fbo, (TO to1, TO to2))
|
||||
|
||||
resizeFBOTO3 ::
|
||||
(FBO, (TO, TO, TO)) ->
|
||||
V2 Int ->
|
||||
-- | minification filter
|
||||
GLenum ->
|
||||
@@ -179,8 +141,9 @@ resizeFBOTO3 ::
|
||||
GLenum ->
|
||||
-- | internal color format3
|
||||
GLenum ->
|
||||
(FBO, (TO, TO, TO)) ->
|
||||
IO (FBO, (TO, TO, TO))
|
||||
resizeFBOTO3 (fbo, (told1, told2, told3)) wsize minfilt magfilt form1 form2 form3 = do
|
||||
resizeFBOTO3 wsize minfilt magfilt form1 form2 form3 (fbo, (told1, told2, told3)) = do
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO fbo)
|
||||
mglDelete glDeleteTextures $ _unTO told1
|
||||
mglDelete glDeleteTextures $ _unTO told2
|
||||
@@ -225,7 +188,6 @@ resizeFBOTO3' wsize min1 mag1 minfilt magfilt form1 form2 form3 (fbo, (told1, to
|
||||
return (fbo, (TO to1, TO to2, TO to3))
|
||||
|
||||
resizeFBOTO ::
|
||||
(FBO, TO) ->
|
||||
V2 Int ->
|
||||
-- | minification filter
|
||||
GLenum ->
|
||||
@@ -233,8 +195,9 @@ resizeFBOTO ::
|
||||
GLenum ->
|
||||
-- | internal color format
|
||||
GLenum ->
|
||||
(FBO, TO) ->
|
||||
IO (FBO, TO)
|
||||
resizeFBOTO (fbo, oldto) wsize minfilt magfilt form = do
|
||||
resizeFBOTO wsize minfilt magfilt form (fbo, oldto) = do
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO fbo)
|
||||
mglDelete glDeleteTextures $ _unTO oldto
|
||||
to1 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT0 wsize 1 minfilt magfilt form
|
||||
@@ -259,8 +222,15 @@ resizeFBOTO' wsize nlevels minfilt magfilt form (fbo, oldto) = do
|
||||
checkFBO fbo
|
||||
return (fbo, TO to1)
|
||||
|
||||
initializeTexture2D :: FBO -> GLenum -> V2 Int -> Int
|
||||
-> GLenum -> GLenum -> GLenum -> IO GLuint
|
||||
initializeTexture2D ::
|
||||
FBO ->
|
||||
GLenum ->
|
||||
V2 Int ->
|
||||
Int ->
|
||||
GLenum ->
|
||||
GLenum ->
|
||||
GLenum ->
|
||||
IO GLuint
|
||||
initializeTexture2D fbo attachpoint (V2 x y) nlevels minfilt magfilt form = do
|
||||
let xsize' = fromIntegral x
|
||||
ysize' = fromIntegral y
|
||||
|
||||
@@ -2707,7 +2707,7 @@ brightX src/Color.hs 116;" f
|
||||
btSPic src/Dodge/Render/ShapePicture.hs 131;" f
|
||||
btText src/Dodge/Inventory/SelectionList.hs 237;" f
|
||||
bufferEBO src/Shader/Bind.hs 28;" f
|
||||
bufferPerspectiveMatrixUBO src/Dodge/Render.hs 407;" f
|
||||
bufferPerspectiveMatrixUBO src/Dodge/Render.hs 408;" f
|
||||
bufferPokedVBO src/Shader/Bind.hs 19;" f
|
||||
bufferShaderLayers src/Shader/Bind.hs 32;" f
|
||||
bulletBeltBracer src/Dodge/Item/Equipment.hs 67;" f
|
||||
@@ -3452,7 +3452,7 @@ facesToVF src/Polyhedra/Geodesic.hs 69;" f
|
||||
farWallDistDirection src/Dodge/Update/Camera.hs 246;" f
|
||||
fdiv src/ShortShow.hs 41;" f
|
||||
feet src/Dodge/Creature/Picture.hs 51;" f
|
||||
ffoldM src/Framebuffer/Update.hs 86;" f
|
||||
ffoldM src/Framebuffer/Update.hs 88;" f
|
||||
filter3 src/FoldableHelp.hs 76;" f
|
||||
filterSectionsPair src/Dodge/DisplayInventory.hs 157;" f
|
||||
findBlips src/Dodge/RadarSweep.hs 63;" f
|
||||
@@ -3564,7 +3564,7 @@ getCrMoveSpeed src/Dodge/Creature/Statistics.hs 50;" f
|
||||
getCrsFromRooms src/Dodge/Room/Tutorial.hs 332;" f
|
||||
getCrsFromRooms' src/Dodge/Room/Tutorial.hs 319;" f
|
||||
getDebugMouseOver src/Dodge/Update.hs 374;" f
|
||||
getDistortions src/Dodge/Render.hs 419;" f
|
||||
getDistortions src/Dodge/Render.hs 420;" f
|
||||
getEdgesCrossing src/Dodge/Path.hs 37;" f
|
||||
getGrenadeHitEffect src/Dodge/HeldUse.hs 1264;" f
|
||||
getInventoryPath src/Dodge/Inventory/Path.hs 9;" f
|
||||
@@ -3719,7 +3719,7 @@ initialisePlaying src/Sound.hs 77;" f
|
||||
initializeGLState src/Preload/Render.hs 251;" f
|
||||
initializeOptionMenu src/Dodge/Menu/Option.hs 17;" f
|
||||
initializeOptionMenuBO src/Dodge/Menu/Option.hs 30;" f
|
||||
initializeTexture2D src/Framebuffer/Update.hs 263;" f
|
||||
initializeTexture2D src/Framebuffer/Update.hs 244;" f
|
||||
inorderNumberTree src/TreeHelp.hs 190;" f
|
||||
insertAt src/Padding.hs 63;" f
|
||||
insertIMInZone src/Dodge/Base.hs 54;" f
|
||||
@@ -4565,7 +4565,7 @@ randomTreeStructure src/Dodge/Layout/Generate.hs 18;" f
|
||||
randsOnCirc src/RandomHelp.hs 127;" f
|
||||
randsSpread src/RandomHelp.hs 120;" f
|
||||
ratIntersectLineLine src/Geometry/Intersect.hs 216;" f
|
||||
rdToVec2s src/Dodge/Render.hs 402;" f
|
||||
rdToVec2s src/Dodge/Render.hs 403;" f
|
||||
readSaveSlot src/Dodge/Save.hs 45;" f
|
||||
recoilAmount src/Dodge/HeldUse.hs 467;" f
|
||||
rectNSWE src/Geometry/Polygon.hs 15;" f
|
||||
@@ -4616,12 +4616,12 @@ resetCrVocCoolDown src/Dodge/Creature/Vocalization.hs 47;" f
|
||||
resetPLUse src/Dodge/PlacementSpot.hs 92;" f
|
||||
resetStride src/Dodge/Creature/State/WalkCycle.hs 25;" f
|
||||
resetTerminal src/Dodge/WorldEffect.hs 109;" f
|
||||
resizeFBOTO src/Framebuffer/Update.hs 228;" f
|
||||
resizeFBOTO' src/Framebuffer/Update.hs 246;" f
|
||||
resizeFBOTO2 src/Framebuffer/Update.hs 145;" f
|
||||
resizeFBOTO3 src/Framebuffer/Update.hs 169;" f
|
||||
resizeFBOTO3' src/Framebuffer/Update.hs 197;" f
|
||||
resizeRBO src/Framebuffer/Update.hs 89;" f
|
||||
resizeFBOTO src/Framebuffer/Update.hs 209;" f
|
||||
resizeFBOTO' src/Framebuffer/Update.hs 226;" f
|
||||
resizeFBOTO2 src/Framebuffer/Update.hs 128;" f
|
||||
resizeFBOTO3 src/Framebuffer/Update.hs 151;" f
|
||||
resizeFBOTO3' src/Framebuffer/Update.hs 178;" f
|
||||
resizeRBO src/Framebuffer/Update.hs 91;" f
|
||||
respawn src/Dodge/SpawnAt.hs 12;" f
|
||||
restrictInLinks src/Dodge/RoomLink.hs 44;" f
|
||||
restrictLinkType src/Dodge/RoomLink.hs 34;" f
|
||||
@@ -4820,7 +4820,7 @@ setTiles src/Dodge/Layout.hs 67;" f
|
||||
setTreeInts src/Dodge/Room/Tutorial.hs 73;" f
|
||||
setViewDistance src/Dodge/Update/Camera.hs 241;" f
|
||||
setViewPos src/Dodge/Creature/ReaderUpdate.hs 69;" f
|
||||
setViewport src/Dodge/Render.hs 424;" f
|
||||
setViewport src/Dodge/Render.hs 425;" f
|
||||
setVol src/Dodge/Config.hs 47;" f
|
||||
setWindowColor src/Dodge/Render/Walls.hs 32;" f
|
||||
setWristShieldPos src/Dodge/Equipment.hs 49;" f
|
||||
@@ -5317,9 +5317,8 @@ updateEnergyBall src/Dodge/EnergyBall.hs 31;" f
|
||||
updateEnergyBalls src/Dodge/Update.hs 655;" f
|
||||
updateEnterRegex src/Dodge/Update/Input/InGame.hs 505;" f
|
||||
updateExpBarrel src/Dodge/Barreloid.hs 21;" f
|
||||
updateFBOTO src/Framebuffer/Update.hs 92;" f
|
||||
updateFBOTO2 src/Framebuffer/Update.hs 109;" f
|
||||
updateFBOTO3 src/Framebuffer/Update.hs 126;" f
|
||||
updateFBOTO src/Framebuffer/Update.hs 94;" f
|
||||
updateFBOTO2 src/Framebuffer/Update.hs 111;" f
|
||||
updateFlame src/Dodge/Flame.hs 19;" f
|
||||
updateFlames src/Dodge/Update.hs 652;" f
|
||||
updateFloatingCamera src/Dodge/Update/Camera.hs 36;" f
|
||||
|
||||
Reference in New Issue
Block a user