Fix dust rendering

This commit is contained in:
2025-10-29 11:37:57 +00:00
parent 5f0ab2223d
commit e8d2407367
4 changed files with 16 additions and 26 deletions
+2 -1
View File
@@ -120,7 +120,8 @@ preloadRender = do
chasmshader <- makeShaderUsingVBO "positional/blank" [vert, frag] (toFloatVAs [3]) pmTriangles chasmvbo
putStrLn "Setup cloud VBO, shader"
let cloudverxsizes = [4, 4, 4, 4]
--let cloudverxsizes = [4, 4, 4, 4]
let cloudverxsizes = [4, 4, 4]
cloudvbo <- setupVBO (floatSize * sum cloudverxsizes)
(cloudshader, cloudebo) <-
makeShaderEBO "cloud/basic" [vert, frag] (toFloatVAs cloudverxsizes) pmTriangles cloudvbo
+8 -4
View File
@@ -22,7 +22,8 @@ pokeCloudVerx :: Ptr Float -> Cloud -> Int -> Int -> (Float, Float) -> IO ()
pokeCloudVerx ptr cl nv i (dx, dy) =
UV.imapM_ (pokeCloudFloat ptr (nv + i)) $
UV.fromList
[x, y, cz, 1, r, g, b, a, cx, cy, cz, rad, dx, dy, 0, 0]
--[x, y, cz, 1, r, g, b, a, cx, cy, cz, rad, dx, dy, 0, 0]
[x, y, cz, 1, r, g, b, a, dx, dy, 0, 0]
where
V3 cx cy cz = _clPos cl
V2 x y = V2 cx cy - rad *.* V2 dx dy
@@ -41,7 +42,8 @@ clColor = \case
pokeCloudFloat :: Ptr Float -> Int -> Int -> Float -> IO ()
{-# INLINE pokeCloudFloat #-}
pokeCloudFloat ptr nv i = pokeElemOff ptr (nv * 16 + i)
--pokeCloudFloat ptr nv i = pokeElemOff ptr (nv * 16 + i)
pokeCloudFloat ptr nv i = pokeElemOff ptr (nv * 12 + i)
pokeCloudIndex :: Ptr GLushort -> Int -> Int -> Int -> Int -> IO ()
{-# INLINE pokeCloudIndex #-}
@@ -58,7 +60,8 @@ pokeDustVerx :: Ptr Float -> Dust -> Int -> Int -> (Float, Float) -> IO ()
pokeDustVerx ptr cl nv i (dx, dy) =
UV.imapM_ (pokeDustFloat ptr (nv + i)) $
UV.fromList
[x, y, cz, 1, r, g, b, a, cx, cy, cz, rad, dx, dy, 0, 0]
--[x, y, cz, 1, r, g, b, a, cx, cy, cz, rad, dx, dy, 0, 0]
[x, y, cz, 1, r, g, b, a, dx, dy, 0, 0]
where
V3 cx cy cz = _dsPos cl
V2 x y = V2 cx cy - rad *.* V2 dx dy
@@ -73,7 +76,8 @@ dustColor = materialColor . _dsType
pokeDustFloat :: Ptr Float -> Int -> Int -> Float -> IO ()
{-# INLINE pokeDustFloat #-}
pokeDustFloat ptr nv i = pokeElemOff ptr (nv * 16 + i)
--pokeDustFloat ptr nv i = pokeElemOff ptr (nv * 16 + i)
pokeDustFloat ptr nv i = pokeElemOff ptr (nv * 12 + i)
pokeDustIndex :: Ptr GLushort -> Int -> Int -> Int -> Int -> IO ()
{-# INLINE pokeDustIndex #-}