summaryrefslogtreecommitdiff
path: root/src/particleemitter.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-07 14:57:08 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-07 21:38:21 +0300
commitae550d179c25e149f7e8a8d70011b364fb0d85d6 (patch)
treec4dabe3e38afc8b343e3946202eb6fa5f30a18a9 /src/particleemitter.cpp
parent2566e68d2502d39c9f7c9d83ce4b281e2834fe29 (diff)
downloadmv-ae550d179c25e149f7e8a8d70011b364fb0d85d6.tar.gz
mv-ae550d179c25e149f7e8a8d70011b364fb0d85d6.tar.bz2
mv-ae550d179c25e149f7e8a8d70011b364fb0d85d6.tar.xz
mv-ae550d179c25e149f7e8a8d70011b364fb0d85d6.zip
some fixes after auto check.
Diffstat (limited to 'src/particleemitter.cpp')
-rw-r--r--src/particleemitter.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 71eff9c3f..7666fb063 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -549,12 +549,15 @@ std::list<Particle *> ParticleEmitter::createParticles(const int tick)
newParticle->moveTo(position);
const float angleH = mParticleAngleHorizontal.value(tick);
+ const float cosAngleH = cos(angleH);
+ const float sinAngleH = sin(angleH);
const float angleV = mParticleAngleVertical.value(tick);
+ const float cosAngleV = cos(angleV);
+ const float sinAngleV = sin(angleV);
const float power = mParticlePower.value(tick);
- newParticle->setVelocity(
- static_cast<float>(cos(angleH) * cos(angleV)) * power,
- static_cast<float>(sin(angleH) * cos(angleV)) * power,
- static_cast<float>(sin(angleV)) * power);
+ newParticle->setVelocity(cosAngleH * cosAngleV * power,
+ sinAngleH * cosAngleV * power,
+ sinAngleV * power);
newParticle->setRandomness(mParticleRandomness.value(tick));
newParticle->setGravity(mParticleGravity.value(tick));