Reduce number of wall points sent for shadows

This commit is contained in:
jgk
2021-02-27 02:27:43 +01:00
parent 3b4b387943
commit 33ebc1556d
2 changed files with 23 additions and 7 deletions
+8 -4
View File
@@ -297,8 +297,10 @@ threePtrsVAO vao = case (\(_,ps,_) -> ps) $ unzip3 $ _vaoBufferTargets vao of
renderPicture' :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
[(Point2,Point2,Point2,Point2)] -> [Point4] -> Picture -> IO (Word32,Word32)
[(Point2,Point2)] -> [Point4] -> Picture -> IO (Word32,Word32)
renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints pic = do
ticksAfterL <- SDL.ticks
startWallTicks <- SDL.ticks
depthFunc $= Just Lequal
aticks <- SDL.ticks
@@ -343,7 +345,7 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
bindVertexArrayObject $= Just (_vao $ _wallVAO pdata)
let wallPtr = (\(_,x,_) -> x) $ head $ _vaoBufferTargets $ _wallVAO pdata
-- wallPtr2 = (\(_,x,_) -> x) $ (_vaoBufferTargets $ _wallVAO pdata) !! 1
foldWalls n ((x,y),(z,w),(a,b),(c,d)) = do
foldWalls n ((x,y),(z,w)) = do
pokeFourOff wallPtr n (x,y,z,w)
-- pokeFourOff wallPtr2 n (a,b,c,d)
return $ n+1
@@ -366,7 +368,8 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
bindArrayBuffers (1) $ _vaoBufferTargets $ _fadeCircVAO pdata
blendFuncSeparate $= ((Zero,Zero),(Zero, OneMinusSrcAlpha))
drawArrays Points (fromIntegral 0) (fromIntegral 1)
ticksAfterL <- SDL.ticks
-- ticksAfterL <- SDL.ticks
endWallTicks <- SDL.ticks
-- draw picture
-- set drawing for on top
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
@@ -400,7 +403,8 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
uniform (snd shad !! 2) $= (0::Float)
uniform (snd shad !! 3) $= Vector2 (0::Float) 0
uniform (snd shad !! 4) $= idmat
return (ticksAfterL, ticks2+ticks3+ticks4)
--return (ticksAfterL, ticks2+ticks3+ticks4, endWallTicks - startWallTicks)
return (ticksAfterL, endWallTicks - startWallTicks)
bufferOffset :: Integral a => a -> Ptr b
bufferOffset = plusPtr nullPtr . fromIntegral