fixed rotation matrix

This commit is contained in:
2025-09-20 15:37:22 +03:00
parent 792db7a673
commit 03c514104e
2 changed files with 6 additions and 5 deletions

View File

@@ -15,6 +15,8 @@
#include <immintrin.h> #include <immintrin.h>
#endif #endif
#undef near
#undef far
namespace omath namespace omath
{ {
struct MatSize struct MatSize

View File

@@ -28,14 +28,13 @@ namespace omath::opengl_engine
} }
Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept
{ {
return mat_camera_view<float, MatStoreType::COLUMN_MAJOR>(-forward_vector(angles), right_vector(angles), return mat_look_at_right_handed(cam_origin, cam_origin+forward_vector(angles), up_vector(angles));
up_vector(angles), cam_origin);
} }
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
{ {
return mat_rotation_axis_x<float, MatStoreType::COLUMN_MAJOR>(-angles.pitch) return mat_rotation_axis_z<float, MatStoreType::COLUMN_MAJOR>(angles.roll)
* mat_rotation_axis_y<float, MatStoreType::COLUMN_MAJOR>(-angles.yaw) * mat_rotation_axis_y<float, MatStoreType::COLUMN_MAJOR>(angles.yaw)
* mat_rotation_axis_z<float, MatStoreType::COLUMN_MAJOR>(angles.roll); * mat_rotation_axis_x<float, MatStoreType::COLUMN_MAJOR>(angles.pitch);
} }
Mat4X4 calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near, Mat4X4 calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near,
const float far) noexcept const float far) noexcept