Fix bug involving number of foreground vertices rendered
This commit is contained in:
+2
-8
@@ -61,17 +61,11 @@ doDrawing pdata w = do
|
|||||||
-- set the coordinate uniform ready for drawing elements using world coordinates
|
-- set the coordinate uniform ready for drawing elements using world coordinates
|
||||||
bufferUBO $ perspectiveMatrixb rot camzoom trans wins viewFroms
|
bufferUBO $ perspectiveMatrixb rot camzoom trans wins viewFroms
|
||||||
|
|
||||||
-- store floor position into buffer
|
|
||||||
let addC (xx,yy) = (xx,yy,0)
|
|
||||||
nsurfVs <- F.foldM (pokeShader (_lightingSurfaceShader pdata))
|
|
||||||
$ [Render3 $ polyToTris $ map addC $ screenPolygon w ]
|
|
||||||
++ concatMap polyToGeoRender (foregroundPics w)
|
|
||||||
bindShaderBuffers [_lightingSurfaceShader pdata] [nsurfVs]
|
|
||||||
|
|
||||||
depthFunc $= Just Less
|
depthFunc $= Just Less
|
||||||
|
let scPol = screenPolygon w
|
||||||
-- draw the lightmap. Probably changes the bound framebufferObject
|
-- draw the lightmap. Probably changes the bound framebufferObject
|
||||||
createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms
|
createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms
|
||||||
(foregroundPics w)
|
(foregroundPics w) scPol
|
||||||
clear [DepthBuffer]
|
clear [DepthBuffer]
|
||||||
depthFunc $= Just Less
|
depthFunc $= Just Less
|
||||||
-- set blending to depend upon the alpha level already present
|
-- set blending to depend upon the alpha level already present
|
||||||
|
|||||||
+13
-4
@@ -7,7 +7,7 @@ import Shader.Poke
|
|||||||
import Data.Preload.Render
|
import Data.Preload.Render
|
||||||
import Picture.Data
|
import Picture.Data
|
||||||
--import Picture.Tree
|
--import Picture.Tree
|
||||||
--import Geometry
|
import Geometry
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
import Polyhedra.Data
|
import Polyhedra.Data
|
||||||
import Polyhedra
|
import Polyhedra
|
||||||
@@ -57,8 +57,9 @@ createLightMap
|
|||||||
-> [(Point3,Float,Float)] -- Lights
|
-> [(Point3,Float,Float)] -- Lights
|
||||||
-> (Float,Float) -- View from position
|
-> (Float,Float) -- View from position
|
||||||
-> [Polyhedra] -- foreground geometry
|
-> [Polyhedra] -- foreground geometry
|
||||||
|
-> [Point2]
|
||||||
-> IO ()
|
-> IO ()
|
||||||
createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) fpics = do
|
createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) fpics scPol = do
|
||||||
-- get viewport size so we can reset it later
|
-- get viewport size so we can reset it later
|
||||||
(vppos,vpsize) <- get viewport
|
(vppos,vpsize) <- get viewport
|
||||||
-- set the viewport size to that of the render buffer
|
-- set the viewport size to that of the render buffer
|
||||||
@@ -75,6 +76,14 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) fpics =
|
|||||||
nSils <- F.foldM (pokeShader $ _lightingLineShadowShader pdata) (concatMap polyToRender fpics)
|
nSils <- F.foldM (pokeShader $ _lightingLineShadowShader pdata) (concatMap polyToRender fpics)
|
||||||
bindShaderBuffers [_lightingLineShadowShader pdata] [nSils]
|
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
|
-- clear buffer to full alpha and furthest depth
|
||||||
-- clearColor is specified in preloadRender
|
-- clearColor is specified in preloadRender
|
||||||
clear [ColorBuffer,DepthBuffer]
|
clear [ColorBuffer,DepthBuffer]
|
||||||
@@ -91,7 +100,7 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) fpics =
|
|||||||
---- draw foreground elements to set z buffer
|
---- draw foreground elements to set z buffer
|
||||||
--_ <- renderFoldable pdata $ picToLTree (Just 0) (polysToPic fpics)
|
--_ <- renderFoldable pdata $ picToLTree (Just 0) (polysToPic fpics)
|
||||||
currentProgram $= Just (_shaderProgram $ _lightingSurfaceShader pdata)
|
currentProgram $= Just (_shaderProgram $ _lightingSurfaceShader pdata)
|
||||||
drawShader (_lightingSurfaceShader pdata) nWallLights
|
drawShader (_lightingSurfaceShader pdata) nsurfVs
|
||||||
|
|
||||||
-- for each of the lights:
|
-- for each of the lights:
|
||||||
-- stencil out the walls from this light's point of view
|
-- stencil out the walls from this light's point of view
|
||||||
@@ -138,7 +147,7 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) fpics =
|
|||||||
$= Vector3 x y z
|
$= Vector3 x y z
|
||||||
uniform (_shaderCustomUnis (_lightingSurfaceShader pdata) !! 1)
|
uniform (_shaderCustomUnis (_lightingSurfaceShader pdata) !! 1)
|
||||||
$= Vector2 r lum
|
$= Vector2 r lum
|
||||||
drawShader (_lightingSurfaceShader pdata) nWallLights
|
drawShader (_lightingSurfaceShader pdata) nsurfVs
|
||||||
|
|
||||||
-- draw wall light "circles"
|
-- draw wall light "circles"
|
||||||
currentProgram $= Just (_shaderProgram $ _lightingWallShader pdata)
|
currentProgram $= Just (_shaderProgram $ _lightingWallShader pdata)
|
||||||
|
|||||||
Reference in New Issue
Block a user