Unify matrix uniform assignment, move towards uniform block
This commit is contained in:
+9
-14
@@ -21,7 +21,7 @@ import Picture.Tree
|
||||
import Shader
|
||||
import Shader.Data
|
||||
import Shader.Poke
|
||||
import MatrixHelper
|
||||
--import MatrixHelper
|
||||
|
||||
import Foreign (Word32)
|
||||
--import Control.Applicative
|
||||
@@ -59,10 +59,8 @@ doDrawing pdata w = do
|
||||
--setIsoMatrixUniforms pdata rot camzoom trans wins
|
||||
setPerpMatrixUniforms pdata rot camzoom trans wins viewFroms
|
||||
depthFunc $= Just Less
|
||||
pmat <- (newMatrix RowMajor $ perspectiveMatrix rot camzoom trans wins viewFroms)
|
||||
:: IO (GLmatrix GLfloat)
|
||||
-- draw the lightmap. Probably changes the bound framebufferObject
|
||||
createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms pmat
|
||||
createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms
|
||||
(foregroundPics w)
|
||||
|
||||
-- -- set the coordinate uniforms ready for drawing elements using world coordinates
|
||||
@@ -78,11 +76,11 @@ doDrawing pdata w = do
|
||||
-- draw the walls
|
||||
depthFunc $= Just Less
|
||||
if w ^. config . wall_textured
|
||||
then renderTextureWalls pdata wallPointsCol pmat
|
||||
else renderBlankWalls pdata wallPointsCol pmat
|
||||
then renderTextureWalls pdata wallPointsCol
|
||||
else renderBlankWalls pdata wallPointsCol
|
||||
-- I believe a more apt name would be setCeilingDepth: stops drawing of objects
|
||||
-- at points that are behind the extension of walls to the screen edge
|
||||
_ <- setWallDepth pdata wallPoints (viewFromx,viewFromy) pmat
|
||||
_ <- setWallDepth pdata wallPoints (viewFromx,viewFromy)
|
||||
-- draw the first layer of pictures
|
||||
-- these will probably all be opaque
|
||||
_ <- renderFoldable pdata $ picToLTree (Just 0) pic
|
||||
@@ -99,7 +97,7 @@ doDrawing pdata w = do
|
||||
depthMask $= Disabled
|
||||
-- render transparent walls
|
||||
-- the ordering between these and transparent clouds perhaps presents a challenge
|
||||
renderBlankWalls pdata windowPoints pmat
|
||||
renderBlankWalls pdata windowPoints
|
||||
|
||||
depthMask $= Enabled
|
||||
forM_ (_pictureShaders pdata) $ setPerpMatUniform rot camzoom trans wins viewFroms
|
||||
@@ -138,13 +136,12 @@ doDrawing pdata w = do
|
||||
renderBlankWalls
|
||||
:: RenderData
|
||||
-> [((Point2,Point2),Point4)] -- ^ List: wall positions and color
|
||||
-> GLmatrix GLfloat
|
||||
-- -> GLmatrix GLfloat
|
||||
-> IO ()
|
||||
renderBlankWalls pdata wps pmat = do
|
||||
renderBlankWalls pdata wps = do
|
||||
n <- F.foldM (pokeShader $ _wallBlankShader pdata) (map Render22x4 wps)
|
||||
bindShaderBuffers [_wallBlankShader pdata] [n]
|
||||
currentProgram $= Just (_shaderProgram $ _wallBlankShader pdata)
|
||||
uniform (_shaderMatrixUniform $ _wallBlankShader pdata) $= pmat
|
||||
cullFace $= Just Back
|
||||
drawShader (_wallBlankShader pdata) n
|
||||
cullFace $= Nothing
|
||||
@@ -152,13 +149,11 @@ renderBlankWalls pdata wps pmat = do
|
||||
renderTextureWalls
|
||||
:: RenderData
|
||||
-> [((Point2,Point2),Point4)] -- ^ List: wall positions and color
|
||||
-> GLmatrix GLfloat
|
||||
-> IO ()
|
||||
renderTextureWalls pdata wps pmat = do
|
||||
renderTextureWalls pdata wps = do
|
||||
n <- F.foldM (pokeShader $ _wallTextureShader pdata) (map Render22x4 wps)
|
||||
bindShaderBuffers [_wallTextureShader pdata] [n]
|
||||
currentProgram $= Just (_shaderProgram $ _wallTextureShader pdata)
|
||||
uniform (_shaderMatrixUniform $ _wallTextureShader pdata) $= pmat
|
||||
cullFace $= Just Back
|
||||
drawShader (_wallTextureShader pdata) n
|
||||
cullFace $= Nothing
|
||||
|
||||
Reference in New Issue
Block a user