Improve shadows for static walls

This commit is contained in:
2021-03-05 13:40:34 +01:00
parent e4c51bc47a
commit 5f8b5881e5
8 changed files with 62 additions and 34 deletions
+1 -2
View File
@@ -34,7 +34,6 @@ data RenderData = RenderData
, _backVAO :: VAO
, _wallVAO :: VAO
, _fadeCircVAO :: VAO
, _texVBO :: BufferObject
, _wssLightPos :: UniformLocation
, _dummyVBO :: BufferObject
, _dummyPtr :: Ptr Float
@@ -150,7 +149,7 @@ preloadRender = do
circvao <- setupVAO [(0,3),(1,4),(2,1)]
arcvao <- setupVAO [(0,3),(1,4),(2,4)]
backgroundvao <- setupVAO [(0,4),(1,2)]
wallvao <- setupVAO [(0,4)]--,(colVBO,1,4)]
wallvao <- setupVAO [(0,4),(1,4)]
fadecircvao <- setupVAO [(0,4)]
return $ RenderData
+4 -4
View File
@@ -381,7 +381,7 @@ threePtrsVAO vao = case (\(_,ps,_) -> ps) $ unzip3 $ _vaoBufferTargets vao of
renderPicture' :: RenderData -> Float -> Float -> (Float,Float) -> (Float,Float) ->
[(Point2,Point2)] -> [Point4] -> Picture -> IO (Word32,Word32)
[(Point2,Point2,Point2,Point2)] -> [Point4] -> Picture -> IO (Word32,Word32)
renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints pic = do
wallPokeStart <- SDL.ticks
@@ -429,11 +429,11 @@ renderPicture' pdata rot zoom (tranx,trany) (winx,winy) wallPoints lightPoints p
-- draw lightmap
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)) = do
wallPtr2 = (\(_,x,_) -> x) $ (_vaoBufferTargets $ _wallVAO pdata) !! 1
foldWalls n ((x,y),(z,w),(a,b),(c,d)) = do
pokeFourOff wallPtr n (x,y,z,w)
-- pokeElemOff (_dummyPtr pdata) n (fromIntegral n)
-- pokeFourOff wallPtr2 n (a,b,c,d)
pokeFourOff wallPtr2 n (a,b,c,d)
return $ n+1
nWalls <- foldM foldWalls 0 wallPoints
bindArrayBuffers (length wallPoints) $ _vaoBufferTargets $ _wallVAO pdata