Rmove overlay framebuffer, directly draw overlay instead
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#version 450 core
|
#version 450 core
|
||||||
layout(local_size_x= 16, local_size_y=1) in;
|
layout(local_size_x= 20, local_size_y=1) in;
|
||||||
layout(rgba8, binding = 5) uniform restrict writeonly image2D img_output;
|
layout(rgba8, binding = 5) uniform restrict writeonly image2D img_output;
|
||||||
layout (std140, binding = 1) uniform LightsBlock
|
layout (std140, binding = 1) uniform LightsBlock
|
||||||
{
|
{
|
||||||
@@ -13,7 +13,7 @@ void main ()
|
|||||||
shared vec3[20] larray;
|
shared vec3[20] larray;
|
||||||
uint i = gl_LocalInvocationID.x;
|
uint i = gl_LocalInvocationID.x;
|
||||||
vec3 lightamount = vec3(0,0,0);
|
vec3 lightamount = vec3(0,0,0);
|
||||||
ivec2 pixel_coords = ivec2(gl_GlobalInvocationID.xy);
|
ivec2 pixel_coords = ivec2(gl_WorkGroupID.xy);
|
||||||
vec2 tex_coords = vec2((4*pixel_coords.x+4)/800.0, (4*pixel_coords.y+4)/835.0);
|
vec2 tex_coords = vec2((4*pixel_coords.x+4)/800.0, (4*pixel_coords.y+4)/835.0);
|
||||||
vec3 pos = texture(posTexture,tex_coords).xyz;
|
vec3 pos = texture(posTexture,tex_coords).xyz;
|
||||||
vec3 lightPos = posBool[i].xyz;
|
vec3 lightPos = posBool[i].xyz;
|
||||||
@@ -26,15 +26,15 @@ void main ()
|
|||||||
float x = 1 - dist / lumRad.a;
|
float x = 1 - dist / lumRad.a;
|
||||||
vec3 norm = texture(normals,tex_coords).xyz;
|
vec3 norm = texture(normals,tex_coords).xyz;
|
||||||
float y1 = dot(normalize(norm), normalize(distVec));
|
float y1 = dot(normalize(norm), normalize(distVec));
|
||||||
float y = float(y1 > 0 ? 1 : 0);
|
float y = float(y1 > 0 ? 0 : 1);
|
||||||
lightamount = y*x*lumRad.rgb;
|
lightamount = y*x*lumRad.rgb;
|
||||||
|
|
||||||
}
|
}
|
||||||
larray[i] = lightamount;
|
larray[i] = lightamount;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
//{ vec3 inverselight = 1 - lightamount;
|
{ vec3 inverselight = 1 - lightamount;
|
||||||
{ vec3 inverselight = vec3(0,0,0);
|
//{ vec3 inverselight = vec3(0,0,0);
|
||||||
// for (uint j=1 ; j < 20; ++j) {inverselight = inverselight * (1 - larray[j]);}
|
for (uint j=1 ; j < 20; ++j) {inverselight = inverselight * (1 - larray[j]);}
|
||||||
imageStore(img_output, pixel_coords, vec4(inverselight,1));
|
imageStore(img_output, pixel_coords, vec4(inverselight,1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ data RenderData = RenderData
|
|||||||
, _fboCloud :: (FBO, (TO, TO, TO))
|
, _fboCloud :: (FBO, (TO, TO, TO))
|
||||||
, _fboBloom :: (FBO, TO)
|
, _fboBloom :: (FBO, TO)
|
||||||
, _fboPos :: (FBO, TO)
|
, _fboPos :: (FBO, TO)
|
||||||
, _fboOverlay :: (FBO, TO)
|
|
||||||
, _fboLighting :: (FBO, TO)
|
, _fboLighting :: (FBO, TO)
|
||||||
, _fboShadow :: (FBO, (TO, TO))
|
, _fboShadow :: (FBO, (TO, TO))
|
||||||
, _rboBaseBloom :: GLuint -- RenderbufferObject id
|
, _rboBaseBloom :: GLuint -- RenderbufferObject id
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ data Configuration = Configuration
|
|||||||
, _graphics_shadow_size :: Importance
|
, _graphics_shadow_size :: Importance
|
||||||
, _graphics_downsize_resolution :: ResFactor
|
, _graphics_downsize_resolution :: ResFactor
|
||||||
, _graphics_world_resolution :: ResFactor
|
, _graphics_world_resolution :: ResFactor
|
||||||
, _graphics_overlay_resolution :: ResFactor
|
, _graphics_distortion_resolution :: ResFactor
|
||||||
, _graphics_num_shadow_casters :: NumShadowCasters
|
, _graphics_num_shadow_casters :: NumShadowCasters
|
||||||
, _windowX :: Int
|
, _windowX :: Int
|
||||||
, _windowY :: Int
|
, _windowY :: Int
|
||||||
@@ -136,7 +136,7 @@ defaultConfig =
|
|||||||
, _graphics_distortions = True
|
, _graphics_distortions = True
|
||||||
, _graphics_downsize_resolution = SixteenthRes
|
, _graphics_downsize_resolution = SixteenthRes
|
||||||
, _graphics_world_resolution = QuarterRes
|
, _graphics_world_resolution = QuarterRes
|
||||||
, _graphics_overlay_resolution = FullRes
|
, _graphics_distortion_resolution = FullRes
|
||||||
, _graphics_num_shadow_casters = toEnum 10
|
, _graphics_num_shadow_casters = toEnum 10
|
||||||
, _windowX = 800
|
, _windowX = 800
|
||||||
, _windowY = 600
|
, _windowY = 600
|
||||||
|
|||||||
+5
-5
@@ -15,6 +15,11 @@ import Dodge.Tree
|
|||||||
import LensHelp
|
import LensHelp
|
||||||
import RandomHelp
|
import RandomHelp
|
||||||
|
|
||||||
|
-- | A test level tree.
|
||||||
|
initialRoomTree :: State (StdGen, Int) (MetaTree Room String)
|
||||||
|
initialRoomTree = annoToRoomTree initialAnoTree
|
||||||
|
--initialRoomTree = annoToRoomTree startWorldTreeTest
|
||||||
|
|
||||||
startWorldTreeTest :: Annotation
|
startWorldTreeTest :: Annotation
|
||||||
startWorldTreeTest =
|
startWorldTreeTest =
|
||||||
OnwardList $
|
OnwardList $
|
||||||
@@ -106,8 +111,3 @@ initialAnoTree =
|
|||||||
-- ,[Corridor]
|
-- ,[Corridor]
|
||||||
AnTree $ randomFourCornerRoom [] >>= rToOnward "randomFourCornerRoom" . pure . cleatOnward
|
AnTree $ randomFourCornerRoom [] >>= rToOnward "randomFourCornerRoom" . pure . cleatOnward
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | A test level tree.
|
|
||||||
initialRoomTree :: State (StdGen, Int) (MetaTree Room String)
|
|
||||||
--initialRoomTree = annoToRoomTree initialAnoTree
|
|
||||||
initialRoomTree = annoToRoomTree startWorldTreeTest
|
|
||||||
|
|||||||
+1
-1
@@ -185,7 +185,7 @@ graphicsMenuOptions =
|
|||||||
[ makeEnumOption graphics_world_resolution "World resolution" (uvIOEffects .~ updatePreload)
|
[ makeEnumOption graphics_world_resolution "World resolution" (uvIOEffects .~ updatePreload)
|
||||||
, makeEnumOption graphics_downsize_resolution "Downsize resolution"
|
, makeEnumOption graphics_downsize_resolution "Downsize resolution"
|
||||||
(uvIOEffects .~ updatePreload)
|
(uvIOEffects .~ updatePreload)
|
||||||
, makeEnumOption graphics_overlay_resolution "Overlay resolution"
|
, makeEnumOption graphics_distortion_resolution "Overlay resolution"
|
||||||
(uvIOEffects .~ updatePreload)
|
(uvIOEffects .~ updatePreload)
|
||||||
, makeEnumOption graphics_shadow_rendering "SHADOW RENDERING" id
|
, makeEnumOption graphics_shadow_rendering "SHADOW RENDERING" id
|
||||||
, makeEnumOption graphics_shadow_size "SHADOW DETAIL" id
|
, makeEnumOption graphics_shadow_size "SHADOW DETAIL" id
|
||||||
|
|||||||
+107
-117
@@ -104,23 +104,6 @@ doDrawing' win pdata u = do
|
|||||||
, (_shapeEBO pdata, nIndices)
|
, (_shapeEBO pdata, nIndices)
|
||||||
, (_silhouetteEBO pdata, nSilIndices)
|
, (_silhouetteEBO pdata, nSilIndices)
|
||||||
]
|
]
|
||||||
-- draw the overlay
|
|
||||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboOverlay ._1 . unFBO)
|
|
||||||
withArray [0, 0, 0, 0] $ \ptr ->
|
|
||||||
glClearNamedFramebufferfv
|
|
||||||
(pdata ^. fboOverlay . _1 . unFBO)
|
|
||||||
GL_COLOR
|
|
||||||
0
|
|
||||||
ptr
|
|
||||||
glDepthFunc GL_ALWAYS
|
|
||||||
glDepthMask GL_FALSE
|
|
||||||
glEnable GL_BLEND
|
|
||||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
|
||||||
setViewport _graphics_overlay_resolution cfig
|
|
||||||
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. matUBO)
|
|
||||||
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig))
|
|
||||||
$ \ptr -> glNamedBufferSubData (pdata ^. matUBO) 0 64 ptr
|
|
||||||
renderLayer FixedCoordLayer shadV layerCounts
|
|
||||||
-- set the coordinate uniform ready for drawing elements using world coordinates
|
-- set the coordinate uniform ready for drawing elements using world coordinates
|
||||||
withArray (perspectiveMatrixb rot camzoom trans wins viewFroms) $ \ptr ->
|
withArray (perspectiveMatrixb rot camzoom trans wins viewFroms) $ \ptr ->
|
||||||
glNamedBufferSubData (pdata ^. matUBO) 0 64 ptr
|
glNamedBufferSubData (pdata ^. matUBO) 0 64 ptr
|
||||||
@@ -247,100 +230,100 @@ doDrawing' win pdata u = do
|
|||||||
replicateM_ 2 $ pingPongBetween (_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
|
replicateM_ 2 $ pingPongBetween (_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
|
||||||
glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
setViewport _graphics_world_resolution cfig
|
setViewport _graphics_world_resolution cfig
|
||||||
-- --draw clouds onto cloud buffer
|
--draw clouds onto cloud buffer
|
||||||
-- glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
||||||
-- glDepthFunc GL_LEQUAL
|
glDepthFunc GL_LEQUAL
|
||||||
-- glDepthMask GL_FALSE
|
glDepthMask GL_FALSE
|
||||||
-- --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))
|
||||||
-- --glBlendFuncSeparate GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA GL_ONE GL_ONE_MINUS_SRC_ALPHA
|
--glBlendFuncSeparate GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA GL_ONE GL_ONE_MINUS_SRC_ALPHA
|
||||||
-- glBlendFuncSeparate GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_DST_ALPHA GL_ONE
|
glBlendFuncSeparate GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA GL_ONE_MINUS_DST_ALPHA GL_ONE
|
||||||
-- --glBlendFuncSeparate GL_SRC_ALPHA_SATURATE GL_ONE_MINUS_SRC_ALPHA GL_ONE GL_ONE_MINUS_SRC_ALPHA
|
--glBlendFuncSeparate GL_SRC_ALPHA_SATURATE GL_ONE_MINUS_SRC_ALPHA GL_ONE GL_ONE_MINUS_SRC_ALPHA
|
||||||
-- --glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
--glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
-- withArray [GL_COLOR_ATTACHMENT0, GL_NONE] $ \ptr -> glDrawBuffers 2 ptr
|
withArray [GL_COLOR_ATTACHMENT0, GL_NONE] $ \ptr -> glDrawBuffers 2 ptr
|
||||||
-- withArray [0.5, 0.5, 0.5, 0] $ \ptr ->
|
withArray [0.5, 0.5, 0.5, 0] $ \ptr ->
|
||||||
-- glClearNamedFramebufferfv
|
glClearNamedFramebufferfv
|
||||||
-- (pdata ^. fboCloud . _1 . unFBO)
|
(pdata ^. fboCloud . _1 . unFBO)
|
||||||
-- GL_COLOR
|
GL_COLOR
|
||||||
-- 0
|
0
|
||||||
-- ptr
|
ptr
|
||||||
-- -- renderLayer MidLayer shadV layerCounts
|
-- renderLayer MidLayer shadV layerCounts
|
||||||
-- glUseProgram (pdata ^. cloudShader . shaderUINT)
|
glUseProgram (pdata ^. cloudShader . shaderUINT)
|
||||||
-- glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
|
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
|
||||||
-- glDrawElements
|
glDrawElements
|
||||||
-- (pdata ^. cloudShader . shaderPrimitive . unPrimitiveMode)
|
(pdata ^. cloudShader . shaderPrimitive . unPrimitiveMode)
|
||||||
-- (fromIntegral nCloudIs)
|
(fromIntegral nCloudIs)
|
||||||
-- GL_UNSIGNED_SHORT
|
GL_UNSIGNED_SHORT
|
||||||
-- nullPtr
|
nullPtr
|
||||||
-- 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
|
||||||
-- glDepthMask GL_TRUE
|
glDepthMask GL_TRUE
|
||||||
-- glDepthFunc GL_ALWAYS
|
glDepthFunc GL_ALWAYS
|
||||||
-- glDisable GL_BLEND
|
glDisable GL_BLEND
|
||||||
-- withArray [GL_NONE, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $ \ptr -> glDrawBuffers 3 ptr
|
withArray [GL_NONE, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $ \ptr -> glDrawBuffers 3 ptr
|
||||||
-- withArray [0, 0, 0, 0] $ \ptr ->
|
withArray [0, 0, 0, 0] $ \ptr ->
|
||||||
-- glClearNamedFramebufferfv
|
glClearNamedFramebufferfv
|
||||||
-- (pdata ^. fboCloud . _1 . unFBO)
|
(pdata ^. fboCloud . _1 . unFBO)
|
||||||
-- GL_COLOR
|
GL_COLOR
|
||||||
-- 1
|
1
|
||||||
-- ptr
|
ptr
|
||||||
-- withArray [0, 0, 0, 0] $ \ptr ->
|
withArray [0, 0, 0, 0] $ \ptr ->
|
||||||
-- glClearNamedFramebufferfv
|
glClearNamedFramebufferfv
|
||||||
-- (pdata ^. fboCloud . _1 . unFBO)
|
(pdata ^. fboCloud . _1 . unFBO)
|
||||||
-- GL_COLOR
|
GL_COLOR
|
||||||
-- 2
|
2
|
||||||
-- ptr
|
ptr
|
||||||
-- glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
-- -- we sum the positions weighted by alpha, and sum the alpha
|
-- we sum the positions weighted by alpha, and sum the alpha
|
||||||
-- glBlendFuncSeparatei 1 GL_SRC_ALPHA GL_ONE GL_ONE GL_ONE
|
glBlendFuncSeparatei 1 GL_SRC_ALPHA GL_ONE GL_ONE GL_ONE
|
||||||
-- -- and sum the normals weighted by alpha
|
-- and sum the normals weighted by alpha
|
||||||
-- glBlendFunci 2 GL_SRC_ALPHA GL_ONE
|
glBlendFunci 2 GL_SRC_ALPHA GL_ONE
|
||||||
-- glUseProgram (pdata ^. cloudShader . shaderUINT)
|
glUseProgram (pdata ^. cloudShader . shaderUINT)
|
||||||
-- glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
|
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
|
||||||
-- glDepthMask GL_TRUE
|
glDepthMask GL_TRUE
|
||||||
-- glDrawElements
|
glDrawElements
|
||||||
-- (pdata ^. cloudShader . shaderPrimitive . unPrimitiveMode)
|
(pdata ^. cloudShader . shaderPrimitive . unPrimitiveMode)
|
||||||
-- (fromIntegral nCloudIs)
|
(fromIntegral nCloudIs)
|
||||||
-- GL_UNSIGNED_SHORT
|
GL_UNSIGNED_SHORT
|
||||||
-- nullPtr
|
nullPtr
|
||||||
-- drawShader (_windowShader pdata) nWins
|
drawShader (_windowShader pdata) nWins
|
||||||
-- 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] $ \ptr ->
|
||||||
-- glClearNamedFramebufferfv
|
glClearNamedFramebufferfv
|
||||||
-- (pdata ^. fboPos . _1 . unFBO)
|
(pdata ^. fboPos . _1 . unFBO)
|
||||||
-- GL_COLOR
|
GL_COLOR
|
||||||
-- 0
|
0
|
||||||
-- ptr
|
ptr
|
||||||
-- glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _2 . unTO)
|
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _2 . unTO)
|
||||||
-- glDepthMask GL_FALSE
|
glDepthMask GL_FALSE
|
||||||
-- drawShader (pdata ^. alphaDivideShader) 4
|
drawShader (pdata ^. alphaDivideShader) 4
|
||||||
-- ----draw lightmap for cloud buffer
|
----draw lightmap for cloud buffer
|
||||||
-- glDepthFunc GL_LESS
|
glDepthFunc GL_LESS
|
||||||
-- glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
-- glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
|
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
|
||||||
-- createLightMap
|
createLightMap
|
||||||
-- cfig
|
cfig
|
||||||
-- (fromIntegral trueNWalls)
|
(fromIntegral trueNWalls)
|
||||||
-- nSilIndices
|
nSilIndices
|
||||||
-- nIndices
|
nIndices
|
||||||
-- (pdata ^. fboPos . _2)
|
(pdata ^. fboPos . _2)
|
||||||
-- (pdata ^. fboCloud . _2 . _3)
|
(pdata ^. fboCloud . _2 . _3)
|
||||||
-- lightPoints
|
lightPoints
|
||||||
-- pdata
|
pdata
|
||||||
-- glInvalidateBufferData (pdata ^. vboShapes . vboName)
|
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
|
||||||
-- withArray [GL_COLOR_ATTACHMENT0, GL_NONE] $ \ptr -> glDrawBuffers 2 ptr
|
withArray [GL_COLOR_ATTACHMENT0, GL_NONE] $ \ptr -> glDrawBuffers 2 ptr
|
||||||
-- glDepthFunc GL_ALWAYS
|
glDepthFunc GL_ALWAYS
|
||||||
-- glBindTextureUnit 0 (_unTO . snd $ _fboLighting pdata)
|
glBindTextureUnit 0 (_unTO . snd $ _fboLighting pdata)
|
||||||
-- glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
-- glBlendFuncSeparate GL_ZERO GL_ONE_MINUS_SRC_COLOR GL_ZERO GL_ONE
|
glBlendFuncSeparate GL_ZERO GL_ONE_MINUS_SRC_COLOR GL_ZERO GL_ONE
|
||||||
-- drawShader (_fullscreenShader pdata) 4
|
drawShader (_fullscreenShader pdata) 4
|
||||||
-- glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
-- bind base buffer for drawing bloom then clouds
|
-- bind base buffer for drawing bloom then clouds
|
||||||
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
|
||||||
@@ -349,9 +332,9 @@ doDrawing' win pdata u = do
|
|||||||
glBindTextureUnit 0 (_unTO . snd $ _fboHalf1 pdata)
|
glBindTextureUnit 0 (_unTO . snd $ _fboHalf1 pdata)
|
||||||
drawShader (_fullscreenShader pdata) 4
|
drawShader (_fullscreenShader pdata) 4
|
||||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
-- --draw shadowed clouds onto base buffer
|
--draw shadowed clouds onto base buffer
|
||||||
-- glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _1 . unTO)
|
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _1 . unTO)
|
||||||
-- 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)
|
||||||
setViewport (const FullRes) cfig
|
setViewport (const FullRes) cfig
|
||||||
@@ -377,9 +360,16 @@ doDrawing' win pdata u = do
|
|||||||
bindings = zipWith (>>) (map bindFBO fboList) (map (glBindTextureUnit 1 . _unTO) toList)
|
bindings = zipWith (>>) (map bindFBO fboList) (map (glBindTextureUnit 1 . _unTO) toList)
|
||||||
zipWithM_ (>>) bindings $ map bindDrawDist rds
|
zipWithM_ (>>) bindings $ map bindDrawDist rds
|
||||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
--draw overlay onto base buffer
|
-- draw the overlay
|
||||||
glBindTextureUnit 0 (pdata ^. fboOverlay . _2 . unTO)
|
--glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboOverlay ._1 . unFBO)
|
||||||
drawShader (_fullscreenShader pdata) 4
|
glDepthFunc GL_ALWAYS
|
||||||
|
glDepthMask GL_FALSE
|
||||||
|
glEnable GL_BLEND
|
||||||
|
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
|
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. matUBO)
|
||||||
|
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig))
|
||||||
|
$ \ptr -> glNamedBufferSubData (pdata ^. matUBO) 0 64 ptr
|
||||||
|
renderLayer FixedCoordLayer shadV layerCounts
|
||||||
SDL.glSwapWindow win
|
SDL.glSwapWindow win
|
||||||
|
|
||||||
getDistortions :: Configuration -> World -> [Distortion]
|
getDistortions :: Configuration -> World -> [Distortion]
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ sizeFBOs cfig rdata =
|
|||||||
GL_RGBA16F
|
GL_RGBA16F
|
||||||
[fboBloom, fboPos]
|
[fboBloom, fboPos]
|
||||||
>>= foldUpdateFBOTO
|
>>= foldUpdateFBOTO
|
||||||
_graphics_overlay_resolution
|
_graphics_distortion_resolution
|
||||||
GL_LINEAR
|
GL_LINEAR
|
||||||
GL_NEAREST
|
GL_NEAREST
|
||||||
GL_RGBA8
|
GL_RGBA8
|
||||||
[fbo2, fbo3, fboOverlay]
|
[fbo2, fbo3]
|
||||||
>>= foldUpdateFBOTO
|
>>= foldUpdateFBOTO
|
||||||
_graphics_downsize_resolution
|
_graphics_downsize_resolution
|
||||||
GL_LINEAR_MIPMAP_LINEAR
|
GL_LINEAR_MIPMAP_LINEAR
|
||||||
|
|||||||
@@ -171,8 +171,6 @@ preloadRender = do
|
|||||||
|
|
||||||
fboShadowName <- setupShadowFramebuffer
|
fboShadowName <- setupShadowFramebuffer
|
||||||
|
|
||||||
fbooverlay <- newTextureFramebuffer
|
|
||||||
|
|
||||||
fboHalf1Name <- newTextureFramebuffer
|
fboHalf1Name <- newTextureFramebuffer
|
||||||
fboHalf2Name <- newTextureFramebuffer
|
fboHalf2Name <- newTextureFramebuffer
|
||||||
fboHalf3Name <- newTextureFramebuffer
|
fboHalf3Name <- newTextureFramebuffer
|
||||||
@@ -229,7 +227,6 @@ preloadRender = do
|
|||||||
, _fboCloud = fboCloudName
|
, _fboCloud = fboCloudName
|
||||||
, _fboBloom = fboBloomName
|
, _fboBloom = fboBloomName
|
||||||
, _fboPos = fboPosName
|
, _fboPos = fboPosName
|
||||||
, _fboOverlay = fbooverlay
|
|
||||||
, _rboBaseBloom = rboBaseBloomName
|
, _rboBaseBloom = rboBaseBloomName
|
||||||
, _matUBO = theUBO
|
, _matUBO = theUBO
|
||||||
, -- , _orthonormalMatUBO = orthonormalUBO
|
, -- , _orthonormalMatUBO = orthonormalUBO
|
||||||
|
|||||||
Reference in New Issue
Block a user