Reduce poked cloud verx size
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#version 450 core
|
#version 450 core
|
||||||
struct CloudPosCol { vec4 pos; vec4 col; };
|
//struct CloudPosCol { vec4 pos; vec4 col; };
|
||||||
|
//struct CloudPosCol { vec3 pos; uint colx; vec4 col; };
|
||||||
|
struct CloudPosCol { vec3 pos; uint colx; };
|
||||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||||
layout (std430, binding = 6) readonly buffer CPos { CloudPosCol data[]; };
|
layout (std430, binding = 6) readonly buffer CPos { CloudPosCol data[]; };
|
||||||
const vec2 indices[6] =
|
const vec2 indices[6] =
|
||||||
@@ -17,7 +19,8 @@ void main()
|
|||||||
{
|
{
|
||||||
uint i = gl_VertexID / 6;
|
uint i = gl_VertexID / 6;
|
||||||
uint k = gl_VertexID % 6;
|
uint k = gl_VertexID % 6;
|
||||||
vCol = data[i].col;
|
//vCol = data[i].col;
|
||||||
|
vCol = unpackUnorm4x8(data[i].colx);
|
||||||
vControls = indices[k];
|
vControls = indices[k];
|
||||||
vPos = vec3(data[i].pos.xy + 20*vControls, data[i].pos.z);
|
vPos = vec3(data[i].pos.xy + 20*vControls, data[i].pos.z);
|
||||||
gl_Position = theMat * vec4(vPos,1);
|
gl_Position = theMat * vec4(vPos,1);
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ preloadRender = do
|
|||||||
ieptr <- mallocArray 65536 -- so we can go back to glushort...
|
ieptr <- mallocArray 65536 -- so we can go back to glushort...
|
||||||
|
|
||||||
cloudbo <- mglCreate glCreateBuffers
|
cloudbo <- mglCreate glCreateBuffers
|
||||||
let cvsize = (sizeOf (0 :: Float)) * 8
|
let cvsize = (sizeOf (0 :: Float)) * 4
|
||||||
cloudbosize = fromIntegral cvsize * 65536 -- this should be changed
|
cloudbosize = fromIntegral cvsize * 65536 -- this should be changed
|
||||||
glNamedBufferStorage cloudbo cloudbosize nullPtr GL_DYNAMIC_STORAGE_BIT
|
glNamedBufferStorage cloudbo cloudbosize nullPtr GL_DYNAMIC_STORAGE_BIT
|
||||||
glBindBufferBase GL_SHADER_STORAGE_BUFFER 6 cloudbo
|
glBindBufferBase GL_SHADER_STORAGE_BUFFER 6 cloudbo
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
module Shader.Poke.Cloud (pokeCloud, pokeDust) where
|
module Shader.Poke.Cloud (pokeCloud, pokeDust) where
|
||||||
|
|
||||||
|
import Shader.Parameters
|
||||||
import Color
|
import Color
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
--import qualified Data.Vector.Unboxed as UV
|
--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]
|
-- UV.imapM_ (pokeCloudIndex iptr nv ni) $ UV.fromList [0, 1, 2, 2, 0, 3]
|
||||||
-- return (nv + 4, ni + 6)
|
-- return (nv + 4, ni + 6)
|
||||||
pokeCloudLike :: Ptr Float -> Int -> (Point3, Point4) -> IO Int
|
pokeCloudLike :: Ptr Float -> Int -> (Point3, Point4) -> IO Int
|
||||||
pokeCloudLike ptr nv (V3 x y z, V4 r g b a) = do
|
pokeCloudLike ptr nv (V3 x y z, col@(V4 r g b a)) = do
|
||||||
pokeElemOff ptr (nv * 8) x
|
pokeElemOff ptr (nv * 4) x
|
||||||
pokeElemOff ptr (nv * 8 + 1) y
|
pokeElemOff ptr (nv * 4 + 1) y
|
||||||
pokeElemOff ptr (nv * 8 + 2) z
|
pokeElemOff ptr (nv * 4 + 2) z
|
||||||
pokeElemOff ptr (nv * 8 + 3) 1
|
pokeByteOff ptr (floatSize * (nv * 4 + 3)) (toColor8 col)
|
||||||
pokeElemOff ptr (nv * 8 + 4) r
|
-- pokeElemOff ptr (nv * 8 + 4) r
|
||||||
pokeElemOff ptr (nv * 8 + 5) g
|
-- pokeElemOff ptr (nv * 8 + 5) g
|
||||||
pokeElemOff ptr (nv * 8 + 6) b
|
-- pokeElemOff ptr (nv * 8 + 6) b
|
||||||
pokeElemOff ptr (nv * 8 + 7) a
|
-- pokeElemOff ptr (nv * 8 + 7) a
|
||||||
return $ nv + 1
|
return $ nv + 1
|
||||||
|
|
||||||
--pokeCloudLikeVerx :: Ptr Float -> (Point3, Point4) -> Int -> Int -> (Float, Float) -> IO ()
|
--pokeCloudLikeVerx :: Ptr Float -> (Point3, Point4) -> Int -> Int -> (Float, Float) -> IO ()
|
||||||
|
|||||||
Reference in New Issue
Block a user