Light on tank shells

This commit is contained in:
Tleety
2014-06-05 16:25:20 +02:00
parent 2f617727a4
commit e42c2c49ef
4 changed files with 11 additions and 0 deletions
+2
View File
@@ -11,6 +11,7 @@ namespace Events
{ {
CreateExplosion() : CreateExplosion() :
Color(glm::vec4(0)), Color(glm::vec4(0)),
usePointLight(false),
UseGoalVector(false) {} UseGoalVector(false) {}
glm::vec3 Position; glm::vec3 Position;
@@ -21,6 +22,7 @@ namespace Events
glm::quat RelativeUpOrientation; glm::quat RelativeUpOrientation;
float Speed; float Speed;
float SpreadAngle; float SpreadAngle;
float usePointLight;
std::vector<float> ParticleScale; std::vector<float> ParticleScale;
bool UseGoalVector; bool UseGoalVector;
glm::vec3 GoalVelocity; glm::vec3 GoalVelocity;
+7
View File
@@ -268,6 +268,13 @@ bool Systems::ParticleSystem::CreateExplosion(const Events::CreateExplosion &e)
auto templateComponent = m_World->AddComponent<Components::Template>(particleEnt); auto templateComponent = m_World->AddComponent<Components::Template>(particleEnt);
auto TEMP = m_World->AddComponent<Components::Transform>(particleEnt); auto TEMP = m_World->AddComponent<Components::Transform>(particleEnt);
auto spriteComponent = m_World->AddComponent<Components::Sprite>(particleEnt); auto spriteComponent = m_World->AddComponent<Components::Sprite>(particleEnt);
if(e.usePointLight)
{
auto light = m_World->AddComponent<Components::PointLight>(particleEnt);
light->Diffuse = glm::vec3(231.f/255.f, 181.f/255.f, 48.f/255.f);
light->Specular = glm::vec3(0.5f, 0.5f, 0.5f);
light->Radius = 20.f;
}
spriteComponent->SpriteFile = e.spritePath; spriteComponent->SpriteFile = e.spritePath;
m_World->CommitEntity(particleEnt); m_World->CommitEntity(particleEnt);
emitter->ParticleTemplate = particleEnt; emitter->ParticleTemplate = particleEnt;
+1
View File
@@ -5,6 +5,7 @@
#include "Systems/TransformSystem.h" #include "Systems/TransformSystem.h"
#include "Components/Transform.h" #include "Components/Transform.h"
#include "Components/ParticleEmitter.h" #include "Components/ParticleEmitter.h"
#include "Components/PointLight.h"
#include "Components/Particle.h" #include "Components/Particle.h"
#include "Components/Sprite.h" #include "Components/Sprite.h"
#include "EventBroker.h" #include "EventBroker.h"
+1
View File
@@ -252,6 +252,7 @@ bool Systems::TankSteeringSystem::OnCollision(const Events::Collision &e)
e.Speed = 6; e.Speed = 6;
e.SpreadAngle = glm::pi<float>(); e.SpreadAngle = glm::pi<float>();
e.spritePath = "Textures/Sprites/Blast1.png"; e.spritePath = "Textures/Sprites/Blast1.png";
e.usePointLight = true;
e.Color = glm::vec4(2, 2, 2, 0.2); e.Color = glm::vec4(2, 2, 2, 0.2);
EventBroker->Publish(e); EventBroker->Publish(e);