diff --git a/first_app.cpp b/first_app.cpp index 2d34172..4b09d79 100644 --- a/first_app.cpp +++ b/first_app.cpp @@ -24,11 +24,6 @@ FirstApp::FirstApp() { FirstApp::~FirstApp() = default; void FirstApp::run() { - Engine::ECS::Entity entity = Engine::ECS::Entity::create(); - Engine::ECS::TestComponent *testComponent{new Engine::ECS::TestComponent()}; - entity.addComponent(testComponent); - entity.update(.0f); - Engine::ImGuiManager imGui{window, device, renderer.getSwapChainRenderPass(), renderer.getImageCount()}; std::vector> uboBuffers(Engine::SwapChain::MAX_FRAMES_IN_FLIGHT); @@ -80,7 +75,7 @@ void FirstApp::run() { camera.setViewYXZ(viewerObject.transform.translation, viewerObject.transform.rotation); float aspectRatio = renderer.getAspectRatio(); - camera.setProspectiveProjection(glm::radians(50.f), aspectRatio, .1f, 100.f); + camera.setProspectiveProjection(glm::radians(80.f), aspectRatio, .1f, 25.f); if (auto commandBuffer = renderer.beginFrame()) { imGui.newFrame(); @@ -108,8 +103,6 @@ void FirstApp::run() { renderSystem.renderGameObjects(frameInfo); pointLightSystem.render(frameInfo); - entity.update(frameTime); - // ImGui rendering imGui.run(frameInfo); imGui.render(commandBuffer); diff --git a/include/engine/Core.h b/include/engine/Core.h index 297c68d..33c26af 100644 --- a/include/engine/Core.h +++ b/include/engine/Core.h @@ -27,6 +27,7 @@ #include "ecs/IComponent.h" #include "ecs/TestComponent.h" #include "ecs/Entity.h" +#include "ecs/EntityManager.h" #include "systems/RenderSystem.h" #include "systems/PointLightSystem.h" diff --git a/include/engine/KeyboardMovementController.h b/include/engine/KeyboardMovementController.h index 96a5095..c327568 100644 --- a/include/engine/KeyboardMovementController.h +++ b/include/engine/KeyboardMovementController.h @@ -37,7 +37,7 @@ namespace Engine { private: KeyMappings keys{}; const float moveSpeed{3.f}; - const float lookSpeed{2.f}; + const float lookSpeed{3.f}; }; } diff --git a/json/game_state.json b/json/game_state.json index 67c9b2a..6720360 100644 --- a/json/game_state.json +++ b/json/game_state.json @@ -1,43 +1,43 @@ [ { "model": { - "file_name": "../models/quad.obj" + "file_name": "../models/smooth_vase.obj" }, - "name": "Grounda", + "name": "Vase", "transform": { "color": { - "x": 0.44999998807907104, - "y": 0.550000011920929, - "z": 0.6000000238418579 + "x": 0.0, + "y": 0.0, + "z": 0.0 }, "rotation": { "x": 0.0, "y": 0.0, - "z": 0.0 + "z": 0.7900000214576721 }, "scale": { - "x": 54.310001373291016, - "y": 54.310001373291016, - "z": 54.310001373291016 + "x": 1.0, + "y": 1.0, + "z": 1.0 }, "translation": { - "x": 6.0, - "y": 0.5, - "z": 0.0 + "x": -1.4600000381469727, + "y": -0.9399999976158142, + "z": 1.0 } } }, { - "intensity": 1.0, + "intensity": 10.0, "model": { "file_name": null }, - "name": "Point Lights", + "name": "Sun", "transform": { "color": { - "x": 0.02380955219268799, - "y": 1.0, - "z": 0.0 + "x": 0.9945054650306702, + "y": 0.9945001006126404, + "z": 0.9944955110549927 }, "rotation": { "x": 0.0, @@ -45,43 +45,42 @@ "z": 0.0 }, "scale": { - "x": 0.10000000149011612, - "y": 0.10000000149011612, - "z": 0.10000000149011612 + "x": 0.0, + "y": 0.0, + "z": 0.0 }, "translation": { - "x": -0.9700000286102295, - "y": 0.3199999928474426, - "z": 1.2699999809265137 + "x": 0.0, + "y": -6.260000228881836, + "z": 0.0 } } }, { - "intensity": 1.0, "model": { - "file_name": null + "file_name": "../models/cube.obj" }, - "name": "Point Light", + "name": "Cube", "transform": { "color": { - "x": 0.8791208863258362, - "y": 0.10626735538244247, - "z": 0.10626735538244247 - }, - "rotation": { "x": 0.0, "y": 0.0, "z": 0.0 }, + "rotation": { + "x": -0.4000000059604645, + "y": -1.1399999856948853, + "z": 0.0 + }, "scale": { - "x": 0.03999999910593033, - "y": 0.03999999910593033, - "z": 0.03999999910593033 + "x": 0.05000000074505806, + "y": 0.05000000074505806, + "z": 0.05000000074505806 }, "translation": { "x": 0.0, - "y": 0.0, - "z": 0.0 + "y": 0.4000000059604645, + "z": 0.4000000059604645 } } }, @@ -114,44 +113,45 @@ } }, { + "intensity": 1.0, "model": { - "file_name": "../models/cube.obj" + "file_name": null }, - "name": "Cube", + "name": "Point Light", "transform": { "color": { - "x": 0.0, - "y": 0.0, - "z": 0.0 + "x": 0.8791208863258362, + "y": 0.10626735538244247, + "z": 0.10626735538244247 }, "rotation": { - "x": -0.4000000059604645, - "y": -1.1399999856948853, + "x": 0.0, + "y": 0.0, "z": 0.0 }, "scale": { - "x": 0.05000000074505806, - "y": 0.05000000074505806, - "z": 0.05000000074505806 + "x": 0.03999999910593033, + "y": 0.03999999910593033, + "z": 0.03999999910593033 }, "translation": { "x": 0.0, - "y": 0.4000000059604645, - "z": 0.4000000059604645 + "y": 0.0, + "z": 0.0 } } }, { - "intensity": 10.0, + "intensity": 1.0, "model": { "file_name": null }, - "name": "Sun", + "name": "Point Lights", "transform": { "color": { - "x": 0.9945054650306702, - "y": 0.9945001006126404, - "z": 0.9944955110549927 + "x": 0.02380955219268799, + "y": 1.0, + "z": 0.0 }, "rotation": { "x": 0.0, @@ -159,42 +159,42 @@ "z": 0.0 }, "scale": { - "x": 0.0, - "y": 0.0, - "z": 0.0 + "x": 0.10000000149011612, + "y": 0.10000000149011612, + "z": 0.10000000149011612 }, "translation": { - "x": 0.0, - "y": -6.260000228881836, - "z": 0.0 + "x": -0.9700000286102295, + "y": 0.3199999928474426, + "z": 1.2699999809265137 } } }, { "model": { - "file_name": "../models/smooth_vase.obj" + "file_name": "../models/quad.obj" }, - "name": "smooth_vase.obj", + "name": "Grounda", "transform": { "color": { - "x": 0.0, - "y": 0.0, - "z": 0.0 + "x": 0.44999998807907104, + "y": 0.550000011920929, + "z": 0.6000000238418579 }, "rotation": { "x": 0.0, "y": 0.0, - "z": 0.7900000214576721 + "z": 0.0 }, "scale": { - "x": 1.0, - "y": 1.0, - "z": 1.0 + "x": 54.310001373291016, + "y": 54.310001373291016, + "z": 54.310001373291016 }, "translation": { - "x": -1.4600000381469727, - "y": -0.9399999976158142, - "z": 1.0 + "x": 6.0, + "y": 0.5, + "z": 0.0 } } } diff --git a/src/engine/Buffer.cpp b/src/engine/Buffer.cpp index c1bdeee..b959132 100644 --- a/src/engine/Buffer.cpp +++ b/src/engine/Buffer.cpp @@ -2,12 +2,13 @@ // Created by Jacopo Beragnoli on 16/04/22. // -#include "../../include/engine/Buffer.h" - -// std +// libs #include #include +// includes +#include "../../include/engine/Buffer.h" + namespace Engine { /** diff --git a/src/engine/Camera.cpp b/src/engine/Camera.cpp index f221e1c..2688721 100644 --- a/src/engine/Camera.cpp +++ b/src/engine/Camera.cpp @@ -2,10 +2,13 @@ // Created by Jacopo Beragnoli on 15/04/22. // -#include "../../include/engine/Camera.h" +// libs #include #include +// includes +#include "../../include/engine/Camera.h" + namespace Engine { void Camera::setOrthographicProjection(float left, float right, float top, float bottom, float near, float far) { diff --git a/src/engine/Descriptors.cpp b/src/engine/Descriptors.cpp index 30d913b..d814f76 100644 --- a/src/engine/Descriptors.cpp +++ b/src/engine/Descriptors.cpp @@ -2,10 +2,13 @@ // Created by Jacopo Beragnoli on 26/04/22. // -#include "../../include/engine/Descriptors.h" +// libs #include #include +// includes +#include "../../include/engine/Descriptors.h" + namespace Engine { // *************** Descriptor Set Layout Builder ********************* diff --git a/src/engine/Device.cpp b/src/engine/Device.cpp index 0cc0ef2..c2a2c21 100644 --- a/src/engine/Device.cpp +++ b/src/engine/Device.cpp @@ -2,9 +2,12 @@ // Created by Jacopo Beragnoli on 06/04/22. // +// libs #include #include #include + +// includes #include "../../include/engine/Device.h" #include "../../include/engine/exceptions/vulkan/FailedToFindVulkanSupportedGPUException.h" diff --git a/src/engine/GameObject.cpp b/src/engine/GameObject.cpp index c712ca1..a613e7d 100644 --- a/src/engine/GameObject.cpp +++ b/src/engine/GameObject.cpp @@ -2,6 +2,7 @@ // Created by Jacopo Beragnoli on 13/04/22. // +// includes #include "../../include/engine/GameObject.h" namespace Engine { diff --git a/src/engine/ImGuiManager.cpp b/src/engine/ImGuiManager.cpp index f377065..90d2372 100644 --- a/src/engine/ImGuiManager.cpp +++ b/src/engine/ImGuiManager.cpp @@ -2,10 +2,13 @@ // Created by Jacopo Beragnoli on 26/04/22. // -#include "../../include/engine/ImGuiManager.h" +// libs #include #include +// includes +#include "../../include/engine/ImGuiManager.h" + namespace Engine { ImGuiManager::ImGuiManager( Engine::Window &window, Engine::Device &device, VkRenderPass renderPass, uint32_t imageCount) diff --git a/src/engine/KeyboardMovementController.cpp b/src/engine/KeyboardMovementController.cpp index 29bc35a..dc31cbc 100644 --- a/src/engine/KeyboardMovementController.cpp +++ b/src/engine/KeyboardMovementController.cpp @@ -2,19 +2,21 @@ // Created by Jacopo Beragnoli on 15/04/22. // -#include "../../include/engine/KeyboardMovementController.h" - +// libs #include +// includes +#include "../../include/engine/KeyboardMovementController.h" + namespace Engine { void KeyboardMovementController::moveInPlaneXZ(GLFWwindow *glfWwindow, float dt, GameObject &gameObject) const { glm::vec3 rotate{0}; if (glfwGetKey(glfWwindow, keys.lookRight) == GLFW_PRESS) rotate.y += 1.f; - if (glfwGetKey(glfWwindow, keys.lookLeft) == GLFW_PRESS) rotate.y -= 1.f; - if (glfwGetKey(glfWwindow, keys.lookUp) == GLFW_PRESS) rotate.x += 1.f; - if (glfwGetKey(glfWwindow, keys.lookDown) == GLFW_PRESS) rotate.x -= 1.f; + if (glfwGetKey(glfWwindow, keys.lookLeft) == GLFW_PRESS) rotate.y -= 1.f; + if (glfwGetKey(glfWwindow, keys.lookUp) == GLFW_PRESS) rotate.x += 1.f; + if (glfwGetKey(glfWwindow, keys.lookDown) == GLFW_PRESS) rotate.x -= 1.f; if (glm::dot(rotate, rotate) > std::numeric_limits::epsilon()) gameObject.transform.rotation += lookSpeed * dt * glm::normalize(rotate); @@ -29,12 +31,12 @@ namespace Engine { const glm::vec3 upDir{0.f, -1.f, 0.f}; glm::vec3 moveDir{0.f}; - if (glfwGetKey(glfWwindow, keys.moveForward) == GLFW_PRESS) moveDir += forwardDir; + if (glfwGetKey(glfWwindow, keys.moveForward) == GLFW_PRESS) moveDir += forwardDir; if (glfwGetKey(glfWwindow, keys.moveBackward) == GLFW_PRESS) moveDir -= forwardDir; - if (glfwGetKey(glfWwindow, keys.moveRight) == GLFW_PRESS) moveDir += rightDir; - if (glfwGetKey(glfWwindow, keys.moveLeft) == GLFW_PRESS) moveDir -= rightDir; - if (glfwGetKey(glfWwindow, keys.moveUp) == GLFW_PRESS) moveDir += upDir; - if (glfwGetKey(glfWwindow, keys.moveDown) == GLFW_PRESS) moveDir -= upDir; + if (glfwGetKey(glfWwindow, keys.moveRight) == GLFW_PRESS) moveDir += rightDir; + if (glfwGetKey(glfWwindow, keys.moveLeft) == GLFW_PRESS) moveDir -= rightDir; + if (glfwGetKey(glfWwindow, keys.moveUp) == GLFW_PRESS) moveDir += upDir; + if (glfwGetKey(glfWwindow, keys.moveDown) == GLFW_PRESS) moveDir -= upDir; if (glm::dot(moveDir, moveDir) > std::numeric_limits::epsilon()) { gameObject.transform.translation += moveSpeed * dt * glm::normalize(moveDir); diff --git a/src/engine/Model.cpp b/src/engine/Model.cpp index 4898515..dee681a 100644 --- a/src/engine/Model.cpp +++ b/src/engine/Model.cpp @@ -2,17 +2,18 @@ // Created by Jacopo Beragnoli on 12/04/22. // -#include "../../include/engine/Model.h" - // libs #define TINYOBJLOADER_IMPLEMENTATION #include "../../include/libs/tiny_obj_loader.h" -#include "../../include/libs/stb_image.h" +#include "../../include/libs/stb_image.h" #include #include +// includes +#include "../../include/engine/Model.h" + namespace std { template<> struct hash { diff --git a/src/engine/Pipeline.cpp b/src/engine/Pipeline.cpp index 0203f28..92e363d 100644 --- a/src/engine/Pipeline.cpp +++ b/src/engine/Pipeline.cpp @@ -2,10 +2,13 @@ // Created by Jacopo Beragnoli on 05/04/22. // -#include "../../include/engine/Core.h" +// libs #include #include +// includes +#include "../../include/engine/Core.h" + namespace Engine { Pipeline::Pipeline(Engine::Device &device, const std::string &vertFilePath, const std::string &fragFilePath, const PipelineConfigInfo &configInfo) : device{device} { diff --git a/src/engine/SwapChain.cpp b/src/engine/SwapChain.cpp index 4550a4f..62097ac 100644 --- a/src/engine/SwapChain.cpp +++ b/src/engine/SwapChain.cpp @@ -13,11 +13,6 @@ // headers #include "../../include/engine/SwapChain.h" #include "../../include/engine/exceptions/vulkan/FailedToSubmitDrawCommandBufferException.h" -#include "../../include/engine/exceptions/vulkan/FailedToCreateSwapChainException.h" -#include "../../include/engine/exceptions/vulkan/FailedToCreateTextureImageViewException.h" -#include "../../include/engine/exceptions/vulkan/FailedToCreateSynchronizationObjectException.h" -#include "../../include/engine/exceptions/vulkan/FailedToCreateRenderPassException.h" -#include "../../include/engine/Buffer.h" namespace Engine { diff --git a/src/engine/ecs/Entity.cpp b/src/engine/ecs/Entity.cpp index 1d27200..07764fb 100644 --- a/src/engine/ecs/Entity.cpp +++ b/src/engine/ecs/Entity.cpp @@ -1,6 +1,8 @@ // // Created by Jacopo Beragnoli on 30/04/22. // + +// includes #include "../include/engine/ecs/Entity.h" namespace Engine::ECS { diff --git a/src/engine/ecs/EntityManager.cpp b/src/engine/ecs/EntityManager.cpp index 6a907f6..a21ab3a 100644 --- a/src/engine/ecs/EntityManager.cpp +++ b/src/engine/ecs/EntityManager.cpp @@ -2,6 +2,7 @@ // Created by Jacopo Beragnoli on 04/05/22. // +// includes #include "../../../include/engine/ecs/EntityManager.h" namespace Engine::ECS { diff --git a/src/engine/systems/PointLightSystem.cpp b/src/engine/systems/PointLightSystem.cpp index 25c95f0..b323d33 100644 --- a/src/engine/systems/PointLightSystem.cpp +++ b/src/engine/systems/PointLightSystem.cpp @@ -3,14 +3,15 @@ // // libs +#include + #define GLM_FORCE_RADIANS #define GLM_FORCE_DEPTH_ZERO_TO_ONE -#include #include #include -// headers +// includes #include "../../../include/engine/systems/PointLightSystem.h" #include "../../../include/engine/exceptions/vulkan/FailedToCreatePipeLineLayoutException.h" diff --git a/src/engine/systems/RenderSystem.cpp b/src/engine/systems/RenderSystem.cpp index fb45eaa..e18feeb 100644 --- a/src/engine/systems/RenderSystem.cpp +++ b/src/engine/systems/RenderSystem.cpp @@ -3,14 +3,15 @@ // // libs +#include + #define GLM_FORCE_RADIANS #define GLM_FORCE_DEPTH_ZERO_TO_ONE -#include #include #include -// headers +// includes #include "../../../include/engine/systems/RenderSystem.h" #include "../../../include/engine/exceptions/vulkan/FailedToCreatePipeLineLayoutException.h"