0

我做了一个小粒子系统。我现在想做的是让粒子在其生命周期内从一种颜色褪色到另一种颜色。例如从黑色到白色或从黄色到红色。

我使用glColor()函数来设置粒子的颜色。

我该怎么做呢?

4

1 回答 1

1

你必须自己混合颜色:

计算 0 和 1 之间的混合因子并混合颜色

float blend = lifeTime / maxLifeTime;
float red = (destRed * blend) + (srcRed * (1.0 - blend));
float green = (destGreen * blend) + (srcGreen * (1.0 - blend));
float blue = (destBlue * blend) + (srcBlue * (1.0 - blend));

问候罗恩

于 2013-04-02T12:54:10.773 回答