Merge branch 'master' of github.com:sippeangelo/Escape-the-Dawn

Conflicts:
	Escape-the-Dawn/GameWorld.cpp
	Escape-the-Dawn/Systems/CollisionSystem.cpp
	Escape-the-Dawn/Systems/SoundSystem.h
	Escape-the-Dawn/Systems/SoundsSystem.cpp
This commit is contained in:
Adam
2014-03-13 20:09:41 +01:00
42 changed files with 1421 additions and 303 deletions
+65 -70
View File
@@ -5,7 +5,7 @@ void GameWorld::Initialize()
{
World::Initialize();
//AddSystem("LevelGenerationSystem");
AddSystem("LevelGenerationSystem");
AddSystem("InputSystem");
AddSystem("CollisionSystem");
//AddSystem("ParticleSystem");
@@ -19,129 +19,124 @@ void GameWorld::Initialize()
std::shared_ptr<Components::Camera> camera;
std::shared_ptr<Components::Bounds> bounds;
std::shared_ptr<Components::Collision> collision;
std::shared_ptr<Components::SoundEmitter> soundEmitter;
EntityID ent;
// Camera
entcamera = CreateEntity();
SetProperty(entcamera, "Name", std::string("Camera"));
transform = AddComponent<Components::Transform>(entcamera, "Transform");
AddComponent<Components::Input>(entcamera, "Input");
transform->Position = glm::vec3(0.f, 2.f, 10.f);
camera = AddComponent<Components::Camera>(entcamera, "Camera");
camera->FOV = 45.f;
camera->FarClip = 1000.f;
camera->NearClip = 0.01f;
transform->Orientation = glm::angleAxis<float>(glm::radians(25.0f),glm::vec3(1,0,0));
collision = AddComponent<Components::Collision>(entcamera, "Collision");
collision->Phantom = false;
bounds = AddComponent<Components::Bounds>(entcamera, "Bounds");
bounds->Origin = transform->Position;
bounds->VolumeVector = glm::vec3(4.f,2.f,2.f);
// Fucking lights
ent = CreateEntity();
transform = AddComponent<Components::Transform>(ent, "Transform");
transform->Position = glm::vec3(0.f, 4.f, 0.f);
transform->Position = glm::vec3(10.f, 2.f, 5.f);
transform->Position = glm::vec3(0.f, 7.f, 0.f);
pointLight = AddComponent<Components::PointLight>(ent, "PointLight");
pointLight->Specular = glm::vec3(1.0, 1.0, 1.0);
pointLight->Diffuse = glm::vec3(1.0, 1.0, 1.0);
pointLight->Diffuse = glm::vec3(1.0, 1.0, 5.0);
pointLight->Diffuse = glm::vec3(0.0, 0.0, 5.0);
pointLight->constantAttenuation = 0.f;
pointLight->linearAttenuation = 1.f;
pointLight->quadraticAttenuation = 0.f;
pointLight->spotExponent = 0.0f;
model = AddComponent<Components::Model>(ent, "Model");
model->ModelFile = "sphere.obj";
model->ModelFile = "Models/sphere.obj";
ent = CreateEntity();
transform = AddComponent<Components::Transform>(ent, "Transform");
transform->Position = glm::vec3(10.f, 4.f, 0.f);
transform->Position = glm::vec3(0.f, 2.f, 5.f);
transform->Position = glm::vec3(10.f, 7.f, 0.f);
pointLight = AddComponent<Components::PointLight>(ent, "PointLight");
pointLight->Specular = glm::vec3(1.0, 1.0, 1.0);
pointLight->Diffuse = glm::vec3(1.0, 1.0, 1.0);
pointLight->Specular = glm::vec3(3.0, 3.0, 3.0);
pointLight->Diffuse = glm::vec3(3.0, 0.0, 0.0);
pointLight->Diffuse = glm::vec3(0.0, 5.0, 0.0);
pointLight->constantAttenuation = 0.f;
pointLight->linearAttenuation = 1.f;
pointLight->quadraticAttenuation = 0.f;
pointLight->spotExponent = 0.0f;
model = AddComponent<Components::Model>(ent, "Model");
model->ModelFile = "sphere.obj";
model->ModelFile = "Models/sphere.obj";
ent = CreateEntity();
transform = AddComponent<Components::Transform>(ent, "Transform");
transform->Position = glm::vec3(0.f, -4.f, 0.f);
transform->Position = glm::vec3(-10.f, 2.f, 5.f);
transform->Position = glm::vec3(-10.f, 7.f, 0.f);
pointLight = AddComponent<Components::PointLight>(ent, "PointLight");
pointLight->Specular = glm::vec3(1.0, 1.0, 1.0);
pointLight->Diffuse = glm::vec3(1.0, 1.0, 1.0);
pointLight->Diffuse = glm::vec3(0.0, 3.0, 0.0);
pointLight->Diffuse = glm::vec3(5.0, 0.0, 0.0);
pointLight->constantAttenuation = 0.f;
pointLight->linearAttenuation = 1.f;
pointLight->quadraticAttenuation = 0.f;
pointLight->spotExponent = 0.0f;
model = AddComponent<Components::Model>(ent, "Model");
model->ModelFile = "sphere.obj";
model->ModelFile = "Models/sphere.obj";
//ground
ent = CreateEntity();
transform = AddComponent<Components::Transform>(ent, "Transform");
transform->Position = glm::vec3(0.f, 0.f, 0.f);
model = AddComponent<Components::Model>(ent, "Model");
model->ModelFile = "plane.obj";
model->ModelFile = "Models/plane.obj";
// Player
<<<<<<< HEAD
player1 = CreateEntity();
transform = AddComponent<Components::Transform>(player1, "Transform");
transform->Position = glm::vec3(0.f, 0.f, 0.f);
model = AddComponent<Components::Model>(player1, "Model");
model->ModelFile = "ship.obj";
collision = AddComponent<Components::Collision>(player1, "Collision");
collision->Phantom = false;
bounds = AddComponent<Components::Bounds>(player1, "Bounds");
bounds->Origin = transform->Position;
bounds->VolumeVector = glm::vec3(10.f,10.f,5.f);
player2 = CreateEntity();
transform = AddComponent<Components::Transform>(player2, "Transform");
transform->Position = glm::vec3(10.f, 0.f, 0.f);
model = AddComponent<Components::Model>(player2, "Model");
=======
m_Player = CreateEntity();
SetProperty(m_Player, "Name", std::string("PlayerShip"));
transform = AddComponent<Components::Transform>(m_Player, "Transform");
transform->Position = glm::vec3(0.f, 4.f, 0.f);
transform->Position = glm::vec3(0.f, 2.f, -5.f);
transform->Scale = glm::vec3(1.0f);
model = AddComponent<Components::Model>(m_Player, "Model");
model->ModelFile = "ship.obj";
auto bounds = AddComponent<Components::Bounds>(m_Player, "Bounds");
bounds->Origin = glm::vec3(0.f);
bounds->VolumeVector = glm::vec3(1.0f, 2.0f, 3.0f);
model->ModelFile = "Models/ship.obj";
pointLight = AddComponent<Components::PointLight>(m_Player, "PointLight");
pointLight->Specular = glm::vec3(1.0, 1.0, 1.0);
pointLight->Diffuse = glm::vec3(0.4, 0.4, 1.0);
pointLight->constantAttenuation = 0.f;
pointLight->linearAttenuation = 1.f;
pointLight->quadraticAttenuation = 0.f;
pointLight->spotExponent = 0.0f;
AddComponent<Components::Input>(m_Player, "Input");
collision = AddComponent<Components::Collision>(m_Player, "Collision");
collision->Phantom = false;
collision->Interested = true;
bounds = AddComponent<Components::Bounds>(m_Player, "Bounds");
<<<<<<< HEAD
bounds->Origin = glm::vec3(transform->Position.x, transform->Position.y - 4, transform->Position.z + 3);
bounds->VolumeVector = glm::vec3(4.f,0.7f,4);
soundEmitter = AddComponent<Components::SoundEmitter>(m_Player, "SoundEmitter");
soundEmitter->Loop = true;
soundEmitter->MaxDistance = FLT_MAX;
soundEmitter->ReferenceDistance = 10;
soundEmitter->Gain = 1;
soundEmitter->Pitch = 1;
soundEmitter->Path = "Sounds/hallelujah.wav";
GetSystem<Systems::SoundSystem>("SoundSystem")->PlaySound(soundEmitter);
=======
bounds->Origin = glm::vec3(0, 0, 2.f);
bounds->VolumeVector = glm::vec3(4.f, 0.7f, 1);
>>>>>>> f76c0b336f87a259a7eabf3c532fc885f155a605
ent = CreateEntity();
// Camera
entcamera = CreateEntity(m_Player);
SetProperty(entcamera, "Name", std::string("Camera"));
transform = AddComponent<Components::Transform>(entcamera, "Transform");
AddComponent<Components::Input>(entcamera, "Input");
transform->Position = glm::vec3(0.f, 10.f, 14.f);
camera = AddComponent<Components::Camera>(entcamera, "Camera");
camera->FOV = 45.f;
camera->FarClip = 1000.f;
camera->NearClip = 0.01f;
transform->Orientation = glm::angleAxis<float>(glm::radians(15.0f),glm::vec3(1,0,0));
/*ent = CreateEntity();
transform = AddComponent<Components::Transform>(ent, "Transform");
transform->Position = glm::vec3(10.f, 4.f, 0.f);
model = AddComponent<Components::Model>(ent, "Model");
>>>>>>> 21b2e3bdc15ac8b21f027a7f531574f46187ae80
model->ModelFile = "ship.obj";
model->ModelFile = "Models/ship.obj";
collision = AddComponent<Components::Collision>(player2, "Collision");
collision->Phantom = false;
bounds = AddComponent<Components::Bounds>(player2, "Bounds");
bounds->Origin = transform->Position;
bounds->VolumeVector = glm::vec3(2.f,2.f,2.f);
bounds->VolumeVector = glm::vec3(2.f,2.f,2.f);*/
}
void GameWorld::Update(double dt)
{
World::Update(dt);
<<<<<<< HEAD
if(GetSystem<Systems::CollisionSystem>("CollisionSystem")->Intersects(player1, entcamera))
assert(false);
=======
auto transform = GetComponent<Components::Transform>(m_Player, "Transform");
transform->Orientation = transform->Orientation * glm::angleAxis<float>(dt, glm::vec3(0, 0, 1));
>>>>>>> 21b2e3bdc15ac8b21f027a7f531574f46187ae80
}
void GameWorld::RegisterComponents()
@@ -164,7 +159,7 @@ void GameWorld::RegisterComponents()
void GameWorld::RegisterSystems()
{
//m_SystemFactory.Register("LevelGenerationSystem", [this]() { return new Systems::LevelGenerationSystem(this); });
m_SystemFactory.Register("LevelGenerationSystem", [this]() { return new Systems::LevelGenerationSystem(this); });
m_SystemFactory.Register("InputSystem", [this]() { return new Systems::InputSystem(this, m_Renderer); });
m_SystemFactory.Register("CollisionSystem", [this]() { return new Systems::CollisionSystem(this); });
//m_SystemFactory.Register("ParticleSystem", [this]() { return new Systems::ParticleSystem(this); });