From f5c271cfa6a8954b0be80f86beaaeff0bd0788d7 Mon Sep 17 00:00:00 2001 From: Orange Date: Mon, 17 Mar 2025 05:27:00 +0300 Subject: [PATCH] changed naming of engines section --- .../{OpenGL => opengl_engine}/Camera.hpp | 2 +- .../{OpenGL => opengl_engine}/Constants.hpp | 2 +- .../{OpenGL => opengl_engine}/Formulas.hpp | 2 +- .../{Source => source_engine}/Camera.hpp | 2 +- .../{Source => source_engine}/Constants.hpp | 3 ++- .../{Source => source_engine}/Formulas.hpp | 2 +- source/engines/CMakeLists.txt | 4 ++-- .../{OpenGL => opengl_engine}/CMakeLists.txt | 0 .../{OpenGL => opengl_engine}/Camera.cpp | 8 +++---- .../{Source => source_engine}/CMakeLists.txt | 0 .../{Source => source_engine}/Camera.cpp | 8 +++---- source/projectile_prediction/Projectile.cpp | 8 +++---- tests/engines/UnitTestOpenGL.cpp | 24 +++++++++---------- tests/engines/UnitTestSourceEngine.cpp | 24 +++++++++---------- tests/general/UnitTestProjection.cpp | 5 ++-- 15 files changed, 47 insertions(+), 47 deletions(-) rename include/omath/engines/{OpenGL => opengl_engine}/Camera.hpp (95%) rename include/omath/engines/{OpenGL => opengl_engine}/Constants.hpp (96%) rename include/omath/engines/{OpenGL => opengl_engine}/Formulas.hpp (98%) rename include/omath/engines/{Source => source_engine}/Camera.hpp (95%) rename include/omath/engines/{Source => source_engine}/Constants.hpp (96%) rename include/omath/engines/{Source => source_engine}/Formulas.hpp (98%) rename source/engines/{OpenGL => opengl_engine}/CMakeLists.txt (100%) rename source/engines/{OpenGL => opengl_engine}/Camera.cpp (84%) rename source/engines/{Source => source_engine}/CMakeLists.txt (100%) rename source/engines/{Source => source_engine}/Camera.cpp (84%) diff --git a/include/omath/engines/OpenGL/Camera.hpp b/include/omath/engines/opengl_engine/Camera.hpp similarity index 95% rename from include/omath/engines/OpenGL/Camera.hpp rename to include/omath/engines/opengl_engine/Camera.hpp index 0f3e7fb..bbe2902 100644 --- a/include/omath/engines/OpenGL/Camera.hpp +++ b/include/omath/engines/opengl_engine/Camera.hpp @@ -5,7 +5,7 @@ #include "Constants.hpp" #include "omath/projection/Camera.hpp" -namespace omath::opengl +namespace omath::opengl_engine { class Camera final : public projection::Camera { diff --git a/include/omath/engines/OpenGL/Constants.hpp b/include/omath/engines/opengl_engine/Constants.hpp similarity index 96% rename from include/omath/engines/OpenGL/Constants.hpp rename to include/omath/engines/opengl_engine/Constants.hpp index 6cedf43..d06873b 100644 --- a/include/omath/engines/OpenGL/Constants.hpp +++ b/include/omath/engines/opengl_engine/Constants.hpp @@ -8,7 +8,7 @@ #include #include -namespace omath::opengl +namespace omath::opengl_engine { constexpr Vector3 kAbsUp = {0, 1, 0}; constexpr Vector3 kAbsRight = {1, 0, 0}; diff --git a/include/omath/engines/OpenGL/Formulas.hpp b/include/omath/engines/opengl_engine/Formulas.hpp similarity index 98% rename from include/omath/engines/OpenGL/Formulas.hpp rename to include/omath/engines/opengl_engine/Formulas.hpp index c551619..b63ffdc 100644 --- a/include/omath/engines/OpenGL/Formulas.hpp +++ b/include/omath/engines/opengl_engine/Formulas.hpp @@ -5,7 +5,7 @@ #include "Constants.hpp" -namespace omath::opengl +namespace omath::opengl_engine { [[nodiscard]] inline Vector3 ForwardVector(const ViewAngles& angles) diff --git a/include/omath/engines/Source/Camera.hpp b/include/omath/engines/source_engine/Camera.hpp similarity index 95% rename from include/omath/engines/Source/Camera.hpp rename to include/omath/engines/source_engine/Camera.hpp index a0b9f77..fa7b2b2 100644 --- a/include/omath/engines/Source/Camera.hpp +++ b/include/omath/engines/source_engine/Camera.hpp @@ -5,7 +5,7 @@ #include "Constants.hpp" #include "omath/projection/Camera.hpp" -namespace omath::source +namespace omath::source_engine { class Camera final : public projection::Camera { diff --git a/include/omath/engines/Source/Constants.hpp b/include/omath/engines/source_engine/Constants.hpp similarity index 96% rename from include/omath/engines/Source/Constants.hpp rename to include/omath/engines/source_engine/Constants.hpp index c0a7b01..6c331b2 100644 --- a/include/omath/engines/Source/Constants.hpp +++ b/include/omath/engines/source_engine/Constants.hpp @@ -7,7 +7,8 @@ #include #include #include -namespace omath::source + +namespace omath::source_engine { constexpr Vector3 kAbsUp = {0, 0, 1}; constexpr Vector3 kAbsRight = {0, -1, 0}; diff --git a/include/omath/engines/Source/Formulas.hpp b/include/omath/engines/source_engine/Formulas.hpp similarity index 98% rename from include/omath/engines/Source/Formulas.hpp rename to include/omath/engines/source_engine/Formulas.hpp index 49b9166..9e27298 100644 --- a/include/omath/engines/Source/Formulas.hpp +++ b/include/omath/engines/source_engine/Formulas.hpp @@ -4,7 +4,7 @@ #pragma once #include "Constants.hpp" -namespace omath::source +namespace omath::source_engine { [[nodiscard]] inline Vector3 ForwardVector(const ViewAngles& angles) diff --git a/source/engines/CMakeLists.txt b/source/engines/CMakeLists.txt index 2d2a3c9..bfb0765 100644 --- a/source/engines/CMakeLists.txt +++ b/source/engines/CMakeLists.txt @@ -1,2 +1,2 @@ -add_subdirectory(Source) -add_subdirectory(OpenGL) \ No newline at end of file +add_subdirectory(source_engine) +add_subdirectory(opengl_engine) \ No newline at end of file diff --git a/source/engines/OpenGL/CMakeLists.txt b/source/engines/opengl_engine/CMakeLists.txt similarity index 100% rename from source/engines/OpenGL/CMakeLists.txt rename to source/engines/opengl_engine/CMakeLists.txt diff --git a/source/engines/OpenGL/Camera.cpp b/source/engines/opengl_engine/Camera.cpp similarity index 84% rename from source/engines/OpenGL/Camera.cpp rename to source/engines/opengl_engine/Camera.cpp index 17e12aa..d7bb7f4 100644 --- a/source/engines/OpenGL/Camera.cpp +++ b/source/engines/opengl_engine/Camera.cpp @@ -1,11 +1,11 @@ // // Created by Orange on 12/23/2024. // -#include "omath/engines/OpenGL/Camera.hpp" -#include "omath/engines/OpenGL/Formulas.hpp" +#include "omath/engines/opengl_engine/Camera.hpp" +#include "omath/engines/opengl_engine/Formulas.hpp" -namespace omath::opengl +namespace omath::opengl_engine { Camera::Camera(const Vector3& position, const ViewAngles& viewAngles, const projection::ViewPort& viewPort, @@ -25,7 +25,7 @@ namespace omath::opengl } Mat4x4 Camera::CalcViewMatrix() const { - return opengl::CalcViewMatrix(m_viewAngles, m_origin); + return opengl_engine::CalcViewMatrix(m_viewAngles, m_origin); } Mat4x4 Camera::CalcProjectionMatrix() const { diff --git a/source/engines/Source/CMakeLists.txt b/source/engines/source_engine/CMakeLists.txt similarity index 100% rename from source/engines/Source/CMakeLists.txt rename to source/engines/source_engine/CMakeLists.txt diff --git a/source/engines/Source/Camera.cpp b/source/engines/source_engine/Camera.cpp similarity index 84% rename from source/engines/Source/Camera.cpp rename to source/engines/source_engine/Camera.cpp index 1f00af5..2ea3240 100644 --- a/source/engines/Source/Camera.cpp +++ b/source/engines/source_engine/Camera.cpp @@ -1,11 +1,11 @@ // // Created by Orange on 12/4/2024. // -#include "omath/engines/Source/Camera.hpp" -#include "omath/engines/Source/Formulas.hpp" +#include "omath/engines/source_engine/Camera.hpp" +#include "omath/engines/source_engine/Formulas.hpp" -namespace omath::source +namespace omath::source_engine { Camera::Camera(const Vector3& position, const ViewAngles& viewAngles, const projection::ViewPort& viewPort, @@ -26,7 +26,7 @@ namespace omath::source Mat4x4 Camera::CalcViewMatrix() const { - return source::CalcViewMatrix(m_viewAngles, m_origin); + return source_engine::CalcViewMatrix(m_viewAngles, m_origin); } Mat4x4 Camera::CalcProjectionMatrix() const diff --git a/source/projectile_prediction/Projectile.cpp b/source/projectile_prediction/Projectile.cpp index dcf4c26..193b9a5 100644 --- a/source/projectile_prediction/Projectile.cpp +++ b/source/projectile_prediction/Projectile.cpp @@ -4,15 +4,15 @@ #include "omath/projectile_prediction/Projectile.hpp" -#include +#include namespace omath::projectile_prediction { Vector3 Projectile::PredictPosition(const float pitch, const float yaw, const float time, const float gravity) const { - auto currentPos = m_origin + source::ForwardVector({source::PitchAngle::FromDegrees(-pitch), - source::YawAngle::FromDegrees(yaw), - source::RollAngle::FromDegrees(0)}) * + auto currentPos = m_origin + source_engine::ForwardVector({source_engine::PitchAngle::FromDegrees(-pitch), + source_engine::YawAngle::FromDegrees(yaw), + source_engine::RollAngle::FromDegrees(0)}) * m_launchSpeed * time; currentPos.z -= (gravity * m_gravityScale) * (time * time) * 0.5f; diff --git a/tests/engines/UnitTestOpenGL.cpp b/tests/engines/UnitTestOpenGL.cpp index db748e8..ab42268 100644 --- a/tests/engines/UnitTestOpenGL.cpp +++ b/tests/engines/UnitTestOpenGL.cpp @@ -2,35 +2,35 @@ // Created by Orange on 11/23/2024. // #include -#include -#include -#include +#include +#include +#include TEST(UnitTestOpenGL, ForwardVector) { - const auto forward = omath::opengl::ForwardVector({}); + const auto forward = omath::opengl_engine::ForwardVector({}); - EXPECT_EQ(forward, omath::opengl::kAbsForward); + EXPECT_EQ(forward, omath::opengl_engine::kAbsForward); } TEST(UnitTestOpenGL, RightVector) { - const auto right = omath::opengl::RightVector({}); + const auto right = omath::opengl_engine::RightVector({}); - EXPECT_EQ(right, omath::opengl::kAbsRight); + EXPECT_EQ(right, omath::opengl_engine::kAbsRight); } TEST(UnitTestOpenGL, UpVector) { - const auto up = omath::opengl::UpVector({}); - EXPECT_EQ(up, omath::opengl::kAbsUp); + const auto up = omath::opengl_engine::UpVector({}); + EXPECT_EQ(up, omath::opengl_engine::kAbsUp); } TEST(UnitTestOpenGL, ProjectTargetMovedFromCamera) { constexpr auto fov = omath::projection::FieldOfView::FromDegrees(90.f); - auto cam = omath::opengl::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); + const auto cam = omath::opengl_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); for (float distance = -10.f; distance > -1000.f; distance -= 0.01f) @@ -50,7 +50,7 @@ TEST(UnitTestOpenGL, ProjectTargetMovedFromCamera) TEST(UnitTestOpenGL, CameraSetAndGetFov) { constexpr auto fov = omath::projection::FieldOfView::FromDegrees(90.f); - auto cam = omath::opengl::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); + auto cam = omath::opengl_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); EXPECT_EQ(cam.GetFieldOfView().AsDegrees(), 90.f); cam.SetFieldOfView(omath::projection::FieldOfView::FromDegrees(50.f)); @@ -60,7 +60,7 @@ TEST(UnitTestOpenGL, CameraSetAndGetFov) TEST(UnitTestOpenGL, CameraSetAndGetOrigin) { - auto cam = omath::opengl::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f); + auto cam = omath::opengl_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f); EXPECT_EQ(cam.GetOrigin(), omath::Vector3{}); cam.SetFieldOfView(omath::projection::FieldOfView::FromDegrees(50.f)); diff --git a/tests/engines/UnitTestSourceEngine.cpp b/tests/engines/UnitTestSourceEngine.cpp index 876557e..7d4d71a 100644 --- a/tests/engines/UnitTestSourceEngine.cpp +++ b/tests/engines/UnitTestSourceEngine.cpp @@ -2,35 +2,35 @@ // Created by Orange on 11/23/2024. // #include -#include -#include -#include +#include +#include +#include TEST(UnitTestSourceEngine, ForwardVector) { - const auto forward = omath::source::ForwardVector({}); + const auto forward = omath::source_engine::ForwardVector({}); - EXPECT_EQ(forward, omath::source::kAbsForward); + EXPECT_EQ(forward, omath::source_engine::kAbsForward); } TEST(UnitTestSourceEngine, RightVector) { - const auto right = omath::source::RightVector({}); + const auto right = omath::source_engine::RightVector({}); - EXPECT_EQ(right, omath::source::kAbsRight); + EXPECT_EQ(right, omath::source_engine::kAbsRight); } TEST(UnitTestSourceEngine, UpVector) { - const auto up = omath::source::UpVector({}); - EXPECT_EQ(up, omath::source::kAbsUp); + const auto up = omath::source_engine::UpVector({}); + EXPECT_EQ(up, omath::source_engine::kAbsUp); } TEST(UnitTestSourceEngine, ProjectTargetMovedFromCamera) { constexpr auto fov = omath::projection::FieldOfView::FromDegrees(90.f); - auto cam = omath::source::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); + const auto cam = omath::source_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); for (float distance = 0.02f; distance < 1000.f; distance += 0.01f) @@ -50,7 +50,7 @@ TEST(UnitTestSourceEngine, ProjectTargetMovedFromCamera) TEST(UnitTestSourceEngine, CameraSetAndGetFov) { constexpr auto fov = omath::projection::FieldOfView::FromDegrees(90.f); - auto cam = omath::source::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); + auto cam = omath::source_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); EXPECT_EQ(cam.GetFieldOfView().AsDegrees(), 90.f); cam.SetFieldOfView(omath::projection::FieldOfView::FromDegrees(50.f)); @@ -60,7 +60,7 @@ TEST(UnitTestSourceEngine, CameraSetAndGetFov) TEST(UnitTestSourceEngine, CameraSetAndGetOrigin) { - auto cam = omath::source::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f); + auto cam = omath::source_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f); EXPECT_EQ(cam.GetOrigin(), omath::Vector3{}); cam.SetFieldOfView(omath::projection::FieldOfView::FromDegrees(50.f)); diff --git a/tests/general/UnitTestProjection.cpp b/tests/general/UnitTestProjection.cpp index 3d9b507..65819e0 100644 --- a/tests/general/UnitTestProjection.cpp +++ b/tests/general/UnitTestProjection.cpp @@ -3,15 +3,14 @@ // #include #include -#include -#include +#include #include #include TEST(UnitTestProjection, Projection) { const auto x = omath::Angle::FromDegrees(90.f); - auto cam = omath::source::Camera({0, 0, 0}, omath::source::ViewAngles{}, {1920.f, 1080.f}, x, 0.01f, 1000.f); + auto cam = omath::source_engine::Camera({0, 0, 0}, omath::source_engine::ViewAngles{}, {1920.f, 1080.f}, x, 0.01f, 1000.f); const auto projected = cam.WorldToScreen({1000, 0, 50}); std::print("{} {} {}", projected->x, projected->y, projected->z);