Merge remote-tracking branch 'origin/deffered_rendering'
This commit is contained in:
+10
-11
@@ -91,8 +91,6 @@ void GameWorld::Initialize()
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
CreateTerrain();
|
||||
|
||||
#pragma region Wall_Debris_Template
|
||||
|
||||
{
|
||||
@@ -263,12 +261,14 @@ void GameWorld::Initialize()
|
||||
auto shape = CreateEntity(debri);
|
||||
auto shapetransform = AddComponent<Components::Transform>(shape);
|
||||
auto shapemesh = AddComponent<Components::MeshShape>(shape);
|
||||
shapemesh->ResourceName = "Models/Wall/WallDestroyed/WallDestroyed.obj"; //Lägg in ny collision modell
|
||||
shapemesh->ResourceName = "Models/Wall/WallDestroyed/WallDestroyedColosion.obj";
|
||||
|
||||
m_WallDebrisTemplates.push_back(debri);
|
||||
}
|
||||
#pragma endregion Region for wall debris
|
||||
|
||||
CreateTerrain();
|
||||
|
||||
/*EntityID tank1 = CreateTank(1);
|
||||
{
|
||||
auto transform = GetComponent<Components::Transform>(tank1);
|
||||
@@ -866,7 +866,7 @@ void GameWorld::CreateTerrain()
|
||||
}
|
||||
|
||||
CreateBase(glm::quat(), 1);
|
||||
CreateBase(glm::quat(glm::vec3(0, glm::pi<float>(), 0)), 2);
|
||||
//CreateBase(glm::quat(glm::vec3(0, glm::pi<float>(), 0)), 2);
|
||||
|
||||
{
|
||||
auto tree = CreateEntity();
|
||||
@@ -1099,14 +1099,13 @@ void GameWorld::CreateBase(glm::quat orientation, int playerID)
|
||||
#pragma endregion Terrain
|
||||
|
||||
CreateGate(base, glm::vec3(273.f, 40.185f, 0.06f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
|
||||
CreateWall(base, glm::vec3(273.f, 40.3f, -55.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
CreateWall(base, glm::vec3(273.f, 40.3f, -45.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
CreateWall(base, glm::vec3(273.f, 40.3f, -35.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
CreateWall(base, glm::vec3(273.f, 40.3f, -25.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
CreateWall(base, glm::vec3(273.f, 40.3f, -15.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
CreateWall(base, glm::vec3(273.f, 40.3f, 15.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
CreateWall(base, glm::vec3(273.f, 40.3f, 25.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
//CreateWall(base, glm::vec3(273.f, 40.3f, -45.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
//CreateWall(base, glm::vec3(273.f, 40.3f, -35.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
//CreateWall(base, glm::vec3(273.f, 40.3f, -25.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
//CreateWall(base, glm::vec3(273.f, 40.3f, -15.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
//CreateWall(base, glm::vec3(273.f, 40.3f, 15.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
//CreateWall(base, glm::vec3(273.f, 40.3f, 25.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
|
||||
CreateGarage(base, glm::vec3(323.2f, 41.4f, -10.2f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)), playerID);
|
||||
}
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ void Model::getSimilarVertexIndex()
|
||||
{
|
||||
glm::vec3 tempNormal, tempTangent, tempBiTangent;
|
||||
|
||||
if(glm::dot(Normals[i], Normals[t]) > 0)
|
||||
if(glm::dot(Normals[i], Normals[t]) > .4f)
|
||||
{
|
||||
tempNormal = Normals[i] + Normals[t];
|
||||
tempTangent = TangentNormals[i] + TangentNormals[t];
|
||||
|
||||
@@ -18,12 +18,12 @@ bool Systems::DamageSystem::OnDamage( const Events::Damage &event )
|
||||
return false;
|
||||
auto health = m_World->GetComponent<Components::Health>(event.Entity);
|
||||
health->Amount -= event.Amount;
|
||||
if(health->Amount <= 0)
|
||||
{
|
||||
Events::OnDead e;
|
||||
e.Entity = event.Entity;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
//if(health->Amount <= 0)
|
||||
//{
|
||||
// Events::OnDead e;
|
||||
// e.Entity = event.Entity;
|
||||
// EventBroker->Publish(e);
|
||||
//}
|
||||
LOG_INFO("Damaged entity %i, Health left: %f", event.Entity, health->Amount);
|
||||
return true;
|
||||
}
|
||||
+16
-17
@@ -25,30 +25,29 @@ bool Systems::WallSystem::Damage( const Events::Damage &event )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
LOG_INFO("You are dead");
|
||||
auto transformComponent = m_World->GetComponent<Components::Transform>(event.Entity);
|
||||
LOG_INFO("Entity %i is dead", event.Entity);
|
||||
//auto transformComponent = m_World->GetComponent<Components::Transform>(event.Entity);
|
||||
Components::Transform transformComponent = m_World->GetSystem<Systems::TransformSystem>()->AbsoluteTransform(event.Entity);
|
||||
|
||||
for(auto d : wallComponent->Walldebris)
|
||||
{
|
||||
auto debris = m_World->CloneEntity(d);
|
||||
|
||||
auto transform = m_World->GetComponent<Components::Transform>(debris);
|
||||
transform->Position += transformComponent->Position;
|
||||
|
||||
// DO STUFF! :D
|
||||
float distance = glm::distance(transform->Position, transformComponent->Position);
|
||||
float radius = 5.f;
|
||||
float strength = (1.f - pow(distance / radius, 2)) * 500.f;
|
||||
glm::vec3 direction = glm::normalize(transformComponent->Position - transform->Position);
|
||||
|
||||
Events::ApplyPointImpulse e;
|
||||
e.Entity = debris;
|
||||
e.Impulse = direction * strength;
|
||||
e.Position = transformComponent->Position;
|
||||
EventBroker->Publish(e);
|
||||
transform->Orientation = transform->Orientation * transformComponent.Orientation;
|
||||
transform->Position = transform->Orientation * transform->Position + transformComponent.Position;
|
||||
|
||||
//DO STUFF! :D
|
||||
float distance = glm::distance(transform->Position, transformComponent.Position);
|
||||
float radius = 5.f;
|
||||
float strength = (1.f - pow(distance / radius, 2)) * 20.f;
|
||||
glm::vec3 direction = glm::normalize(transformComponent.Position - transform->Position);
|
||||
|
||||
Events::ApplyPointImpulse e;
|
||||
e.Entity = debris;
|
||||
e.Impulse = direction * strength;
|
||||
e.Position = transformComponent.Position;
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
m_World->RemoveEntity(event.Entity);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
#include "System.h"
|
||||
#include "Systems/TransformSystem.h"
|
||||
#include "Events/OnDead.h"
|
||||
#include "Events/Damage.h"
|
||||
#include "Events/ApplyPointImpulse.h"
|
||||
|
||||
Reference in New Issue
Block a user