mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-01-24 17:26:41 +00:00
Add option for particles to inherit alpha/color from their ParticleEffect
This commit is contained in:
parent
af463e63b2
commit
65e457423c
5 changed files with 19 additions and 11 deletions
|
@ -166,16 +166,7 @@ void SongLineRender::newPoint(const Vector &pt, const Vector &color)
|
||||||
s.color = color;
|
s.color = color;
|
||||||
pts.push_back(s);
|
pts.push_back(s);
|
||||||
if (pts.size() > maxx)
|
if (pts.size() > maxx)
|
||||||
{
|
pts.pop_front();
|
||||||
std::vector<SongLinePoint> copy;
|
|
||||||
copy = pts;
|
|
||||||
pts.clear();
|
|
||||||
for (int i = 1; i < copy.size(); i++)
|
|
||||||
{
|
|
||||||
pts.push_back(copy[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!pts.empty() && inRange)
|
else if (!pts.empty() && inRange)
|
||||||
{
|
{
|
||||||
|
|
|
@ -284,6 +284,8 @@ void Emitter::onRender()
|
||||||
|
|
||||||
if (hasRot)
|
if (hasRot)
|
||||||
{
|
{
|
||||||
|
Vector colorMult = data.inheritColor ? pe->color : Vector(1, 1, 1);
|
||||||
|
float alphaMult = data.inheritAlpha ? pe->alpha.x : 1;
|
||||||
for (Particles::iterator i = particles.begin(); i != particles.end(); i++)
|
for (Particles::iterator i = particles.begin(); i != particles.end(); i++)
|
||||||
{
|
{
|
||||||
Particle *p = *i;
|
Particle *p = *i;
|
||||||
|
@ -293,7 +295,8 @@ void Emitter::onRender()
|
||||||
const float dy = h2 * p->scale.y;
|
const float dy = h2 * p->scale.y;
|
||||||
|
|
||||||
#ifdef BBGE_BUILD_OPENGL
|
#ifdef BBGE_BUILD_OPENGL
|
||||||
glColor4f(p->color.x, p->color.y, p->color.z, p->alpha.x);
|
Vector col = p->color * colorMult;
|
||||||
|
glColor4f(col.x, col.y, col.z, p->alpha.x * alphaMult);
|
||||||
|
|
||||||
|
|
||||||
if (p->rot.z != 0 || p->rot.isInterpolating())
|
if (p->rot.z != 0 || p->rot.isInterpolating())
|
||||||
|
|
|
@ -404,6 +404,16 @@ void ParticleEffect::bankLoad(const std::string &file, const std::string &path)
|
||||||
inf >> tmp;
|
inf >> tmp;
|
||||||
inf >> currentEmitter->data.suckIndex >> currentEmitter->data.suckStr;
|
inf >> currentEmitter->data.suckIndex >> currentEmitter->data.suckStr;
|
||||||
}
|
}
|
||||||
|
else if (token == "InheritColor")
|
||||||
|
{
|
||||||
|
inf >> tmp;
|
||||||
|
inf >> currentEmitter->data.inheritColor;
|
||||||
|
}
|
||||||
|
else if (token == "InheritAlpha")
|
||||||
|
{
|
||||||
|
inf >> tmp;
|
||||||
|
inf >> currentEmitter->data.inheritAlpha;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,8 @@ struct SpawnParticleData
|
||||||
float counter;
|
float counter;
|
||||||
float spawnTimeOffset;
|
float spawnTimeOffset;
|
||||||
bool spawnLocal;
|
bool spawnLocal;
|
||||||
|
bool inheritColor;
|
||||||
|
bool inheritAlpha;
|
||||||
|
|
||||||
float lastDTDifference;
|
float lastDTDifference;
|
||||||
int groupRender;
|
int groupRender;
|
||||||
|
|
|
@ -70,4 +70,6 @@ SpawnParticleData::SpawnParticleData()
|
||||||
groupRender = 0;
|
groupRender = 0;
|
||||||
pauseLevel = 0;
|
pauseLevel = 0;
|
||||||
copyParentFlip = 0;
|
copyParentFlip = 0;
|
||||||
|
inheritColor = false;
|
||||||
|
inheritAlpha = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue