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
+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