From 52024285d25cdc07b9432a057115ec3915c4c5fe Mon Sep 17 00:00:00 2001 From: Orange Date: Tue, 13 May 2025 09:34:39 +0300 Subject: [PATCH] added noexcept --- include/omath/engines/iw_engine/formulas.hpp | 12 ++++++------ source/engines/iw_engine/formulas.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/omath/engines/iw_engine/formulas.hpp b/include/omath/engines/iw_engine/formulas.hpp index 424621f..433987d 100644 --- a/include/omath/engines/iw_engine/formulas.hpp +++ b/include/omath/engines/iw_engine/formulas.hpp @@ -8,19 +8,19 @@ namespace omath::iw_engine { [[nodiscard]] - Vector3 forward_vector(const ViewAngles& angles); + Vector3 forward_vector(const ViewAngles& angles) noexcept; [[nodiscard]] - Vector3 right_vector(const ViewAngles& angles); + Vector3 right_vector(const ViewAngles& angles) noexcept; [[nodiscard]] - Vector3 up_vector(const ViewAngles& angles); + Vector3 up_vector(const ViewAngles& angles) noexcept; [[nodiscard]] - Mat4X4 rotation_matrix(const ViewAngles& angles); + Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept; - [[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin); + [[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept; [[nodiscard]] - Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far); + Mat4X4 calc_perspective_projection_matrix(float field_of_view, float aspect_ratio, float near, float far) noexcept; } // namespace omath::iw_engine diff --git a/source/engines/iw_engine/formulas.cpp b/source/engines/iw_engine/formulas.cpp index 37635dc..c346d50 100644 --- a/source/engines/iw_engine/formulas.cpp +++ b/source/engines/iw_engine/formulas.cpp @@ -6,37 +6,37 @@ namespace omath::iw_engine { - Vector3 forward_vector(const ViewAngles& angles) + Vector3 forward_vector(const ViewAngles& angles) noexcept { const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_forward); return {vec.at(0, 0), vec.at(1, 0), vec.at(2, 0)}; } - Vector3 right_vector(const ViewAngles& angles) + Vector3 right_vector(const ViewAngles& angles) noexcept { const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_right); return {vec.at(0, 0), vec.at(1, 0), vec.at(2, 0)}; } - Vector3 up_vector(const ViewAngles& angles) + Vector3 up_vector(const ViewAngles& angles) noexcept { const auto vec = rotation_matrix(angles) * mat_column_from_vector(k_abs_up); return {vec.at(0, 0), vec.at(1, 0), vec.at(2, 0)}; } - Mat4X4 rotation_matrix(const ViewAngles& angles) + Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept { return mat_rotation_axis_z(angles.yaw) * mat_rotation_axis_y(angles.pitch) * mat_rotation_axis_x(angles.roll); } - Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) + 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); } Mat4X4 calc_perspective_projection_matrix(const float field_of_view, const float aspect_ratio, const float near, - const float far) + const float far) noexcept { // NOTE: Need magic number to fix fov calculation, since IW engine inherit Quake proj matrix calculation constexpr auto k_multiply_factor = 0.75f;