Start to create wallFace shader
This commit is contained in:
+29
-13
@@ -31,19 +31,8 @@ import qualified Data.IntMap.Strict as IM
|
|||||||
|
|
||||||
import qualified SDL as SDL
|
import qualified SDL as SDL
|
||||||
|
|
||||||
renderPicture' :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
|
setCommonUniforms :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) -> IO ()
|
||||||
[(Point2,Point2)] -> [Point4] ->
|
setCommonUniforms pdata rot zoom (tranx,trany) (winx,winy) = do
|
||||||
(Float,Float) -> Picture -> IO (Word32,Word32)
|
|
||||||
renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints
|
|
||||||
(viewFromx,viewFromy) pic = do
|
|
||||||
wallPokeStart <- SDL.ticks
|
|
||||||
|
|
||||||
-- setting the depth function to less, instead of lequal,
|
|
||||||
-- seems to stop a lot of unecessary drawing
|
|
||||||
-- of wall shadows when creating the light map
|
|
||||||
depthFunc $= Just Less
|
|
||||||
|
|
||||||
-- set common uniforms
|
|
||||||
setShaderUniforms rot zoom (tranx,trany) (winx,winy)
|
setShaderUniforms rot zoom (tranx,trany) (winx,winy)
|
||||||
( (extractProgAndUnis $ _lightSourceShader pdata)
|
( (extractProgAndUnis $ _lightSourceShader pdata)
|
||||||
: (extractProgAndUnis $ _wallShadowShader pdata)
|
: (extractProgAndUnis $ _wallShadowShader pdata)
|
||||||
@@ -52,6 +41,33 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints
|
|||||||
: (map extractProgAndUnis $ _listShaders pdata)
|
: (map extractProgAndUnis $ _listShaders pdata)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
createLightMap :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
|
||||||
|
[(Point2,Point2)] -> [Point4] ->
|
||||||
|
(Float,Float) -> Picture -> IO ()
|
||||||
|
createLightMap pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints
|
||||||
|
(viewFromx,viewFromy) pic = do
|
||||||
|
return ()
|
||||||
|
|
||||||
|
renderPicture' :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
|
||||||
|
[(Point2,Point2)] -> [Point4] ->
|
||||||
|
(Float,Float) -> Picture -> IO (Word32,Word32)
|
||||||
|
renderPicture' pdata rot zoom trans wins wallPoints lightPoints
|
||||||
|
viewFroms pic = do
|
||||||
|
setCommonUniforms pdata rot zoom trans wins
|
||||||
|
renderPicture pdata rot zoom trans wins wallPoints lightPoints viewFroms pic
|
||||||
|
|
||||||
|
renderPicture :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
|
||||||
|
[(Point2,Point2)] -> [Point4] ->
|
||||||
|
(Float,Float) -> Picture -> IO (Word32,Word32)
|
||||||
|
renderPicture pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints
|
||||||
|
(viewFromx,viewFromy) pic = do
|
||||||
|
wallPokeStart <- SDL.ticks
|
||||||
|
|
||||||
|
-- setting the depth function to less, instead of lequal,
|
||||||
|
-- seems to stop a lot of unecessary drawing
|
||||||
|
-- of wall shadows when creating the light map
|
||||||
|
depthFunc $= Just Less
|
||||||
|
|
||||||
-- draw lightmap
|
-- draw lightmap
|
||||||
|
|
||||||
bindFramebuffer Framebuffer $= (_spareFBO pdata)
|
bindFramebuffer Framebuffer $= (_spareFBO pdata)
|
||||||
|
|||||||
Reference in New Issue
Block a user