diff --git a/include/omath/linear_algebra/mat.hpp b/include/omath/linear_algebra/mat.hpp index 50d6cf7..08e8f89 100644 --- a/include/omath/linear_algebra/mat.hpp +++ b/include/omath/linear_algebra/mat.hpp @@ -15,6 +15,8 @@ #include #endif +#undef near +#undef far namespace omath { struct MatSize diff --git a/source/engines/opengl_engine/formulas.cpp b/source/engines/opengl_engine/formulas.cpp index 4a14ab2..da8ab49 100644 --- a/source/engines/opengl_engine/formulas.cpp +++ b/source/engines/opengl_engine/formulas.cpp @@ -28,14 +28,13 @@ namespace omath::opengl_engine } Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { - return mat_camera_view(-forward_vector(angles), right_vector(angles), - up_vector(angles), cam_origin); + return mat_look_at_right_handed(cam_origin, cam_origin+forward_vector(angles), up_vector(angles)); } 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_z(angles.roll) + * mat_rotation_axis_y(angles.yaw) + * mat_rotation_axis_x(angles.pitch); } Mat4X4 calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near, const float far) noexcept