aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/particles/je_particle_system.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-11-18 23:45:58 +0800
committerchai <chaifix@163.com>2018-11-18 23:45:58 +0800
commit4279e16ddb6273a9711ff331d21325dd5f63e769 (patch)
tree0d7ff12807fba478134f3bf9e01fd474c3a0b510 /src/libjin/Graphics/particles/je_particle_system.cpp
parent8cb74178c2b8e5883a1181af687fa8cfc0c6e5da (diff)
*修改目录为小写
Diffstat (limited to 'src/libjin/Graphics/particles/je_particle_system.cpp')
-rw-r--r--src/libjin/Graphics/particles/je_particle_system.cpp67
1 files changed, 0 insertions, 67 deletions
diff --git a/src/libjin/Graphics/particles/je_particle_system.cpp b/src/libjin/Graphics/particles/je_particle_system.cpp
deleted file mode 100644
index a81a3c9..0000000
--- a/src/libjin/Graphics/particles/je_particle_system.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "je_particle_system.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
- namespace Particles
- {
-
- ParticleSystem::ParticleSystem(const ParticleSystemDef& def)
- : mDef(def)
- , mEmitter(*this)
- , mParticlePool(def.maxParticleCount, sizeof(Particle))
- {
- }
-
- ParticleSystem::~ParticleSystem()
- {
- }
-
- void ParticleSystem::update(float dt)
- {
- mEmitter.update(dt);
- for (int i = 0; i < mAliveParticles.size(); ++i)
- {
- Particle* p = mAliveParticles[i];
- if (p->alive == false)
- {
- recycle(i, p);
- --i;
- }
- else
- {
- p->update(dt);
- }
- }
- }
-
- void ParticleSystem::render(float x, float y, float sx /* = 1 */, float sy /* = 1 */, float r /* = 0 */, float ax /* = 0 */, float ay /* = 0 */)
- {
- for (Particle* p : mAliveParticles)
- p->render();
- }
-
- void ParticleSystem::setGraphic(const Graphic* graphic)
- {
- mGraphic = graphic;
- }
-
- Particle* ParticleSystem::claim()
- {
- Particle* p = new (mParticlePool.GetNextWithoutInitializing()) Particle(mGraphic);
- mAliveParticles.push_back(p);
- return p;
- }
-
- void ParticleSystem::recycle(int i, Particle* p)
- {
- if (i >= mAliveParticles.size())
- return;
- mAliveParticles.erase(mAliveParticles.begin() + i);
- mParticlePool.Delete(p);
- }
-
- }
- }
-} \ No newline at end of file