Added ParticleSystem skeleton plus basic temporary implementation.

This commit is contained in:
Stiffly
2014-04-17 00:08:27 +02:00
parent fe263784ae
commit 5e402af093
5 changed files with 91 additions and 31 deletions
+47
View File
@@ -0,0 +1,47 @@
#include "ParticleSystem.h"
#include "PrecompiledHeader.h"
#include "World.h"
void Systems::ParticleSystem::Update(double dt)
{
}
void Systems::ParticleSystem::UpdateEntity(double dt, EntityID entity, EntityID parent)
{
auto transformComponent = m_World->GetComponent<Components::Transform>(entity, "Transform");
if(!transformComponent)
return;
transformComponent->Position.y --;
timeLived[entity] += dt;
auto emitterComponent = m_World->GetComponent<Components::ParticleEmitter>(entity, "ParticleEmitter");
}
void Systems::ParticleSystem::RegisterComponents(ComponentFactory* cf)
{
cf->Register("ParticleEmitter", []() { return new Components::ParticleEmitter(); });
}
void Systems::ParticleSystem::SpawnParticles()
{
for(int i = 0; i < 100; i++)
{
auto particle = m_World->CreateEntity();
auto transform = m_World->AddComponent<Components::Transform>(particle, "Transform");
transform->Position = glm::vec3(0);
particles.push_back(particle);
}
}
void Systems::ParticleSystem::Draw(double dt)
{
}