diff --git a/assets b/assets index e7ff07b..d5c5a86 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e7ff07be10092507ff1aff17a3041d4c00aa46e1 +Subproject commit d5c5a867134f72ff078af1110f622647e6b7b4cd diff --git a/src/GameWorld.cpp b/src/GameWorld.cpp index 6a7e51a..e3d86ea 100755 --- a/src/GameWorld.cpp +++ b/src/GameWorld.cpp @@ -69,64 +69,276 @@ void GameWorld::Initialize() e.ViewportFrame = "ViewportFreeCam"; EventBroker->Publish(e); } - - //{ - // auto ground = CreateEntity(); - // auto transform = AddComponent(ground); - // transform->Position = glm::vec3(0, -50, 0); - // //transform->Scale = glm::vec3(400.0f, 10.0f, 400.0f); - // transform->Orientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f)); - // auto model = AddComponent(ground); - // model->ModelFile = "Models/TestScene3/testScene.obj"; - // //model->ModelFile = "Models/Placeholders/Terrain/Terrain2.obj"; - // - // auto physics = AddComponent(ground); - // physics->Mass = 10; - // physics->Static = true; - - - // auto groundshape = CreateEntity(ground); - // auto transformshape = AddComponent(groundshape); - // auto meshShape = AddComponent(groundshape); - // //meshShape->ResourceName = "Models/Placeholders/Terrain/Terrain2.obj"; - // meshShape->ResourceName = "Models/TestScene3/testScene.obj"; - - // - // CommitEntity(groundshape); - // CommitEntity(ground); - //} - { - auto ground = CreateEntity(); - auto transform = AddComponent(ground); + auto road_base = CreateEntity(); + auto transform = AddComponent(road_base); transform->Position = glm::vec3(0, -50, 0); - //transform->Scale = glm::vec3(400.0f, 10.0f, 400.0f); - transform->Orientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f)); - auto model = AddComponent(ground); - model->ModelFile = "Models/TestScene3/testScene.obj"; - //model->ModelFile = "Models/Placeholders/Terrain/Terrain2.obj"; - - auto physics = AddComponent(ground); + auto model = AddComponent(road_base); + model->ModelFile = "Models/TerrainFiveIstles/Roads/BaseRoad.obj"; + auto physics = AddComponent(road_base); physics->Mass = 10; physics->Static = true; physics->CollisionLayer = 1; - auto groundshape = CreateEntity(ground); + auto groundshape = CreateEntity(road_base); auto transformshape = AddComponent(groundshape); auto meshShape = AddComponent(groundshape); - //meshShape->ResourceName = "Models/Placeholders/Terrain/Terrain2.obj"; - meshShape->ResourceName = "Models/TestScene3/testScene.obj"; + meshShape->ResourceName = "Models/TerrainFiveIstles/Roads/BaseRoad.obj"; CommitEntity(groundshape); - CommitEntity(ground); + CommitEntity(road_base); + } + + { + auto road_middle = CreateEntity(); + auto transform = AddComponent(road_middle); + transform->Position = glm::vec3(0, -50, 0); + auto model = AddComponent(road_middle); + model->ModelFile = "Models/TerrainFiveIstles/Roads/MiddleRoad.obj"; + auto physics = AddComponent(road_middle); + physics->Mass = 10; + physics->Static = true; + physics->CollisionLayer = 1; + + auto groundshape = CreateEntity(road_middle); + auto transformshape = AddComponent(groundshape); + auto meshShape = AddComponent(groundshape); + meshShape->ResourceName = "Models/TerrainFiveIstles/Roads/MiddleRoad.obj"; + + + CommitEntity(groundshape); + CommitEntity(road_middle); + } + + { + auto road_small = CreateEntity(); + auto transform = AddComponent(road_small); + transform->Position = glm::vec3(0, -50, 0); + auto model = AddComponent(road_small); + model->ModelFile = "Models/TerrainFiveIstles/Roads/SmallRoad.obj"; + auto physics = AddComponent(road_small); + physics->Mass = 10; + physics->Static = true; + physics->CollisionLayer = 1; + + auto groundshape = CreateEntity(road_small); + auto transformshape = AddComponent(groundshape); + auto meshShape = AddComponent(groundshape); + meshShape->ResourceName = "Models/TerrainFiveIstles/Roads/SmallRoad.obj"; + + + CommitEntity(groundshape); + CommitEntity(road_small); + } + + + { + auto water = CreateEntity(); + auto transform = AddComponent(water); + transform->Position = glm::vec3(0, -35, 0); + transform->Orientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f)); + transform->Scale = glm::vec3(5000.f, 10.f, 5000.f); + auto model = AddComponent(water); + model->ModelFile = "Models/Placeholders/PhysicsTest/Cube.obj"; + auto blendmap = AddComponent(water); + blendmap->TextureRed = "Textures/Ground/WaterPlain0017_6_S.png"; + blendmap->TextureRedNormal = "Textures/Ground/SoilBeach0087_11_SNM.png"; + blendmap->TextureGreen = "Textures/Ground/WaterPlain0017_6_S.jpg"; + blendmap->TextureGreenNormal = "Textures/Ground/Grass0126_2_SNM.png"; + blendmap->TextureBlue = "Textures/Ground/WaterPlain0017_6_S.png"; + blendmap->TextureBlueNormal = "Textures/Ground/Cliffs2NM.png"; + blendmap->TextureRepeats = 400.f; + + auto physics = AddComponent(water); + physics->Mass = 10; + physics->Static = true; + physics->CollisionLayer = 1; + { + + auto groundshape = CreateEntity(water); + auto box = AddComponent(groundshape); + box->Depth = 250.f; + box->Height = 5.f; + box->Width = 250.f; + + + CommitEntity(groundshape); + } + CommitEntity(water); + } + + { + auto ground_middle = CreateEntity(); + auto transform = AddComponent(ground_middle); + transform->Position = glm::vec3(0, -50, 0); + transform->Orientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f)); + auto model = AddComponent(ground_middle); + model->ModelFile = "Models/TerrainFiveIstles/Middle.obj"; + auto blendmap = AddComponent(ground_middle); + blendmap->TextureRed = "Textures/Ground/SoilBeach0087_11_S.jpg"; + blendmap->TextureRedNormal = "Textures/Ground/SoilBeach0087_11_SNM.png"; + blendmap->TextureGreen = "Textures/Ground/Grass0126_2_S.jpg"; + blendmap->TextureGreenNormal = "Textures/Ground/Grass0126_2_SNM.png"; + blendmap->TextureBlue = "Textures/Ground/Cliffs2.png"; + blendmap->TextureBlueNormal = "Textures/Ground/Cliffs2NM.png"; + blendmap->TextureRepeats = 30.f; + + auto physics = AddComponent(ground_middle); + physics->Mass = 10; + physics->Static = true; + physics->CollisionLayer = 1; + + auto groundshape = CreateEntity(ground_middle); + auto transformshape = AddComponent(groundshape); + auto meshShape = AddComponent(groundshape); + meshShape->ResourceName = "Models/TerrainFiveIstles/Middle.obj"; + + + CommitEntity(groundshape); + CommitEntity(ground_middle); + } + + { + auto ground_small = CreateEntity(); + auto transform = AddComponent(ground_small); + transform->Position = glm::vec3(0, -50, 0); + transform->Orientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f)); + auto model = AddComponent(ground_small); + model->ModelFile = "Models/TerrainFiveIstles/Small.obj"; + auto blendmap = AddComponent(ground_small); + blendmap->TextureRed = "Textures/Ground/SoilBeach0087_11_S.jpg"; + blendmap->TextureRedNormal = "Textures/Ground/SoilBeach0087_11_SNM.png"; + blendmap->TextureGreen = "Textures/Ground/Grass0126_2_S.jpg"; + blendmap->TextureGreenNormal = "Textures/Ground/Grass0126_2_SNM.png"; + blendmap->TextureBlue = "Textures/Ground/Cliffs2.png"; + blendmap->TextureBlueNormal = "Textures/Ground/Cliffs2NM.png"; + blendmap->TextureRepeats = 30.f; + + auto physics = AddComponent(ground_small); + physics->Mass = 10; + physics->Static = true; + physics->CollisionLayer = 1; + + auto groundshape = CreateEntity(ground_small); + auto transformshape = AddComponent(groundshape); + auto meshShape = AddComponent(groundshape); + meshShape->ResourceName = "Models/TerrainFiveIstles/Small.obj"; + + + CommitEntity(groundshape); + CommitEntity(ground_small); + } + + { + auto ground_small_mirrored = CreateEntity(); + auto transform = AddComponent(ground_small_mirrored); + transform->Position = glm::vec3(0, -50, 0); + transform->Orientation = glm::angleAxis(glm::radians(180.f), glm::vec3(0, 1, 0)); + auto model = AddComponent(ground_small_mirrored); + model->ModelFile = "Models/TerrainFiveIstles/Small.obj"; + auto blendmap = AddComponent(ground_small_mirrored); + blendmap->TextureRed = "Textures/Ground/SoilBeach0087_11_S.jpg"; + blendmap->TextureRedNormal = "Textures/Ground/SoilBeach0087_11_SNM.png"; + blendmap->TextureGreen = "Textures/Ground/Grass0126_2_S.jpg"; + blendmap->TextureGreenNormal = "Textures/Ground/Grass0126_2_SNM.png"; + blendmap->TextureBlue = "Textures/Ground/Cliffs2.png"; + blendmap->TextureBlueNormal = "Textures/Ground/Cliffs2NM.png"; + blendmap->TextureRepeats = 30.f; + + auto physics = AddComponent(ground_small_mirrored); + physics->Mass = 10; + physics->Static = true; + physics->CollisionLayer = 1; + + auto groundshape = CreateEntity(ground_small_mirrored); + auto transformshape = AddComponent(groundshape); + auto meshShape = AddComponent(groundshape); + meshShape->ResourceName = "Models/TerrainFiveIstles/Small.obj"; + + + CommitEntity(groundshape); + CommitEntity(ground_small_mirrored); + } + + { + auto ground_base = CreateEntity(); + auto transform = AddComponent(ground_base); + transform->Position = glm::vec3(0, -50, 0); + transform->Orientation = glm::quat(glm::vec3(0.0f, 0.0f, 0.0f)); + auto model = AddComponent(ground_base); + model->ModelFile = "Models/TerrainFiveIstles/Base.obj"; + auto blendmap = AddComponent(ground_base); + blendmap->TextureRed = "Textures/Ground/SoilBeach0087_11_S.jpg"; + blendmap->TextureRedNormal = "Textures/Ground/SoilBeach0087_11_SNM.png"; + blendmap->TextureGreen = "Textures/Ground/Grass0126_2_S.jpg"; + blendmap->TextureGreenNormal = "Textures/Ground/Grass0126_2_SNM.png"; + blendmap->TextureBlue = "Textures/Ground/Cliffs2.png"; + blendmap->TextureBlueNormal = "Textures/Ground/Cliffs2NM.png"; + blendmap->TextureRepeats = 30.f; + + auto physics = AddComponent(ground_base); + physics->Mass = 10; + physics->Static = true; + physics->CollisionLayer = 1; + + auto groundshape = CreateEntity(ground_base); + auto transformshape = AddComponent(groundshape); + auto meshShape = AddComponent(groundshape); + meshShape->ResourceName = "Models/TerrainFiveIstles/Base.obj"; + + + CommitEntity(groundshape); + CommitEntity(ground_base); + } + + { + auto ground_base_mirrored = CreateEntity(); + auto transform = AddComponent(ground_base_mirrored); + transform->Position = glm::vec3(0, -50, 0); + transform->Orientation = glm::angleAxis(glm::radians(180.f), glm::vec3(0, 1, 0)); + auto model = AddComponent(ground_base_mirrored); + model->ModelFile = "Models/TerrainFiveIstles/Base.obj"; + auto blendmap = AddComponent(ground_base_mirrored); + blendmap->TextureRed = "Textures/Ground/SoilBeach0087_11_S.jpg"; + blendmap->TextureRedNormal = "Textures/Ground/SoilBeach0087_11_SNM.png"; + blendmap->TextureGreen = "Textures/Ground/Grass0126_2_S.jpg"; + blendmap->TextureGreenNormal = "Textures/Ground/Grass0126_2_SNM.png"; + blendmap->TextureBlue = "Textures/Ground/Cliffs2.png"; + blendmap->TextureBlueNormal = "Textures/Ground/Cliffs2NM.png"; + blendmap->TextureRepeats = 30.f; + + auto physics = AddComponent(ground_base_mirrored); + physics->Mass = 10; + physics->Static = true; + physics->CollisionLayer = 1; + + auto groundshape = CreateEntity(ground_base_mirrored); + auto transformshape = AddComponent(groundshape); + auto meshShape = AddComponent(groundshape); + meshShape->ResourceName = "Models/TerrainFiveIstles/Base.obj"; + + + CommitEntity(groundshape); + CommitEntity(ground_base_mirrored); + } + + { + auto tree = CreateEntity(); + auto transform = AddComponent(tree); + transform->Position = glm::vec3(0, -15, 0); + auto model = AddComponent(tree); + model->ModelFile = "Models/Tree/leafs/Leafs.obj"; + model->Transparent = true; + + CommitEntity(tree); } EntityID tank1 = CreateTank(1); { auto transform = GetComponent(tank1); - transform->Position.z = 145.f; + transform->Position.z = 50; Events::SetViewportCamera e; e.CameraEntity = GetProperty(tank1, "Camera"); diff --git a/src/Renderer.cpp b/src/Renderer.cpp index f9dbe01..62626b7 100755 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -163,7 +163,7 @@ void Renderer::LoadContent() FrameBufferTextures(); m_sphereModel = ResourceManager->Load("Model", "Models/Placeholders/PhysicsTest/Sphere.obj"); - m_Skybox = std::make_shared("Textures/Skybox/Sunset", "jpg"); + m_Skybox = std::make_shared("Textures/Skybox/Sky34", "jpg"); } void Renderer::Draw(double dt) @@ -392,7 +392,7 @@ void Renderer::DrawWorld(RenderQueuePair &rq) glCullFace(GL_BACK); glEnable(GL_DEPTH_TEST); - DrawSkybox(); + //DrawSkybox(); DrawFBOScene(rq.Deferred); /* diff --git a/src/Shaders/Skybox.frag.glsl b/src/Shaders/Skybox.frag.glsl index 195fa21..0c97492 100755 --- a/src/Shaders/Skybox.frag.glsl +++ b/src/Shaders/Skybox.frag.glsl @@ -12,5 +12,4 @@ out vec4 FragColor; void main() { FragColor = texture(CubemapTexture, Input.TextureCoord); - //FragColor = vec4(1.0, 1.0, 1.0, 0.0); } \ No newline at end of file diff --git a/src/Systems/RenderSystem.cpp b/src/Systems/RenderSystem.cpp index e101f30..99acd91 100755 --- a/src/Systems/RenderSystem.cpp +++ b/src/Systems/RenderSystem.cpp @@ -15,6 +15,7 @@ void Systems::RenderSystem::RegisterComponents(ComponentFactory* cf) cf->Register([]() { return new Components::PointLight(); }); cf->Register([]() { return new Components::DirectionalLight(); }); cf->Register([]() { return new Components::Viewport(); }); + cf->Register([]() { return new Components::BlendMap(); }); } void Systems::RenderSystem::OnEntityCommit(EntityID entity) diff --git a/src/Systems/RenderSystem.h b/src/Systems/RenderSystem.h index e6350db..0829f29 100755 --- a/src/Systems/RenderSystem.h +++ b/src/Systems/RenderSystem.h @@ -20,6 +20,7 @@ #include "Renderer.h" #include "RenderQueue.h" #include "Events/SetViewportCamera.h" +#include "Components/BlendMap.h" namespace Systems {