This commit is contained in:
2025-07-30 09:20:41 +01:00
parent 210171fbc9
commit 18770480e7
13 changed files with 41 additions and 12 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ setupStaticVBOVAO vas vdata = withArrayLen vdata $ \i ptr -> do
setupVBOStatic :: Int -> IO VBO
setupVBOStatic vertexsize = do
vboname <- mglCreate glCreateBuffers
thePtr <- mallocArray (vertexsize * numDrawableVertices)
thePtr <- mallocBytes (vertexsize * numDrawableVertices)
-- Allocate space
glNamedBufferData
vboname
+10
View File
@@ -1,5 +1,6 @@
module Shader.Poke.Floor (
pokeTile,
pokeChasm,
) where
import Control.Monad
@@ -19,3 +20,12 @@ pokeTileVerx tangent tilez ptr i (V2 x y, V2 s t) = do
let a = argV tangent
zipWithM_ (\off -> pokeElemOff ptr (i * 8 + off)) [0 ..] [x, y, 1, 1, s, t, tilez, a]
return $ i + 1
pokeChasm :: Ptr Float -> Int -> [Point2] -> IO Int
pokeChasm ptr i ps =
foldM (pokeChasmVerx ptr) i $ polyToTris ps
pokeChasmVerx :: Ptr Float -> Int -> Point2 -> IO Int
pokeChasmVerx ptr i (V2 x y) = do
zipWithM_ (\off -> pokeElemOff ptr (i * 3 + off)) [0 ..] [x, y, 0]
return $ i + 1