Hlint pass
This commit is contained in:
+16
-45
@@ -7,10 +7,10 @@ import Shader.Poke
|
||||
import Data.Preload.Render
|
||||
import Picture.Data
|
||||
--import Picture.Tree
|
||||
import Geometry
|
||||
--import Geometry
|
||||
import Geometry.Data
|
||||
import Polyhedra.Data
|
||||
import Polyhedra
|
||||
--import Polyhedra.Data
|
||||
--import Polyhedra
|
||||
|
||||
--import Control.Lens
|
||||
import Control.Monad
|
||||
@@ -31,59 +31,35 @@ sizeToTexSize (Size x y) = TextureSize2D x y
|
||||
{- | Determine where light is shining in the world. -}
|
||||
createLightMap
|
||||
:: RenderData
|
||||
-> Int -- Resolution division
|
||||
-> [(Point3,Float,Float)] -- Lights
|
||||
-> [Polyhedra] -- foreground geometry
|
||||
-> [Point2] -- ^ screen polygon
|
||||
-> Int -- ^ number of walls
|
||||
-> Int -- ^ number of silhoutte lines to draw
|
||||
-> Int -- ^ number of surface triangles to draw
|
||||
-> IO ()
|
||||
createLightMap pdata resDiv lightPoints fpics scPol nWalls = do
|
||||
createLightMap pdata lightPoints nWalls nSils nsurfVs = do
|
||||
depthFunc $= Just Less
|
||||
-- get viewport size so we can reset it later
|
||||
(vppos,vpsize) <- get viewport
|
||||
-- set the viewport size to desired fidelity
|
||||
let vsize = divideSize resDiv vpsize
|
||||
viewport $= (vppos, vsize)
|
||||
textureBinding Texture2D $= Just (snd $ _fboLighting pdata)
|
||||
-- store foreground silhouette geometry into buffer
|
||||
nSils <- F.foldM (pokeShader $ _lightingLineShadowShader pdata) (concatMap polyToRender fpics)
|
||||
bindShaderBuffers [_lightingLineShadowShader pdata] [nSils]
|
||||
-- store foreground geometry and floor into buffer
|
||||
let addC (xx,yy) = (xx,yy,0)
|
||||
nsurfVs <- F.foldM (pokeShader (_lightingSurfaceShader pdata))
|
||||
$ [Render3 $ polyToTris $ map addC $ scPol ]
|
||||
++ concatMap polyToGeoRender (fpics)
|
||||
bindShaderBuffers [_lightingSurfaceShader pdata] [nsurfVs]
|
||||
-- clear buffer to full alpha and furthest depth
|
||||
-- clearColor is specified in preloadRender
|
||||
clearColor $= Color4 0 0 0 1
|
||||
clear [ColorBuffer,DepthBuffer]
|
||||
--colorMask $= Color4 Disabled Disabled Disabled Disabled
|
||||
cullFace $= Just Back
|
||||
-- draw walls from your point of view in order to set z buffer
|
||||
currentProgram $= Just (_shaderProgram $ _lightingWallShader pdata)
|
||||
--drawShader (_lightingWallShader pdata) nWallLights
|
||||
drawShader (_lightingWallShader pdata) nWalls
|
||||
--colorMask $= Color4 Disabled Disabled Disabled Disabled
|
||||
--currentProgram $= Just (_shaderProgram $ _lightingOccludeShader pdata)
|
||||
--uniform (head $ _shaderCustomUnis $ _lightingOccludeShader pdata)
|
||||
-- $= Vector2 viewFromx viewFromy
|
||||
--drawShader (_lightingOccludeShader pdata) nWalls
|
||||
---- draw foreground elements to set z buffer
|
||||
currentProgram $= Just (_shaderProgram $ _lightingSurfaceShader pdata)
|
||||
---- draw foreground elements to set z buffer
|
||||
drawShader (_lightingSurfaceShader pdata) nsurfVs
|
||||
-- for each of the lights:
|
||||
-- stencil out the walls from this light's point of view
|
||||
-- draw fading lightmap circles on the floor
|
||||
-- draw fading lightmaps on the walls
|
||||
--cullFace $= Nothing
|
||||
-- for each of the lights:
|
||||
-- stencil out the walls from this light's point of view
|
||||
-- draw fading lightmap circles on the floor
|
||||
-- draw fading lightmaps on the walls
|
||||
depthMask $= Disabled
|
||||
blendFunc $= (Zero, OneMinusSrcAlpha)
|
||||
stencilTest $= Enabled
|
||||
--depthFunc $= Just Less
|
||||
depthFunc $= Just Lequal
|
||||
forM_ lightPoints $ \((x,y,z),r,lum) -> do
|
||||
-- stencil out shadows
|
||||
--depthFunc $= Just Less
|
||||
depthFunc $= Just Lequal
|
||||
--depthFunc $= Just Lequal
|
||||
colorMask $= Color4 Disabled Disabled Disabled Disabled
|
||||
clear [StencilBuffer]
|
||||
cullFace $= Just Back
|
||||
@@ -93,7 +69,6 @@ createLightMap pdata resDiv lightPoints fpics scPol nWalls = do
|
||||
uniform (head $ _shaderCustomUnis $ _lightingOccludeShader pdata)
|
||||
$= Vector3 x y z
|
||||
drawShader (_lightingOccludeShader pdata) nWalls
|
||||
--cullFace $= Nothing
|
||||
currentProgram $= Just (_shaderProgram $ _lightingLineShadowShader pdata)
|
||||
uniform (head $ _shaderCustomUnis $ _lightingLineShadowShader pdata)
|
||||
$= Vector3 x y z
|
||||
@@ -106,7 +81,7 @@ createLightMap pdata resDiv lightPoints fpics scPol nWalls = do
|
||||
|
||||
currentProgram $= Just (_shaderProgram $ _lightingLineShadowShader pdata)
|
||||
drawShader (_lightingLineShadowShader pdata) nSils
|
||||
depthFunc $= Just Lequal
|
||||
--depthFunc $= Just Lequal
|
||||
-- draw geometry surfaces
|
||||
cullFace $= Just Back
|
||||
colorMask $= Color4 Disabled Disabled Disabled Enabled
|
||||
@@ -118,7 +93,6 @@ createLightMap pdata resDiv lightPoints fpics scPol nWalls = do
|
||||
$= Vector2 r lum
|
||||
drawShader (_lightingSurfaceShader pdata) nsurfVs
|
||||
-- draw wall light "circles"
|
||||
--cullFace $= Nothing
|
||||
currentProgram $= Just (_shaderProgram $ _lightingWallShader pdata)
|
||||
uniform (head $ _shaderCustomUnis $ _lightingWallShader pdata)
|
||||
$= Vector3 x y z
|
||||
@@ -127,10 +101,7 @@ createLightMap pdata resDiv lightPoints fpics scPol nWalls = do
|
||||
drawShader (_lightingWallShader pdata) nWalls
|
||||
cullFace $= Nothing
|
||||
stencilTest $= Disabled
|
||||
blend $= Disabled
|
||||
-- set the viewport size to that of the window
|
||||
viewport $= (vppos, vpsize)
|
||||
-- disable depth testing for blurring
|
||||
--blend $= Disabled
|
||||
{- |
|
||||
Blur between two framebuffers.
|
||||
Assumes no depth testing is done
|
||||
|
||||
Reference in New Issue
Block a user