Merge branch 'master' of github.com:teamfisk/AgileBreakOut
This commit is contained in:
@@ -189,7 +189,7 @@ public:
|
|||||||
// {
|
// {
|
||||||
// auto Pe = m_World->CreateEntity();
|
// auto Pe = m_World->CreateEntity();
|
||||||
// auto transform = m_World->AddComponent<Components::Transform>(Pe);
|
// auto transform = m_World->AddComponent<Components::Transform>(Pe);
|
||||||
// auto particleEmitter= m_World->AddComponent<Components::ParticleEmitter>(Pe);
|
// auto particleEmitter= m_World->AddComponent<Components::Emitter>(Pe);
|
||||||
//
|
//
|
||||||
// transform->Position = glm::vec3(0.f, -5.f, -10.f);
|
// transform->Position = glm::vec3(0.f, -5.f, -10.f);
|
||||||
// particleEmitter->GravityScale = 0.0f;
|
// particleEmitter->GravityScale = 0.0f;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ struct ParticleEmitter : public Component
|
|||||||
double SpawnRate = 1.f;
|
double SpawnRate = 1.f;
|
||||||
double TimeSinceLastSpawn = 0;
|
double TimeSinceLastSpawn = 0;
|
||||||
|
|
||||||
//ParticleSystem variables
|
//System variables
|
||||||
float GravityScale = 1.0f;
|
float GravityScale = 1.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace dd
|
|||||||
struct Impulse
|
struct Impulse
|
||||||
{
|
{
|
||||||
b2Body* Body;
|
b2Body* Body;
|
||||||
b2Vec2 Impulse;
|
b2Vec2 Vector;
|
||||||
b2Vec2 Point;
|
b2Vec2 Point;
|
||||||
};
|
};
|
||||||
bool m_Pause = false;
|
bool m_Pause = false;
|
||||||
@@ -99,9 +99,9 @@ namespace dd
|
|||||||
//TODO: Fill struct with info needed.
|
//TODO: Fill struct with info needed.
|
||||||
struct ParticleEmitter
|
struct ParticleEmitter
|
||||||
{
|
{
|
||||||
std::vector<b2ParticleSystem*> ParticleSystem;
|
std::vector<b2ParticleSystem*> System;
|
||||||
std::vector<EntityID> ParticleEmitter;
|
std::vector<EntityID> Emitter;
|
||||||
std::vector<EntityID> ParticleTemplate;
|
std::vector<EntityID> Template;
|
||||||
};
|
};
|
||||||
ParticleEmitter m_ParticleEmitters;
|
ParticleEmitter m_ParticleEmitters;
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ bool dd::Systems::PhysicsSystem::SetImpulse(const Events::SetImpulse &event)
|
|||||||
|
|
||||||
Impulse i;
|
Impulse i;
|
||||||
i.Body = it->second;
|
i.Body = it->second;
|
||||||
i.Impulse = impulse;
|
i.Vector = impulse;
|
||||||
i.Point = point;
|
i.Point = point;
|
||||||
|
|
||||||
m_Impulses.push_back(i);
|
m_Impulses.push_back(i);
|
||||||
@@ -155,7 +155,7 @@ void dd::Systems::PhysicsSystem::Update(double dt)
|
|||||||
|
|
||||||
//Apply Impulses Must be done after SyncEntitiesWithBodies
|
//Apply Impulses Must be done after SyncEntitiesWithBodies
|
||||||
for (auto i : m_Impulses) {
|
for (auto i : m_Impulses) {
|
||||||
i.Body->ApplyLinearImpulse(i.Impulse, i.Point, true);
|
i.Body->ApplyLinearImpulse(i.Vector, i.Point, true);
|
||||||
}
|
}
|
||||||
m_Impulses.clear();
|
m_Impulses.clear();
|
||||||
|
|
||||||
@@ -371,10 +371,10 @@ void dd::Systems::PhysicsSystem::CreateParticleGroup(EntityID e)
|
|||||||
|
|
||||||
void dd::Systems::PhysicsSystem::UpdateParticleEmitters(double dt)
|
void dd::Systems::PhysicsSystem::UpdateParticleEmitters(double dt)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_ParticleEmitters.ParticleSystem.size(); i++) {
|
for (int i = 0; i < m_ParticleEmitters.System.size(); i++) {
|
||||||
auto e = m_ParticleEmitters.ParticleEmitter[i];
|
auto e = m_ParticleEmitters.Emitter[i];
|
||||||
auto pt = m_ParticleEmitters.ParticleTemplate[i];
|
auto pt = m_ParticleEmitters.Template[i];
|
||||||
auto ps = m_ParticleEmitters.ParticleSystem[i];
|
auto ps = m_ParticleEmitters.System[i];
|
||||||
|
|
||||||
|
|
||||||
auto emitter = m_World->GetComponent<Components::ParticleEmitter>(e);
|
auto emitter = m_World->GetComponent<Components::ParticleEmitter>(e);
|
||||||
@@ -426,14 +426,14 @@ void dd::Systems::PhysicsSystem::CreateParticleEmitter(EntityID entity)
|
|||||||
auto particleTemplate = m_World->GetComponent<Components::Template>(c);
|
auto particleTemplate = m_World->GetComponent<Components::Template>(c);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
continue;
|
continue;
|
||||||
LOG_WARNING("--ParticleEmitter's Child is not a particle.");
|
LOG_WARNING("--Emitter's Child is not a particle.");
|
||||||
}
|
}
|
||||||
if(!particleTemplate) {
|
if(!particleTemplate) {
|
||||||
LOG_ERROR("ParticleEmitter's particleChild is not a template.");
|
LOG_ERROR("Emitter's particleChild is not a template.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (pf != 0) {
|
if (pf != 0) {
|
||||||
LOG_WARNING("ParticleEmitter has more than one child that is a particleTemplate, only the first one is used.");
|
LOG_WARNING("Emitter has more than one child that is a particleTemplate, only the first one is used.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
childEntity = c;
|
childEntity = c;
|
||||||
@@ -441,9 +441,9 @@ void dd::Systems::PhysicsSystem::CreateParticleEmitter(EntityID entity)
|
|||||||
pf++;
|
pf++;
|
||||||
}
|
}
|
||||||
//TODO: Skicka med fler flaggor till particlesystemet;
|
//TODO: Skicka med fler flaggor till particlesystemet;
|
||||||
m_ParticleEmitters.ParticleSystem.push_back(CreateParticleSystem(particle->Radius, 0.f));
|
m_ParticleEmitters.System.push_back(CreateParticleSystem(particle->Radius, 0.f));
|
||||||
m_ParticleEmitters.ParticleEmitter.push_back(entity);
|
m_ParticleEmitters.Emitter.push_back(entity);
|
||||||
m_ParticleEmitters.ParticleTemplate.push_back(childEntity);
|
m_ParticleEmitters.Template.push_back(childEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user