Reduce poked cloud verx size

This commit is contained in:
2025-11-13 18:09:12 +00:00
parent b6ab281842
commit 71ae82ee4d
3 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ preloadRender = do
ieptr <- mallocArray 65536 -- so we can go back to glushort...
cloudbo <- mglCreate glCreateBuffers
let cvsize = (sizeOf (0 :: Float)) * 8
let cvsize = (sizeOf (0 :: Float)) * 4
cloudbosize = fromIntegral cvsize * 65536 -- this should be changed
glNamedBufferStorage cloudbo cloudbosize nullPtr GL_DYNAMIC_STORAGE_BIT
glBindBufferBase GL_SHADER_STORAGE_BUFFER 6 cloudbo
+10 -9
View File
@@ -2,6 +2,7 @@
module Shader.Poke.Cloud (pokeCloud, pokeDust) where
import Shader.Parameters
import Color
import Control.Lens
--import qualified Data.Vector.Unboxed as UV
@@ -40,15 +41,15 @@ mkDustCloudLike x = (x ^. dsPos, V4 r g b a)
-- UV.imapM_ (pokeCloudIndex iptr nv ni) $ UV.fromList [0, 1, 2, 2, 0, 3]
-- return (nv + 4, ni + 6)
pokeCloudLike :: Ptr Float -> Int -> (Point3, Point4) -> IO Int
pokeCloudLike ptr nv (V3 x y z, V4 r g b a) = do
pokeElemOff ptr (nv * 8) x
pokeElemOff ptr (nv * 8 + 1) y
pokeElemOff ptr (nv * 8 + 2) z
pokeElemOff ptr (nv * 8 + 3) 1
pokeElemOff ptr (nv * 8 + 4) r
pokeElemOff ptr (nv * 8 + 5) g
pokeElemOff ptr (nv * 8 + 6) b
pokeElemOff ptr (nv * 8 + 7) a
pokeCloudLike ptr nv (V3 x y z, col@(V4 r g b a)) = do
pokeElemOff ptr (nv * 4) x
pokeElemOff ptr (nv * 4 + 1) y
pokeElemOff ptr (nv * 4 + 2) z
pokeByteOff ptr (floatSize * (nv * 4 + 3)) (toColor8 col)
-- pokeElemOff ptr (nv * 8 + 4) r
-- pokeElemOff ptr (nv * 8 + 5) g
-- pokeElemOff ptr (nv * 8 + 6) b
-- pokeElemOff ptr (nv * 8 + 7) a
return $ nv + 1
--pokeCloudLikeVerx :: Ptr Float -> (Point3, Point4) -> Int -> Int -> (Float, Float) -> IO ()