Merge remote-tracking branch 'origin/master' into deffered_rendering
Conflicts: src/GameWorld.cpp src/GameWorld.h vs11/Returngeance/Returngeance.vcxproj vs11/Returngeance/Returngeance.vcxproj.filters
This commit is contained in:
+131
-139
@@ -43,6 +43,8 @@ void GameWorld::Initialize()
|
||||
|
||||
BindKey(GLFW_KEY_Z, "shoot", 1.f);
|
||||
BindGamepadAxis(Gamepad::Axis::RightTrigger, "shoot", 1.f);
|
||||
BindGamepadAxis(Gamepad::Axis::RightTrigger, "jeep_vertical", 1.f);
|
||||
BindGamepadAxis(Gamepad::Axis::LeftTrigger, "jeep_vertical", -1.f);
|
||||
|
||||
BindKey(GLFW_KEY_X, "use", 1.f);
|
||||
BindGamepadButton(Gamepad::Button::X, "use", 1.f);
|
||||
@@ -402,7 +404,6 @@ void GameWorld::Initialize()
|
||||
}
|
||||
CommitEntity(gateBase);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GameWorld::Update(double dt)
|
||||
@@ -418,6 +419,7 @@ void GameWorld::RegisterComponents()
|
||||
m_ComponentFactory.Register<Components::Flag>([]() { return new Components::Flag(); });
|
||||
m_ComponentFactory.Register<Components::Move>([]() { return new Components::Move(); });
|
||||
m_ComponentFactory.Register<Components::Rotate>([]() { return new Components::Rotate(); });
|
||||
m_ComponentFactory.Register<Components::Team>([]() { return new Components::Team(); });
|
||||
}
|
||||
|
||||
void GameWorld::RegisterSystems()
|
||||
@@ -433,6 +435,7 @@ void GameWorld::RegisterSystems()
|
||||
//m_SystemFactory.Register<Systems::PlayerSystem>([this]() { return new Systems::PlayerSystem(this); });
|
||||
m_SystemFactory.Register<Systems::FreeSteeringSystem>([this]() { return new Systems::FreeSteeringSystem(this, EventBroker, ResourceManager); });
|
||||
m_SystemFactory.Register<Systems::TankSteeringSystem>([this]() { return new Systems::TankSteeringSystem(this, EventBroker, ResourceManager); });
|
||||
m_SystemFactory.Register<Systems::JeepSteeringSystem>([this]() { return new Systems::JeepSteeringSystem(this, EventBroker, ResourceManager); });
|
||||
m_SystemFactory.Register<Systems::WheelPairSystem>([this]() { return new Systems::WheelPairSystem(this, EventBroker, ResourceManager); });
|
||||
m_SystemFactory.Register<Systems::SoundSystem>([this]() { return new Systems::SoundSystem(this, EventBroker, ResourceManager); });
|
||||
m_SystemFactory.Register<Systems::PhysicsSystem>([this]() { return new Systems::PhysicsSystem(this, EventBroker, ResourceManager); });
|
||||
@@ -457,6 +460,7 @@ void GameWorld::AddSystems()
|
||||
//AddSystem<Systems::PlayerSystem>();
|
||||
AddSystem<Systems::FreeSteeringSystem>();
|
||||
AddSystem<Systems::TankSteeringSystem>();
|
||||
AddSystem<Systems::JeepSteeringSystem>();
|
||||
AddSystem<Systems::WheelPairSystem>();
|
||||
AddSystem<Systems::SoundSystem>();
|
||||
AddSystem<Systems::PhysicsSystem>();
|
||||
@@ -504,7 +508,7 @@ void GameWorld::BindGamepadButton(Gamepad::Button button, std::string command, f
|
||||
EventBroker->Publish(e);
|
||||
}
|
||||
|
||||
void GameWorld::CreateGate(EntityID parent, glm::vec3 position, glm::quat orientation)
|
||||
void GameWorld::CreateGate(EntityID parent, glm::vec3 position, glm::quat orientation, int teamID)
|
||||
{
|
||||
auto gateParent = CreateEntity(parent);
|
||||
auto transform = AddComponent<Components::Transform>(gateParent);
|
||||
@@ -611,9 +615,11 @@ void GameWorld::CreateGate(EntityID parent, glm::vec3 position, glm::quat orient
|
||||
auto transform = AddComponent<Components::Transform>(gateTrigger);
|
||||
transform->Position = glm::vec3(0, 2.8241, 0);
|
||||
auto trigger = AddComponent<Components::Trigger>(gateTrigger);
|
||||
trigger->TeamID = teamID;
|
||||
auto triggerMove = AddComponent<Components::TriggerMove>(gateTrigger);
|
||||
triggerMove->Entity = gate;
|
||||
|
||||
auto teamComponent = AddComponent<Components::Team>(gateTrigger);
|
||||
teamComponent->TeamID = teamID;
|
||||
{
|
||||
auto shape = CreateEntity(gateTrigger);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
@@ -758,9 +764,12 @@ EntityID GameWorld::CreateWall(EntityID parent, glm::vec3 pos, glm::quat orienta
|
||||
|
||||
auto model = AddComponent<Components::Model>(wall);
|
||||
model->ModelFile = "Models/Wall/WallWhole/Wall.obj";
|
||||
auto damageModel = AddComponent<Components::DamageModel>(wall);
|
||||
damageModel->ModelFile = "Models/Wall/WallWhole/WallCracks.obj";
|
||||
|
||||
auto health = AddComponent<Components::Health>(wall);
|
||||
health->Amount = 50.f;
|
||||
health->VulnerableToSplash = false;
|
||||
|
||||
auto shape = CreateEntity(wall);
|
||||
auto shapetransform = AddComponent<Components::Transform>(shape);
|
||||
@@ -774,126 +783,6 @@ EntityID GameWorld::CreateWall(EntityID parent, glm::vec3 pos, glm::quat orienta
|
||||
|
||||
}
|
||||
|
||||
EntityID GameWorld::CreateJeep(int playerID)
|
||||
{
|
||||
auto jeep = CreateEntity();
|
||||
auto transform = AddComponent<Components::Transform>(jeep);
|
||||
transform->Position = glm::vec3(0, 5, 0);
|
||||
transform->Orientation = glm::angleAxis(glm::pi<float>() / 2, glm::vec3(0, 1, 0));
|
||||
auto physics = AddComponent<Components::Physics>(jeep);
|
||||
physics->Mass = 1800;
|
||||
physics->MotionType = Components::Physics::MotionTypeEnum::Dynamic;
|
||||
auto vehicle = AddComponent<Components::Vehicle>(jeep);
|
||||
vehicle->DownshiftRPM = 3500.f;
|
||||
vehicle->UpshiftRPM = 6000.f;
|
||||
|
||||
AddComponent<Components::Input>(jeep);
|
||||
auto player = AddComponent<Components::Player>(jeep);
|
||||
player->ID = playerID;
|
||||
auto health = AddComponent<Components::Health>(jeep);
|
||||
health->Amount = 100.f;
|
||||
|
||||
{
|
||||
auto shape = CreateEntity(jeep);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
auto meshShape = AddComponent<Components::MeshShape>(shape);
|
||||
meshShape->ResourceName = "Models/Jeep/Chassi/ChassiCollision.obj";
|
||||
CommitEntity(shape);
|
||||
}
|
||||
|
||||
{
|
||||
auto chassis = CreateEntity(jeep);
|
||||
auto transform = AddComponent<Components::Transform>(chassis);
|
||||
transform->Position = glm::vec3(0, 0, 0); // 0.6577f
|
||||
auto model = AddComponent<Components::Model>(chassis);
|
||||
model->ModelFile = "Models/Jeep/Chassi/chassi.obj";
|
||||
}
|
||||
|
||||
//Create wheels
|
||||
float wheelOffset = 0.4f;
|
||||
float springLength = 0.3f;
|
||||
float suspensionStrength = 35.f;
|
||||
{
|
||||
auto wheel = CreateEntity(jeep);
|
||||
auto transform = AddComponent<Components::Transform>(wheel);
|
||||
transform->Position = glm::vec3(1.9f, 0.5546f - wheelOffset, -0.9242f);
|
||||
transform->Scale = glm::vec3(1.0f);
|
||||
auto model = AddComponent<Components::Model>(wheel);
|
||||
model->ModelFile = "Models/Jeep/WheelFront/wheelFront.obj";
|
||||
auto Wheel = AddComponent<Components::Wheel>(wheel);
|
||||
Wheel->Hardpoint = transform->Position + glm::vec3(0.f, springLength, 0.f);
|
||||
Wheel->AxleID = 0;
|
||||
Wheel->Mass = 50;
|
||||
Wheel->Radius = 0.837f;
|
||||
Wheel->Steering = true;
|
||||
Wheel->SuspensionStrength = suspensionStrength;
|
||||
Wheel->Friction = 4.f;
|
||||
Wheel->ConnectedToHandbrake = true;
|
||||
CommitEntity(wheel);
|
||||
}
|
||||
|
||||
{
|
||||
auto wheel = CreateEntity(jeep);
|
||||
auto transform = AddComponent<Components::Transform>(wheel);
|
||||
transform->Position = glm::vec3(-1.9f, 0.5546f - wheelOffset, -0.9242f);
|
||||
transform->Scale = glm::vec3(1.0f);
|
||||
transform->Orientation = glm::angleAxis(glm::pi<float>(), glm::vec3(0, 0, 1));
|
||||
auto model = AddComponent<Components::Model>(wheel);
|
||||
model->ModelFile = "Models/Jeep/WheelFront/wheelFront.obj";
|
||||
auto Wheel = AddComponent<Components::Wheel>(wheel);
|
||||
Wheel->Hardpoint = transform->Position + glm::vec3(0.f, springLength, 0.f);
|
||||
Wheel->AxleID = 0;
|
||||
Wheel->Mass = 50;
|
||||
Wheel->Radius = 0.837f;
|
||||
Wheel->Steering = true;
|
||||
Wheel->SuspensionStrength = suspensionStrength;
|
||||
Wheel->Friction = 4.f;
|
||||
Wheel->ConnectedToHandbrake = true;
|
||||
CommitEntity(wheel);
|
||||
}
|
||||
|
||||
{
|
||||
auto wheel = CreateEntity(jeep);
|
||||
auto transform = AddComponent<Components::Transform>(wheel);
|
||||
transform->Position = glm::vec3(0.2726f, 0.2805f - wheelOffset, 1.9307f);
|
||||
auto model = AddComponent<Components::Model>(wheel);
|
||||
model->ModelFile = "Models/Jeep/WheelBack/wheelBack.obj";
|
||||
auto Wheel = AddComponent<Components::Wheel>(wheel);
|
||||
Wheel->Hardpoint = transform->Position + glm::vec3(0.f, springLength, 0.f);
|
||||
Wheel->AxleID = 1;
|
||||
Wheel->Mass = 50;
|
||||
Wheel->Radius = 0.737f;
|
||||
Wheel->Steering = false;
|
||||
Wheel->SuspensionStrength = suspensionStrength;
|
||||
Wheel->Friction = 4.f;
|
||||
Wheel->ConnectedToHandbrake = true;
|
||||
CommitEntity(wheel);
|
||||
}
|
||||
|
||||
{
|
||||
auto wheel = CreateEntity(jeep);
|
||||
auto transform = AddComponent<Components::Transform>(wheel);
|
||||
transform->Position = glm::vec3(-0.2726f, 0.2805f - wheelOffset, 1.9307f);
|
||||
transform->Orientation = glm::angleAxis(glm::pi<float>(), glm::vec3(0, 0, 1));
|
||||
auto model = AddComponent<Components::Model>(wheel);
|
||||
model->ModelFile = "Models/Jeep/WheelBack/wheelBack.obj";
|
||||
auto Wheel = AddComponent<Components::Wheel>(wheel);
|
||||
Wheel->Hardpoint = transform->Position + glm::vec3(0.f, springLength, 0.f);
|
||||
Wheel->AxleID = 1;
|
||||
Wheel->Mass = 50;
|
||||
Wheel->Radius = 0.737f;
|
||||
Wheel->Steering = false;
|
||||
Wheel->SuspensionStrength = suspensionStrength;
|
||||
Wheel->Friction = 4.f;
|
||||
Wheel->ConnectedToHandbrake = true;
|
||||
CommitEntity(wheel);
|
||||
}
|
||||
|
||||
CommitEntity(jeep);
|
||||
|
||||
return jeep;
|
||||
}
|
||||
|
||||
void GameWorld::CreateTerrain()
|
||||
{
|
||||
{
|
||||
@@ -980,7 +869,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();
|
||||
@@ -1049,7 +938,7 @@ void GameWorld::CreateTerrain()
|
||||
}
|
||||
}
|
||||
|
||||
void GameWorld::CreateBase(glm::quat orientation, int playerID)
|
||||
void GameWorld::CreateBase(glm::quat orientation, int teamID)
|
||||
{
|
||||
auto base = CreateEntity();
|
||||
auto transform = AddComponent<Components::Transform>(base);
|
||||
@@ -1115,14 +1004,69 @@ void GameWorld::CreateBase(glm::quat orientation, int playerID)
|
||||
|
||||
{
|
||||
auto shape = CreateEntity(bridge_middle);
|
||||
auto transformshape = AddComponent<Components::Transform>(shape);
|
||||
auto meshShape = AddComponent<Components::MeshShape>(shape);
|
||||
meshShape->ResourceName = "Models/TerrainFiveIstles/Bridges/MiddleBridgeCollision.obj";
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(70.31883f, 26.42735f, 0.50379f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 26.324f;
|
||||
box->Height = 2.727f;
|
||||
box->Depth = 6.798f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_middle);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(70.43447f, 29.23594f, 7.37155f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 27.724f;
|
||||
box->Height = 1.334f;
|
||||
box->Depth = 0.571f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_middle);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(70.43447f, 29.26906f, -6.68171f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 27.724f;
|
||||
box->Height = 1.334f;
|
||||
box->Depth = 0.571f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_middle);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(70.36976f, 33.56011f, 9.68543f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 1.8f;
|
||||
box->Height = 15.984f;
|
||||
box->Depth = 1.456f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_middle);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(70.36976f, 33.56011f, -8.67785f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 1.799f;
|
||||
box->Height = 15.983f;
|
||||
box->Depth = 1.456f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_middle);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(99.16043f, 25.0318f, 0.54486f);
|
||||
transform->Orientation = glm::angleAxis(glm::radians(-9.087f), glm::vec3(0, 0, 1));
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 3.566f;
|
||||
box->Height = 3.566f;
|
||||
box->Depth = 7.632f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
CommitEntity(bridge_middle);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
auto terrain_base = CreateEntity(base);
|
||||
auto transform = AddComponent<Components::Transform>(terrain_base);
|
||||
@@ -1203,16 +1147,60 @@ void GameWorld::CreateBase(glm::quat orientation, int playerID)
|
||||
|
||||
{
|
||||
auto shape = CreateEntity(bridge_base);
|
||||
auto transformshape = AddComponent<Components::Transform>(shape);
|
||||
auto meshShape = AddComponent<Components::MeshShape>(shape);
|
||||
meshShape->ResourceName = "Models/TerrainFiveIstles/Bridges/BaseBridge.obj";
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(166.19089f, 25.99645f, -0.50379f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 27.723f;
|
||||
box->Height = 2.727f;
|
||||
box->Depth = 6.798f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_base);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(166.19089f, 28.37571f, -6.68171f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 27.724f;
|
||||
box->Height = 1.334f;
|
||||
box->Depth = 0.571f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_base);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(166.19089f, 28.37571f, 7.68929f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 27.724f;
|
||||
box->Height = 1.334f;
|
||||
box->Depth = 0.571f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_base);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(166.12617f, 33.56011f, -8.67785f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 1.8;
|
||||
box->Height = 15.984f;
|
||||
box->Depth = 1.456f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
{
|
||||
auto shape = CreateEntity(bridge_base);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
transform->Position = glm::vec3(166.12617f, 33.56011f, 9.68543f);
|
||||
auto box = AddComponent<Components::BoxShape>(shape);
|
||||
box->Width = 1.8;
|
||||
box->Height = 15.984f;
|
||||
box->Depth = 1.456f;
|
||||
CommitEntity(shape);
|
||||
}
|
||||
|
||||
CommitEntity(bridge_base);
|
||||
}
|
||||
#pragma endregion Terrain
|
||||
|
||||
CreateGate(base, glm::vec3(273.f, 40.185f, 0.06f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
CreateGate(base, glm::vec3(273.f, 40.185f, 0.06f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)), teamID);
|
||||
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)));
|
||||
@@ -1222,19 +1210,16 @@ void GameWorld::CreateBase(glm::quat orientation, int playerID)
|
||||
CreateWall(base, glm::vec3(273.f, 40.3f, 25.f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)));
|
||||
CreateTower(base, glm::vec3(290.f, 40.3f, 15.f), playerID);
|
||||
|
||||
CreateGarage(base, glm::vec3(323.2f, 41.4f, -10.2f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)), playerID);
|
||||
CreateGarage(base, glm::vec3(323.2f, 41.4f, -10.2f), glm::quat(glm::vec3(0, glm::pi<float>() / 2.f, 0)), teamID);
|
||||
}
|
||||
EntityID GameWorld::CreateGarage(EntityID parent, glm::vec3 Position, glm::quat orientation, int playerID)
|
||||
|
||||
EntityID GameWorld::CreateGarage(EntityID parent, glm::vec3 Position, glm::quat orientation, int teamID)
|
||||
{
|
||||
auto garage = CreateEntity(parent);
|
||||
auto transform = AddComponent<Components::Transform>(garage);
|
||||
transform->Position = Position;
|
||||
transform->Orientation = orientation;
|
||||
|
||||
auto player = CreateEntity(garage);
|
||||
auto playerComponent = AddComponent<Components::Player>(player);
|
||||
playerComponent->ID = playerID;
|
||||
|
||||
auto ElevatorBase = CreateEntity(garage);
|
||||
{
|
||||
auto transform = AddComponent<Components::Transform>(ElevatorBase);
|
||||
@@ -1346,7 +1331,8 @@ EntityID GameWorld::CreateGarage(EntityID parent, glm::vec3 Position, glm::quat
|
||||
auto transform = AddComponent<Components::Transform>(spawnPoint);
|
||||
transform->Position.y = 1.f;
|
||||
auto spawnPointComponent = AddComponent<Components::SpawnPoint>(spawnPoint);
|
||||
spawnPointComponent->Player = player;
|
||||
auto teamComponent = AddComponent<Components::Team>(spawnPoint);
|
||||
teamComponent->TeamID = teamID;
|
||||
}
|
||||
CommitEntity(spawnPoint);
|
||||
}
|
||||
@@ -1364,6 +1350,9 @@ EntityID GameWorld::CreateGarage(EntityID parent, glm::vec3 Position, glm::quat
|
||||
auto transform = AddComponent<Components::Transform>(trigger);
|
||||
transform->Position = glm::vec3(0, 44.87521f, 0);
|
||||
auto triggerComponent = AddComponent<Components::Trigger>(trigger);
|
||||
triggerComponent->TeamID = teamID;
|
||||
auto teamComponent = AddComponent<Components::Team>(trigger);
|
||||
teamComponent->TeamID = teamID;
|
||||
{
|
||||
auto shape = CreateEntity(trigger);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
@@ -1383,6 +1372,9 @@ EntityID GameWorld::CreateGarage(EntityID parent, glm::vec3 Position, glm::quat
|
||||
auto transform = AddComponent<Components::Transform>(trigger);
|
||||
transform->Position = glm::vec3(0.69385f, -6.7997f, -2.0f);
|
||||
auto triggerComponent = AddComponent<Components::Trigger>(trigger);
|
||||
triggerComponent->TeamID = teamID;
|
||||
auto teamComponent = AddComponent<Components::Team>(trigger);
|
||||
teamComponent->TeamID = teamID;
|
||||
{
|
||||
auto shape = CreateEntity(trigger);
|
||||
auto transform = AddComponent<Components::Transform>(shape);
|
||||
|
||||
Reference in New Issue
Block a user