Remove Maybe from custom unis

This commit is contained in:
2021-06-10 16:54:21 +02:00
parent 0b76062475
commit 79d2c73dcf
4 changed files with 18 additions and 26 deletions
+10 -11
View File
@@ -22,7 +22,6 @@ import Foreign hiding (rotate)
import Graphics.Rendering.OpenGL hiding (Line,translate,scale,imageHeight,Polygon,Color,T)
--import Data.Foldable
import Data.Tuple.Extra
import Data.Maybe (fromJust)
--import qualified Data.IntMap.Strict as IM
import qualified SDL
@@ -39,11 +38,11 @@ setWallDepth pdata wallPoints (viewFromx,viewFromy) pmat = do
bindShaderBuffers [_lightingOccludeShader pdata] [nWalls]
currentProgram $= Just (_shaderProgram $ _lightingOccludeShader pdata)
uniform (head $ fromJust $ _shaderCustomUnis $ _lightingOccludeShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingOccludeShader pdata)
$= Vector2 viewFromx viewFromy
uniform ( fromJust (_shaderCustomUnis $ _lightingOccludeShader pdata) !! 1)
uniform ( (_shaderCustomUnis $ _lightingOccludeShader pdata) !! 1)
$= pmat
uniform ( fromJust (_shaderCustomUnis $ _lightingOccludeShader pdata) !! 2)
uniform ( (_shaderCustomUnis $ _lightingOccludeShader pdata) !! 2)
$= (0 :: Float)
-- cullFace $= Just Front
drawShader (_lightingOccludeShader pdata) nWalls
@@ -82,7 +81,7 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat _
bindShaderBuffers [_lightingOccludeShader pdata] [nWalls]
-- set uniforms for shader that draws lights
currentProgram $= Just (_shaderProgram $ _lightingWallShader pdata)
uniform ( fromJust (_shaderCustomUnis $ _lightingWallShader pdata) !! 1)
uniform ( (_shaderCustomUnis $ _lightingWallShader pdata) !! 1)
$= pmat
-- clear buffer to full alpha and furthest depth
clearColor $= Color4 0 0 0 1
@@ -92,11 +91,11 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat _
-- draw walls from your point of view in order to set z buffer
colorMask $= Color4 Disabled Disabled Disabled Disabled
currentProgram $= Just (_shaderProgram $ _lightingOccludeShader pdata)
uniform (head $ fromJust $ _shaderCustomUnis $ _lightingOccludeShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingOccludeShader pdata)
$= Vector2 viewFromx viewFromy
uniform ( fromJust (_shaderCustomUnis $ _lightingOccludeShader pdata) !! 1)
uniform ( (_shaderCustomUnis $ _lightingOccludeShader pdata) !! 1)
$= pmat
uniform ( fromJust (_shaderCustomUnis $ _lightingOccludeShader pdata) !! 2)
uniform ( (_shaderCustomUnis $ _lightingOccludeShader pdata) !! 2)
$= (0 :: Float)
cullFace $= Just Back
drawShader (_lightingOccludeShader pdata) nWalls
@@ -127,7 +126,7 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat _
stencilOp $= (OpKeep,OpKeep,OpIncr)
stencilFunc $= (Always, 0, 255)
currentProgram $= Just (_shaderProgram $ _lightingOccludeShader pdata)
uniform (head $ fromJust $ _shaderCustomUnis $ _lightingOccludeShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingOccludeShader pdata)
$= Vector2 x y
drawShader (_lightingOccludeShader pdata) nWalls
cullFace $= Just Front
@@ -141,9 +140,9 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat _
drawShader (_lightingFloorShader pdata) 1
-- draw wall light "circles"
currentProgram $= Just (_shaderProgram $ _lightingWallShader pdata)
uniform (head $ fromJust $ _shaderCustomUnis $ _lightingWallShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingWallShader pdata)
$= Vector2 x y
uniform (fromJust (_shaderCustomUnis $ _lightingWallShader pdata) !! 2)
uniform ((_shaderCustomUnis $ _lightingWallShader pdata) !! 2)
$= Vector2 r lum
drawShader (_lightingWallShader pdata) nWallLights
cullFace $= Nothing