Remove distortion framebuffer/graphic resolution option

This commit is contained in:
2025-11-21 11:32:30 +00:00
parent 2500a01cb3
commit 71e7b51c88
7 changed files with 45 additions and 41 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ data RenderData = RenderData
, _shapeEBO :: UintBO , _shapeEBO :: UintBO
, _silhouetteEBO :: UintBO , _silhouetteEBO :: UintBO
, _pictureShaders :: MV.MVector (PrimState IO) (GLuint,VBO) , _pictureShaders :: MV.MVector (PrimState IO) (GLuint,VBO)
, _fbo2 :: (FBO, TO) -- , _fbo2 :: (FBO, TO)
, _fboHalf1 :: (FBO, TO) , _fboHalf1 :: (FBO, TO)
, _fboHalf2 :: (FBO, TO) , _fboHalf2 :: (FBO, TO)
, _fboBase :: (FBO, (TO, TO, TO)) , _fboBase :: (FBO, (TO, TO, TO))
+2 -2
View File
@@ -57,7 +57,7 @@ data Config = Config
, _gr_shadow_size :: Importance , _gr_shadow_size :: Importance
, _gr_downsize_res :: ResFactor , _gr_downsize_res :: ResFactor
, _gr_world_res :: ResFactor , _gr_world_res :: ResFactor
, _gr_distortion_res :: ResFactor -- , _gr_distortion_res :: ResFactor
, _gr_num_shadow_casters :: NumShadowCasters , _gr_num_shadow_casters :: NumShadowCasters
, _windowX :: Int --size , _windowX :: Int --size
, _windowY :: Int , _windowY :: Int
@@ -161,7 +161,7 @@ defaultConfig =
, _gr_distortions = True , _gr_distortions = True
, _gr_downsize_res = EighthRes , _gr_downsize_res = EighthRes
, _gr_world_res = QuarterRes , _gr_world_res = QuarterRes
, _gr_distortion_res = FullRes -- , _gr_distortion_res = FullRes
, _gr_num_shadow_casters = toEnum 10 , _gr_num_shadow_casters = toEnum 10
, _windowX = 800 , _windowX = 800
, _windowY = 600 , _windowY = 600
+20 -20
View File
@@ -2,7 +2,7 @@ module Dodge.Event.Test (testEvent) where
--import Dodge.Creature.State --import Dodge.Creature.State
import Dodge.Flame --import Dodge.Flame
import Data.Maybe import Data.Maybe
import Dodge.Data.World import Dodge.Data.World
import LensHelp import LensHelp
@@ -10,23 +10,23 @@ import Linear
testEvent :: World -> World testEvent :: World -> World
testEvent w = fromMaybe w $ do testEvent w = fromMaybe w $ do
cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos . _xy
return $ w & makeFlame (cpos + 25) 1
--testEvent w = fromMaybe w $ do
-- cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos . _xy -- cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos . _xy
-- let distR = 50 -- return $ w & makeFlame (cpos + 25) 1
-- t1 = (V2 1 (-1)) --testEvent w = fromMaybe w $ do
-- t2 = (V2 1 1) cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos . _xy
-- t3 = (V2 distR 0) let distR = 50
-- v3 = V3 t1 t2 t3 t1 = (V2 1 (-1))
-- distortionBulge = t2 = (V2 1 1)
-- RadialDistortion t3 = (V2 distR 0)
-- cpos v3 = V3 t1 t2 t3
-- (V2 distR 0) distortionBulge =
-- (V2 0 distR) RadialDistortion
-- v3 v3 v3 cpos
-- 20 (V2 distR 0)
-- return $ w & cWorld . lWorld . distortions .~ [distortionBulge (V2 0 distR)
-- , distortionBulge & rdPos +~ 50 & rdTR . _1 +~ V2 (-1) 1 v3 v3 v3
-- , distortionBulge & rdPos +~ (-50) 20
-- ] return $ w & cWorld . lWorld . distortions .~ [distortionBulge
, distortionBulge & rdPos +~ 50 & rdTR . _1 +~ V2 (-1) 1
, distortionBulge & rdPos +~ (-50)
]
+1 -1
View File
@@ -189,7 +189,7 @@ graphicsMenuOptions :: [MenuOption]
graphicsMenuOptions = graphicsMenuOptions =
[ enumOption gr_world_res "World resolution" (uvIOEffects .~ updatePreload) [ enumOption gr_world_res "World resolution" (uvIOEffects .~ updatePreload)
, enumOption gr_downsize_res "Downsize resolution" (uvIOEffects .~ updatePreload) , enumOption gr_downsize_res "Downsize resolution" (uvIOEffects .~ updatePreload)
, enumOption gr_distortion_res "Distortion resolution" (uvIOEffects .~ updatePreload) -- , enumOption gr_distortion_res "Distortion resolution" (uvIOEffects .~ updatePreload)
, enumOption gr_shadow_rendering "SHADOW RENDERING" id , enumOption gr_shadow_rendering "SHADOW RENDERING" id
, enumOption gr_shadows_on_clouds "SHADOW DETAIL ON CLOUDS" id , enumOption gr_shadows_on_clouds "SHADOW DETAIL ON CLOUDS" id
, enumOption gr_shadow_size "SHADOW DETAIL" id , enumOption gr_shadow_size "SHADOW DETAIL" id
+13 -9
View File
@@ -261,12 +261,11 @@ doDrawing' win pdata u = do
glUseProgram (pdata ^. cloudShader) glUseProgram (pdata ^. cloudShader)
glDrawArrays GL_TRIANGLES 0 (fromIntegral nCloudVs * 6) glDrawArrays GL_TRIANGLES 0 (fromIntegral nCloudVs * 6)
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboPos . _1 . unFBO) glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboPos . _1 . unFBO)
withArray [0, 0, 0, 0] $ \ptr -> withArray [0, 0, 0, 0] $
glClearNamedFramebufferfv glClearNamedFramebufferfv
(pdata ^. fboPos . _1 . unFBO) (pdata ^. fboPos . _1 . unFBO)
GL_COLOR GL_COLOR
0 0
ptr
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _2 . unTO) glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _2 . unTO)
glDepthMask GL_FALSE glDepthMask GL_FALSE
glUseProgram (pdata ^. alphaDivideShader) glUseProgram (pdata ^. alphaDivideShader)
@@ -288,6 +287,11 @@ doDrawing' win pdata u = do
(pdata ^. fboCloud . _2 . _3) (pdata ^. fboCloud . _2 . _3)
lightPoints lightPoints
pdata pdata
-- no longer need cloud normals
withArray [GL_COLOR_ATTACHMENT1] $
glInvalidateNamedFramebufferData (pdata ^. fboCloud . _1 . unFBO) 1
-- no longer need shape data
glInvalidateBufferData (pdata ^. vboShapes . vboName)
--draw windows into window textures --draw windows into window textures
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboWindow . _1 . unFBO) glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboWindow . _1 . unFBO)
glBindTextureUnit 3 (pdata ^. fboPos . _2 . unTO) glBindTextureUnit 3 (pdata ^. fboPos . _2 . unTO)
@@ -306,12 +310,11 @@ doDrawing' win pdata u = do
-- with all source alphas 0.25, alpha -> 0.5 -- with all source alphas 0.25, alpha -> 0.5
glBlendFunc GL_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc GL_ONE_MINUS_DST_ALPHA GL_ONE_MINUS_SRC_ALPHA
glUseProgram $ pdata ^. windowPullShader glUseProgram $ pdata ^. windowPullShader
-- don't need cloud postions/normals any more -- don't need cloud postions any more
withArray [GL_COLOR_ATTACHMENT0] $ withArray [GL_COLOR_ATTACHMENT0] $
glInvalidateNamedFramebufferData (pdata ^. fboPos . _1 . unFBO) 1 glInvalidateNamedFramebufferData (pdata ^. fboPos . _1 . unFBO) 1
glDrawArrays GL_TRIANGLES 0 (fromIntegral nWins * 12) glDrawArrays GL_TRIANGLES 0 (fromIntegral nWins * 12)
glDisable GL_DEPTH_CLAMP glDisable GL_DEPTH_CLAMP
glInvalidateBufferData (pdata ^. vboShapes . vboName)
--apply lightmap to cloud buffer --apply lightmap to cloud buffer
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata))) glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
glDepthMask GL_FALSE glDepthMask GL_FALSE
@@ -356,7 +359,8 @@ doDrawing' win pdata u = do
glDrawArrays GL_TRIANGLES 0 6 glDrawArrays GL_TRIANGLES 0 6
rs' -> do rs' -> do
let rs = take 15 rs' let rs = take 15 rs'
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fbo2 . _1 . unFBO) --glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fbo2 . _1 . unFBO)
glBindFramebuffer GL_FRAMEBUFFER 0
withArray (concatMap rdToVec2s rs) $ withArray (concatMap rdToVec2s rs) $
glNamedBufferSubData (pdata ^. barrelShader . _2 . vboName) 0 glNamedBufferSubData (pdata ^. barrelShader . _2 . vboName) 0
(24 * fromIntegral (length rs * sizeOf (0 :: Float))) (24 * fromIntegral (length rs * sizeOf (0 :: Float)))
@@ -364,10 +368,10 @@ doDrawing' win pdata u = do
glUseProgram (pdata ^. barrelShader . _1) glUseProgram (pdata ^. barrelShader . _1)
glUniform1i 0 (fromIntegral (length rs)) glUniform1i 0 (fromIntegral (length rs))
glDrawArrays GL_TRIANGLES 0 6 glDrawArrays GL_TRIANGLES 0 6
glBindTextureUnit 0 $ pdata ^. fbo2 . _2 . unTO -- glBindTextureUnit 0 $ pdata ^. fbo2 . _2 . unTO
glBindFramebuffer GL_FRAMEBUFFER 0 -- glBindFramebuffer GL_FRAMEBUFFER 0
glUseProgram (pdata ^. fullscreenShader) -- glUseProgram (pdata ^. fullscreenShader)
glDrawArrays GL_TRIANGLES 0 6 -- glDrawArrays GL_TRIANGLES 0 6
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
-- draw the overlay -- draw the overlay
--glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboOverlay ._1 . unFBO) --glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboOverlay ._1 . unFBO)
+6 -6
View File
@@ -55,12 +55,12 @@ sizeFBOs cfig rdata =
GL_LINEAR GL_LINEAR
GL_RGBA16F GL_RGBA16F
[fboBloom, fboPos] [fboBloom, fboPos]
>>= foldUpdateFBOTO -- >>= foldUpdateFBOTO
_gr_distortion_res -- _gr_distortion_res
GL_LINEAR_MIPMAP_LINEAR -- GL_LINEAR_MIPMAP_LINEAR
GL_LINEAR -- GL_LINEAR
GL_RGBA8 -- GL_RGBA8
[fbo2] -- [fbo2]
>>= foldUpdateFBOTO >>= foldUpdateFBOTO
_gr_downsize_res _gr_downsize_res
GL_LINEAR_MIPMAP_LINEAR GL_LINEAR_MIPMAP_LINEAR
+2 -2
View File
@@ -173,7 +173,7 @@ preloadRender = do
fboPosName <- setupFramebufferGivenStencil rboBaseBloomName fboPosName <- setupFramebufferGivenStencil rboBaseBloomName
fboLightingName <- setupFramebufferGivenStencil rboBaseBloomName fboLightingName <- setupFramebufferGivenStencil rboBaseBloomName
framebuf2 <- newTextureFramebuffer -- framebuf2 <- newTextureFramebuffer
fboHalf1Name <- newTextureFramebuffer fboHalf1Name <- newTextureFramebuffer
fboHalf2Name <- newTextureFramebuffer fboHalf2Name <- newTextureFramebuffer
@@ -201,7 +201,7 @@ preloadRender = do
, _lightingCloudShader = lightingCloudShad , _lightingCloudShader = lightingCloudShad
, _bloomBlurShader = bloomBlurShad , _bloomBlurShader = bloomBlurShad
, _barrelShader = (barrelShad,distvbo) , _barrelShader = (barrelShad,distvbo)
, _fbo2 = framebuf2 -- , _fbo2 = framebuf2
, _fboHalf1 = fboHalf1Name , _fboHalf1 = fboHalf1Name
, _fboHalf2 = fboHalf2Name , _fboHalf2 = fboHalf2Name
, _fboLighting = fboLightingName , _fboLighting = fboLightingName