Draw chasms using vertex pulling

This commit is contained in:
2025-11-13 21:58:40 +00:00
parent ec1216e7eb
commit 836c0ba772
6 changed files with 25 additions and 22 deletions
+4 -4
View File
@@ -3,6 +3,7 @@ module Shader.Poke.Floor (
pokeChasm,
) where
import Shader.Parameters
import Control.Monad
import Data.Tile
import Foreign
@@ -22,10 +23,9 @@ pokeTileVerx tangent tilez ptr i (V2 x y, V2 s t) = do
return $ i + 1
pokeChasm :: Ptr Float -> Int -> [Point2] -> IO Int
pokeChasm ptr i ps =
foldM (pokeChasmVerx ptr) i $ polyToTris ps
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]
pokeChasmVerx ptr i p = do
pokeByteOff ptr (floatSize*i*2) p
return $ i + 1