Add graphics option to hide object shadows

This commit is contained in:
2022-04-25 23:53:33 +01:00
parent fa8d8b5899
commit cbef0a37f6
4 changed files with 35 additions and 26 deletions
+2
View File
@@ -11,6 +11,7 @@ data Configuration = Configuration
, _volume_music :: Float
, _graphics_wall_textured :: Bool
, _graphics_cloud_shadows :: Bool
, _graphics_object_shadows :: Bool
, _graphics_resolution_factor :: ResFactor
, _windowX :: Float
, _windowY :: Float
@@ -58,6 +59,7 @@ defaultConfig = Configuration
, _volume_music = 1
, _graphics_wall_textured = True
, _graphics_cloud_shadows = True
, _graphics_object_shadows = True
, _graphics_resolution_factor = FullRes
, _windowX = 800
, _windowY = 600
+2 -1
View File
@@ -134,7 +134,8 @@ graphicsMenuOptions :: [MenuOption]
graphicsMenuOptions =
[ makeEnumOption ScancodeS graphics_resolution_factor "RESOLUTION" updateFramebufferSize
, makeBoolOption ScancodeW graphics_wall_textured "WALL TEXTURES"
, makeBoolOption ScancodeD graphics_cloud_shadows "CLOUD SHADOWS"
, makeBoolOption ScancodeO graphics_object_shadows "OBJECT SHADOWS"
, makeBoolOption ScancodeC graphics_cloud_shadows "CLOUD SHADOWS"
]
gameOverMenu :: ScreenLayer
+6 -2
View File
@@ -131,7 +131,9 @@ doDrawing pdata u = do
drawShader (_textureArrayShader pdata) nFls
--draw lightmap into its own buffer
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSilIndices nIndices (snd $ snd $ _fboBase pdata)
createLightMap pdata lightPoints nWalls nSilIndices nIndices
(_graphics_object_shadows $ _config u)
(snd $ snd $ _fboBase pdata)
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
--apply lightmap to base buffer
@@ -185,7 +187,9 @@ doDrawing pdata u = do
depthMask $= Disabled
blend $= Enabled
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSilIndices nIndices (snd $ snd $ _fboCloud pdata)
createLightMap pdata lightPoints nWalls nSilIndices nIndices
(_graphics_object_shadows $ _config u)
(snd $ snd $ _fboCloud pdata)
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
--apply lightmap to cloud buffer
+25 -23
View File
@@ -32,9 +32,10 @@ createLightMap
-> Int -- ^ number of walls
-> Int -- ^ number of silhoutte lines to draw
-> Int -- ^ number of "caps" to attempt to draw
-> Bool -- ^ whether to draw object shadows or not
-> TextureObject -- ^ the texture object giving positions
-> IO ()
createLightMap pdata lightPoints nWalls nSils nCaps toPos = do
createLightMap pdata lightPoints nWalls nSils nCaps drawObjShads toPos = do
let llsShad = _lightingLineShadowShader pdata
let lcShad = _lightingCapShader pdata
let lwShad = _lightingWallShadShader pdata
@@ -69,28 +70,29 @@ createLightMap pdata lightPoints nWalls nSils nCaps toPos = do
(marshalEPrimitiveMode $ _shadPrim lwShad)
0
(fromIntegral nWalls)
--drawShader lwShad nWalls
--draw silhouette shadows
currentProgram $= Just (_shadProg llsShad)
uniform (head $ _shadUnis $ _lightingLineShadowShader pdata)
$= Vector3 x y z
bindVertexArrayObject $= Just (_vao $ _shadVAO llsShad)
glDrawElements
(marshalEPrimitiveMode $ _shadPrim llsShad)
(fromIntegral nSils)
GL_UNSIGNED_SHORT
nullPtr
cullFace $= Just Back
--draw caps on the near plane as required
currentProgram $= Just (_shadProg lcShad)
uniform (head $ _shadUnis lcShad)
$= Vector3 x y z
bindVertexArrayObject $= Just (_vao $ _shadVAO lcShad)
glDrawElements
(marshalEPrimitiveMode $ _shadPrim lcShad)
(fromIntegral nCaps)
GL_UNSIGNED_SHORT
nullPtr
if drawObjShads then do
--draw silhouette shadows
currentProgram $= Just (_shadProg llsShad)
uniform (head $ _shadUnis $ _lightingLineShadowShader pdata)
$= Vector3 x y z
bindVertexArrayObject $= Just (_vao $ _shadVAO llsShad)
glDrawElements
(marshalEPrimitiveMode $ _shadPrim llsShad)
(fromIntegral nSils)
GL_UNSIGNED_SHORT
nullPtr
cullFace $= Just Back
--draw caps on the near plane as required
currentProgram $= Just (_shadProg lcShad)
uniform (head $ _shadUnis lcShad)
$= Vector3 x y z
bindVertexArrayObject $= Just (_vao $ _shadVAO lcShad)
glDrawElements
(marshalEPrimitiveMode $ _shadPrim lcShad)
(fromIntegral nCaps)
GL_UNSIGNED_SHORT
nullPtr
else return ()
--draw lightmap itself
depthFunc $= Just Always
-- bind world position texture