Replace explicit matrix uniforms with single ubo

This commit is contained in:
jgk
2021-06-24 17:58:15 +02:00
parent 7ab932db93
commit 97598bc171
26 changed files with 39 additions and 174 deletions
+1 -8
View File
@@ -56,6 +56,7 @@ doDrawing pdata w = do
pic = worldPictures w
wallPoints = map fst wallPointsCol
-- set the coordinate uniform ready for drawing elements using world coordinates
let pmat = perspectiveMatrixb rot camzoom trans wins viewFroms
withArray pmat $ \ptr ->
bufferData UniformBuffer $=
@@ -64,9 +65,6 @@ doDrawing pdata w = do
,StreamDraw
)
-- set the coordinate uniforms ready for drawing elements using world coordinates
--setIsoMatrixUniforms pdata rot camzoom trans wins
setPerpMatrixUniforms pdata rot camzoom trans wins viewFroms
depthFunc $= Just Less
-- draw the lightmap. Probably changes the bound framebufferObject
createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms
@@ -109,7 +107,6 @@ doDrawing pdata w = do
renderBlankWalls pdata windowPoints
depthMask $= Enabled
forM_ (_pictureShaders pdata) $ setPerpMatUniform rot camzoom trans wins viewFroms
depthFunc $= Just Lequal
_ <- renderFoldable pdata $ picToLTree (Just 0) (foregroundPics w)
@@ -132,10 +129,6 @@ doDrawing pdata w = do
drawShader (_grayscaleShader pdata) 4
blend $= Enabled
-- reset the coordinate uniforms for pictures that are drawn wrt to window
-- coordinates
resetShaderUniforms (map extractProgAndUnis $ _pictureShaders pdata)
let pmata = perspectiveMatrixc 0 1 (0,0) (2,2)
withArray pmata $ \ptr ->
bufferData UniformBuffer $=