Draw chasms using vertex pulling
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user