diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index defa978..5d6ba7c 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -182,19 +182,12 @@
-
-
-
-
-
-
-
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
index 79ee123..6e6eec1 100644
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -1,5 +1,6 @@
+
\ No newline at end of file
diff --git a/README.md b/README.md
index e78e420..d47e66d 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,8 @@ Oranges's Math Library (omath) is a comprehensive, open-source library aimed at
| Source | ✅YES |
| Unity | ✅YES |
| IWEngine | ✅YES |
-| Unreal | ❌NO |
+| OpenGL | ✅YES |
+| Unreal | ✅YES |
## Supported Operating Systems
diff --git a/source/engines/unreal_engine/formulas.cpp b/source/engines/unreal_engine/formulas.cpp
index 67788f0..90cb10d 100644
--- a/source/engines/unreal_engine/formulas.cpp
+++ b/source/engines/unreal_engine/formulas.cpp
@@ -30,9 +30,9 @@ namespace omath::unreal_engine
}
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
{
- return mat_rotation_axis_x(angles.pitch)
- * mat_rotation_axis_y(angles.yaw)
- * mat_rotation_axis_z(angles.roll);
+ return mat_rotation_axis_x(angles.roll)
+ * mat_rotation_axis_y(angles.pitch)
+ * mat_rotation_axis_z(angles.yaw);
}
Mat4X4 calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near,
const float far) noexcept
diff --git a/tests/engines/unit_test_unreal_engine.cpp b/tests/engines/unit_test_unreal_engine.cpp
index 12d601e..a57a936 100644
--- a/tests/engines/unit_test_unreal_engine.cpp
+++ b/tests/engines/unit_test_unreal_engine.cpp
@@ -1,3 +1,108 @@
//
// Created by Vlad on 8/25/2025.
//
+//
+// Created by Orange on 11/27/2024.
+//
+#include
+#include
+#include
+#include
+#include
+
+TEST(unit_test_unreal_engine, ForwardVector)
+{
+ const auto forward = omath::unreal_engine::forward_vector({});
+
+ EXPECT_EQ(forward, omath::unreal_engine::k_abs_forward);
+}
+
+TEST(unit_test_unreal_engine, ForwardVectorRotationYaw)
+{
+ omath::unreal_engine::ViewAngles angles;
+
+ angles.yaw = omath::unreal_engine::YawAngle::from_degrees(90.f);
+
+ const auto forward = omath::unreal_engine::forward_vector(angles);
+ EXPECT_NEAR(forward.x, omath::unreal_engine::k_abs_right.x, 0.00001f);
+ EXPECT_NEAR(forward.y, omath::unreal_engine::k_abs_right.y, 0.00001f);
+ EXPECT_NEAR(forward.z, omath::unreal_engine::k_abs_right.z, 0.00001f);
+}
+
+TEST(unit_test_unreal_engine, ForwardVectorRotationPitch)
+{
+ omath::unreal_engine::ViewAngles angles;
+
+ angles.pitch = omath::unreal_engine::PitchAngle::from_degrees(-90.f);
+
+ const auto forward = omath::unreal_engine::forward_vector(angles);
+ EXPECT_NEAR(forward.x, omath::unreal_engine::k_abs_up.x, 0.00001f);
+ EXPECT_NEAR(forward.y, omath::unreal_engine::k_abs_up.y, 0.00001f);
+ EXPECT_NEAR(forward.z, omath::unreal_engine::k_abs_up.z, 0.00001f);
+}
+
+TEST(unit_test_unreal_engine, ForwardVectorRotationRoll)
+{
+ omath::unreal_engine::ViewAngles angles;
+
+ angles.roll = omath::unreal_engine::RollAngle::from_degrees(-90.f);
+
+ const auto forward = omath::unreal_engine::up_vector(angles);
+ EXPECT_NEAR(forward.x, omath::unreal_engine::k_abs_right.x, 0.00001f);
+ EXPECT_NEAR(forward.y, omath::unreal_engine::k_abs_right.y, 0.00001f);
+ EXPECT_NEAR(forward.z, omath::unreal_engine::k_abs_right.z, 0.00001f);
+}
+
+TEST(unit_test_unreal_engine, RightVector)
+{
+ const auto right = omath::unreal_engine::right_vector({});
+
+ EXPECT_EQ(right, omath::unreal_engine::k_abs_right);
+}
+
+TEST(unit_test_unreal_engine, UpVector)
+{
+ const auto up = omath::unreal_engine::up_vector({});
+ EXPECT_EQ(up, omath::unreal_engine::k_abs_up);
+}
+
+TEST(unit_test_unreal_engine, ProjectTargetMovedFromCamera)
+{
+ constexpr auto fov = omath::projection::FieldOfView::from_degrees(60.f);
+ const auto cam = omath::unreal_engine::Camera({0, 0, 0}, {}, {1280.f, 720.f}, fov, 0.01f, 1000.f);
+
+
+ for (float distance = 0.02f; distance < 100.f; distance += 0.01f)
+ {
+ const auto projected = cam.world_to_screen({distance, 0, 0});
+
+ EXPECT_TRUE(projected.has_value());
+
+ if (!projected.has_value())
+ continue;
+
+ EXPECT_NEAR(projected->x, 640, 0.00001f);
+ EXPECT_NEAR(projected->y, 360, 0.00001f);
+ }
+}
+
+TEST(unit_test_unreal_engine, CameraSetAndGetFov)
+{
+ constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
+ auto cam = omath::unreal_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
+
+ EXPECT_EQ(cam.get_field_of_view().as_degrees(), 90.f);
+ cam.set_field_of_view(omath::projection::FieldOfView::from_degrees(50.f));
+
+ EXPECT_EQ(cam.get_field_of_view().as_degrees(), 50.f);
+}
+
+TEST(unit_test_unreal_engine, CameraSetAndGetOrigin)
+{
+ auto cam = omath::unreal_engine::Camera({0, 0, 0}, {}, {1920.f, 1080.f}, {}, 0.01f, 1000.f);
+
+ EXPECT_EQ(cam.get_origin(), omath::Vector3{});
+ cam.set_field_of_view(omath::projection::FieldOfView::from_degrees(50.f));
+
+ EXPECT_EQ(cam.get_field_of_view().as_degrees(), 50.f);
+}
\ No newline at end of file