Cleanup matrices
This commit is contained in:
+7
-17
@@ -57,22 +57,13 @@ doDrawing pdata w = do
|
||||
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 $=
|
||||
(fromIntegral $ sizeOf (head pmat) * length pmat
|
||||
,ptr
|
||||
,StreamDraw
|
||||
)
|
||||
bufferUBO $ perspectiveMatrixb 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
|
||||
(foregroundPics w)
|
||||
|
||||
-- -- set the coordinate uniforms ready for drawing elements using world coordinates
|
||||
-- setCommonUniforms pdata rot camzoom trans wins
|
||||
|
||||
-- draw the background. Assumes that depth testing is not enabled or that
|
||||
-- the depth buffer is ready to be drawn on
|
||||
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
|
||||
@@ -129,13 +120,7 @@ doDrawing pdata w = do
|
||||
drawShader (_grayscaleShader pdata) 4
|
||||
blend $= Enabled
|
||||
|
||||
let pmata = perspectiveMatrixc 0 1 (0,0) (2,2)
|
||||
withArray pmata $ \ptr ->
|
||||
bufferData UniformBuffer $=
|
||||
(fromIntegral $ sizeOf (head pmat) * length pmat
|
||||
,ptr
|
||||
,StreamDraw
|
||||
)
|
||||
bufferUBO $ perspectiveMatrixc 0 1 (0,0) (2,2)
|
||||
|
||||
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
|
||||
_ <- renderFoldable pdata (picToLTree Nothing $ fixedCoordPictures w)
|
||||
@@ -144,6 +129,11 @@ doDrawing pdata w = do
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- note we currently assume there is only one UBO, we only bind it once at setup
|
||||
bufferUBO :: [Float] -> IO ()
|
||||
bufferUBO mat = withArray mat $ \ptr ->
|
||||
bufferSubData UniformBuffer WriteToBuffer 0 64 ptr
|
||||
|
||||
renderBlankWalls
|
||||
:: RenderData
|
||||
-> [((Point2,Point2),Point4)] -- ^ List: wall positions and color
|
||||
|
||||
@@ -89,7 +89,7 @@ girderV col w x y = setDepth (-0.1) $ color col $ pictures $
|
||||
bs' = catMaybes $ zipWith (fmap . (,)) as $ f (3*pi/4) as
|
||||
girder :: Color -> Float -> Point2 -> Point2 -> Picture
|
||||
girder col w x y = pictures $
|
||||
(setDepth (-0.1) $ color col $ pictures $
|
||||
setDepth (-0.1) (color col $ pictures $
|
||||
[ thickLine [xt,yt] 3
|
||||
, thickLine [xb,yb] 3
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user