Fixed inverted particle rendering.

This commit is contained in:
Nex Pro 2016-02-24 01:02:17 +00:00
parent f82e5e2cd6
commit 864f00ee61

View file

@ -44,11 +44,12 @@ out vec4 varColor;
out vec2 varTexcoord;
const int NUM_VERTICES_PER_PARTICLE = 4;
// This ordering ensures that un-rotated particles render upright in the wiewer.
const vec4 UNIT_QUAD[NUM_VERTICES_PER_PARTICLE] = vec4[NUM_VERTICES_PER_PARTICLE](
vec4(-1.0, -1.0, 0.0, 0.0),
vec4(1.0, -1.0, 0.0, 0.0),
vec4(-1.0, 1.0, 0.0, 0.0),
vec4(1.0, 1.0, 0.0, 0.0)
vec4(-1.0, -1.0, 0.0, 0.0),
vec4(1.0, 1.0, 0.0, 0.0),
vec4(1.0, -1.0, 0.0, 0.0)
);
float bezierInterpolate(float y1, float y2, float y3, float u) {
@ -115,7 +116,8 @@ void main(void) {
float seed = inColor.y;
// Pass the texcoord and the z texcoord is representing the texture icon
varTexcoord = vec2((UNIT_QUAD[twoTriID].xy + 1.0) * 0.5);
// Offset for corrected vertex ordering.
varTexcoord = vec2((UNIT_QUAD[twoTriID].xy -1.0) * vec2(0.5, -0.5));
varColor = interpolate3Vec4(particle.color.start, particle.color.middle, particle.color.finish, age);
// anchor point in eye space