Cleanup rendering
This commit is contained in:
@@ -39,6 +39,8 @@ data Configuration = Configuration
|
|||||||
, _volume_sound :: Float
|
, _volume_sound :: Float
|
||||||
, _volume_music :: Float
|
, _volume_music :: Float
|
||||||
, _graphics_cloud_shadows :: Bool
|
, _graphics_cloud_shadows :: Bool
|
||||||
|
, _graphics_distortions :: Bool
|
||||||
|
, _graphics_bloom :: Bool
|
||||||
, _graphics_object_shadows :: ShadowRendering
|
, _graphics_object_shadows :: ShadowRendering
|
||||||
, _graphics_resolution_factor :: ResFactor
|
, _graphics_resolution_factor :: ResFactor
|
||||||
, _graphics_num_shadow_casters :: NumShadowCasters
|
, _graphics_num_shadow_casters :: NumShadowCasters
|
||||||
@@ -108,7 +110,9 @@ defaultConfig =
|
|||||||
, _volume_sound = 1
|
, _volume_sound = 1
|
||||||
, _volume_music = 0
|
, _volume_music = 0
|
||||||
, _graphics_cloud_shadows = True
|
, _graphics_cloud_shadows = True
|
||||||
|
, _graphics_bloom = True
|
||||||
, _graphics_object_shadows = GeoObjShads
|
, _graphics_object_shadows = GeoObjShads
|
||||||
|
, _graphics_distortions = True
|
||||||
, _graphics_resolution_factor = QuarterRes
|
, _graphics_resolution_factor = QuarterRes
|
||||||
, _graphics_num_shadow_casters = toEnum 10
|
, _graphics_num_shadow_casters = toEnum 10
|
||||||
, _windowX = 800
|
, _windowX = 800
|
||||||
|
|||||||
+4
-2
@@ -183,9 +183,11 @@ graphicsMenu = titleOptionsMenu "OPTIONS:GRAPHICS" graphicsMenuOptions
|
|||||||
graphicsMenuOptions :: [MenuOption]
|
graphicsMenuOptions :: [MenuOption]
|
||||||
graphicsMenuOptions =
|
graphicsMenuOptions =
|
||||||
[ makeEnumOption graphics_resolution_factor "RESOLUTION" (uvIOEffects .~ updateFramebufferSize)
|
[ makeEnumOption graphics_resolution_factor "RESOLUTION" (uvIOEffects .~ updateFramebufferSize)
|
||||||
, makeEnumOption graphics_object_shadows "OBJECT SHADOWS" id
|
, makeEnumOption graphics_object_shadows "SHADOW DETAIL" id
|
||||||
|
, makeEnumOption graphics_distortions "ENABLE DISTORTIONS" id
|
||||||
|
, makeEnumOption graphics_bloom "ENABLE BLOOM" id
|
||||||
, makeBoolOption graphics_cloud_shadows "CLOUD SHADOWS"
|
, makeBoolOption graphics_cloud_shadows "CLOUD SHADOWS"
|
||||||
, makeEnumOption graphics_num_shadow_casters "SHADOW CASTERS" id
|
, makeEnumOption graphics_num_shadow_casters "NUM SHADOW CASTERS" id
|
||||||
]
|
]
|
||||||
|
|
||||||
gameOverMenu :: Universe -> ScreenLayer
|
gameOverMenu :: Universe -> ScreenLayer
|
||||||
|
|||||||
+7
-15
@@ -337,7 +337,7 @@ doDrawing' win pdata u = do
|
|||||||
glBlendFunc GL_ONE GL_ZERO
|
glBlendFunc GL_ONE GL_ZERO
|
||||||
-- perform any radial distortion
|
-- perform any radial distortion
|
||||||
-- this is hideous
|
-- this is hideous
|
||||||
case w ^. cWorld . lWorld . distortions of
|
case getDistortions cfig w of
|
||||||
[] -> do
|
[] -> do
|
||||||
glBindTextureUnit 0 $ pdata ^. fboBase . _2 . _1 . unTO
|
glBindTextureUnit 0 $ pdata ^. fboBase . _2 . _1 . unTO
|
||||||
glBindFramebuffer GL_FRAMEBUFFER 0
|
glBindFramebuffer GL_FRAMEBUFFER 0
|
||||||
@@ -355,27 +355,19 @@ 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
|
||||||
glDepthFunc GL_ALWAYS
|
glDepthFunc GL_ALWAYS
|
||||||
|
glDepthMask GL_FALSE
|
||||||
glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
renderLayer DebugLayer shadV layerCounts
|
renderLayer DebugLayer shadV layerCounts
|
||||||
-- draw overlay
|
-- draw overlay
|
||||||
glDepthFunc GL_ALWAYS
|
|
||||||
glDepthMask GL_FALSE
|
|
||||||
glEnable GL_BLEND
|
|
||||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
|
||||||
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. orthonormalMatUBO)
|
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. orthonormalMatUBO)
|
||||||
renderLayer FixedCoordLayer shadV layerCounts
|
renderLayer FixedCoordLayer shadV layerCounts
|
||||||
glDepthMask GL_TRUE
|
|
||||||
SDL.glSwapWindow win
|
SDL.glSwapWindow win
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
getDistortions :: Configuration -> World -> [Distortion]
|
||||||
-- note: currently assume there is only one UBO, we only bind it once at setup
|
getDistortions cfig w
|
||||||
--bufferUBO :: GLuint -> [Float] -> IO ()
|
| cfig ^. graphics_distortions = w ^. cWorld . lWorld . distortions
|
||||||
--bufferUBO ubo mat = withArray mat $ \ptr ->
|
| otherwise = []
|
||||||
-- glNamedBufferSubData ubo 0 64 ptr
|
|
||||||
|
|
||||||
setViewportSize :: Int -> Int -> IO ()
|
setViewportSize :: Int -> Int -> IO ()
|
||||||
setViewportSize x y =
|
setViewportSize x y = glViewport 0 0 (fromIntegral x) (fromIntegral y)
|
||||||
glViewport 0 0 (fromIntegral x) (fromIntegral y)
|
|
||||||
|
|
||||||
--cullFace $= Nothing
|
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
|||||||
nullPtr
|
nullPtr
|
||||||
--draw caps on the near plane as required
|
--draw caps on the near plane as required
|
||||||
glEnable GL_CULL_FACE
|
glEnable GL_CULL_FACE
|
||||||
glCullFace GL_BACK
|
|
||||||
glCullFace GL_FRONT
|
glCullFace GL_FRONT
|
||||||
glUseProgram (_shaderUINT lcapShad)
|
glUseProgram (_shaderUINT lcapShad)
|
||||||
glUniform3f 0 x y z
|
glUniform3f 0 x y z
|
||||||
|
|||||||
Reference in New Issue
Block a user