Provisional working coloured lights

This commit is contained in:
2021-08-21 12:34:49 +02:00
parent e35b95bf36
commit b396d6c857
9 changed files with 30 additions and 26 deletions
+5 -5
View File
@@ -25,7 +25,7 @@ sizeToTexSize (Size x y) = TextureSize2D x y
{- | Determine where light is shining in the world. -}
createLightMap
:: RenderData
-> [(Point3,Float,Float)] -- Lights
-> [(Point3,Float,Point3)] -- Lights
-> Int -- ^ number of walls
-> Int -- ^ number of silhoutte lines to draw
-> Int -- ^ number of surface triangles to draw
@@ -53,10 +53,10 @@ createLightMap pdata lightPoints nWalls nSils nsurfVs = do
-- draw fading lightmap circles on the floor
-- draw fading lightmaps on the walls
depthMask $= Disabled
blendFunc $= (Zero, OneMinusSrcAlpha)
blendFunc $= (Zero, OneMinusSrcColor)
stencilTest $= Enabled
depthFunc $= Just Lequal
flip VS.mapM_ (VS.fromList lightPoints) $ \(V3 x y z,r,lum) -> do
flip VS.mapM_ (VS.fromList lightPoints) $ \(V3 x y z,rad,V3 r g b) -> do
--forM_ lightPoints $ \(V3 x y z,r,lum) -> do
-- stencil out shadows
colorMask $= Color4 Disabled Disabled Disabled Disabled
@@ -89,14 +89,14 @@ createLightMap pdata lightPoints nWalls nSils nsurfVs = do
uniform (head $ _shaderCustomUnis $ _lightingSurfaceShader pdata)
$= Vector3 x y z
uniform (_shaderCustomUnis (_lightingSurfaceShader pdata) !! 1)
$= Vector2 r lum
$= Vector4 r g b rad
drawShader (_lightingSurfaceShader pdata) nsurfVs
-- draw wall light "circles"
currentProgram $= Just (_shaderProgram $ _lightingWallShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingWallShader pdata)
$= Vector3 x y z
uniform (_shaderCustomUnis (_lightingWallShader pdata) !! 1)
$= Vector2 r lum
$= Vector4 r g b rad
drawShader (_lightingWallShader pdata) nWalls
cullFace $= Nothing
stencilTest $= Disabled