|
@@ -242,6 +242,7 @@ void ParticleSystem::initParticle(Particle *p, float t)
|
|
|
|
|
|
p->position = pos;
|
|
p->position = pos;
|
|
|
|
|
|
|
|
+ float rand_x, rand_y;
|
|
switch (areaSpreadDistribution)
|
|
switch (areaSpreadDistribution)
|
|
{
|
|
{
|
|
case DISTRIBUTION_UNIFORM:
|
|
case DISTRIBUTION_UNIFORM:
|
|
@@ -252,6 +253,12 @@ void ParticleSystem::initParticle(Particle *p, float t)
|
|
p->position.x += (float) rng.randomNormal(areaSpread.getX());
|
|
p->position.x += (float) rng.randomNormal(areaSpread.getX());
|
|
p->position.y += (float) rng.randomNormal(areaSpread.getY());
|
|
p->position.y += (float) rng.randomNormal(areaSpread.getY());
|
|
break;
|
|
break;
|
|
|
|
+ case DISTRIBUTION_ELLIPSE:
|
|
|
|
+ rand_x = (float) rng.random(-1, 1);
|
|
|
|
+ rand_y = (float) rng.random(-1, 1);
|
|
|
|
+ p->position.x += areaSpread.getX() * (rand_x * sqrt(1 - 0.5f*pow(rand_y, 2)));
|
|
|
|
+ p->position.y += areaSpread.getY() * (rand_y * sqrt(1 - 0.5f*pow(rand_x, 2)));
|
|
|
|
+ break;
|
|
case DISTRIBUTION_NONE:
|
|
case DISTRIBUTION_NONE:
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
@@ -969,6 +976,7 @@ StringMap<ParticleSystem::AreaSpreadDistribution, ParticleSystem::DISTRIBUTION_M
|
|
{ "none", DISTRIBUTION_NONE },
|
|
{ "none", DISTRIBUTION_NONE },
|
|
{ "uniform", DISTRIBUTION_UNIFORM },
|
|
{ "uniform", DISTRIBUTION_UNIFORM },
|
|
{ "normal", DISTRIBUTION_NORMAL },
|
|
{ "normal", DISTRIBUTION_NORMAL },
|
|
|
|
+ { "ellipse", DISTRIBUTION_ELLIPSE },
|
|
};
|
|
};
|
|
|
|
|
|
StringMap<ParticleSystem::AreaSpreadDistribution, ParticleSystem::DISTRIBUTION_MAX_ENUM> ParticleSystem::distributions(ParticleSystem::distributionsEntries, sizeof(ParticleSystem::distributionsEntries));
|
|
StringMap<ParticleSystem::AreaSpreadDistribution, ParticleSystem::DISTRIBUTION_MAX_ENUM> ParticleSystem::distributions(ParticleSystem::distributionsEntries, sizeof(ParticleSystem::distributionsEntries));
|