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