mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-16 05:01:04 +02:00
Fix particle shader
This commit is contained in:
parent
bd23a4137e
commit
591025850b
1 changed files with 5 additions and 13 deletions
|
@ -56,19 +56,11 @@ float bezierInterpolate(float y1, float y2, float y3, float u) {
|
|||
return (1.0 - u) * (1.0 - u) * y1 + 2.0 * (1.0 - u) * u * y2 + u * u * y3;
|
||||
}
|
||||
|
||||
float interpolate3Floats(float y1, float y2, float y3, float u) {
|
||||
if ((u <= 0.5 && y1 == y2) || (u >= 0.5 && y2 == y3)) {
|
||||
// Flat line.
|
||||
return y2;
|
||||
}
|
||||
return bezierInterpolate(y1, y2, y3, u);
|
||||
}
|
||||
|
||||
vec4 interpolate3Vec4(vec4 y1, vec4 y2, vec4 y3, float u) {
|
||||
return vec4(interpolate3Floats(y1.x, y2.x, y3.x, u),
|
||||
interpolate3Floats(y1.y, y2.y, y3.y, u),
|
||||
interpolate3Floats(y1.z, y2.z, y3.z, u),
|
||||
interpolate3Floats(y1.w, y2.w, y3.w, u));
|
||||
return vec4(bezierInterpolate(y1.x, y2.x, y3.x, u),
|
||||
bezierInterpolate(y1.y, y2.y, y3.y, u),
|
||||
bezierInterpolate(y1.z, y2.z, y3.z, u),
|
||||
bezierInterpolate(y1.w, y2.w, y3.w, u));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,7 +82,7 @@ void main(void) {
|
|||
varColor = interpolate3Vec4(particle.color.start, particle.color.middle, particle.color.finish, age);
|
||||
|
||||
// anchor point in eye space
|
||||
float radius = interpolate3Floats(particle.radius.start, particle.radius.middle, particle.radius.finish , age);
|
||||
float radius = bezierInterpolate(particle.radius.start, particle.radius.middle, particle.radius.finish , age);
|
||||
vec4 quadPos = radius * UNIT_QUAD[twoTriID];
|
||||
|
||||
vec4 anchorPoint;
|
||||
|
|
Loading…
Reference in a new issue