layout std140 in particle shader

This commit is contained in:
Zach Pomerantz 2016-04-07 17:27:51 -07:00
parent 50a081db00
commit 4e3ab73941
2 changed files with 4 additions and 3 deletions

View file

@ -39,6 +39,7 @@ public:
InterpolationData<float> radius;
InterpolationData<glm::vec4> color; // rgba
float lifespan;
glm::vec3 spare;
};
struct ParticlePrimitive {

View file

@ -30,10 +30,10 @@ struct Colors {
struct ParticleUniforms {
Radii radius;
Colors color;
float lifespan;
vec4 lifespan; // x is lifespan, 3 spare floats
};
uniform particleBuffer {
layout(std140) uniform particleBuffer {
ParticleUniforms particle;
};
@ -112,7 +112,7 @@ void main(void) {
int twoTriID = gl_VertexID - particleID * NUM_VERTICES_PER_PARTICLE;
// Particle properties
float age = inColor.x / particle.lifespan;
float age = inColor.x / particle.lifespan.x;
float seed = inColor.y;
// Pass the texcoord and the z texcoord is representing the texture icon