From fee4e4b9e315ee1426b09d61e3c0557c115db4c8 Mon Sep 17 00:00:00 2001 From: Orange Date: Mon, 15 Jun 2026 20:31:57 +0300 Subject: [PATCH] added even more missing nodiscard messages --- .../engines/cry_engine/traits/camera_trait.hpp | 6 +++--- .../omath/engines/cry_engine/traits/mesh_trait.hpp | 2 +- .../engines/cry_engine/traits/pred_engine_trait.hpp | 13 +++++++------ .../frostbite_engine/traits/camera_trait.hpp | 6 +++--- .../engines/frostbite_engine/traits/mesh_trait.hpp | 2 +- .../frostbite_engine/traits/pred_engine_trait.hpp | 13 +++++++------ .../omath/engines/iw_engine/traits/camera_trait.hpp | 6 +++--- .../omath/engines/iw_engine/traits/mesh_trait.hpp | 2 +- .../engines/iw_engine/traits/pred_engine_trait.hpp | 13 +++++++------ .../engines/opengl_engine/traits/camera_trait.hpp | 6 +++--- .../engines/opengl_engine/traits/mesh_trait.hpp | 2 +- .../opengl_engine/traits/pred_engine_trait.hpp | 13 +++++++------ .../engines/rage_engine/traits/camera_trait.hpp | 6 +++--- .../omath/engines/rage_engine/traits/mesh_trait.hpp | 2 +- .../rage_engine/traits/pred_engine_trait.hpp | 13 +++++++------ .../engines/source_engine/traits/camera_trait.hpp | 6 +++--- .../engines/source_engine/traits/mesh_trait.hpp | 2 +- .../source_engine/traits/pred_engine_trait.hpp | 13 +++++++------ .../engines/unity_engine/traits/camera_trait.hpp | 6 +++--- .../engines/unity_engine/traits/mesh_trait.hpp | 2 +- .../unity_engine/traits/pred_engine_trait.hpp | 13 +++++++------ .../engines/unreal_engine/traits/camera_trait.hpp | 6 +++--- .../engines/unreal_engine/traits/mesh_trait.hpp | 2 +- .../unreal_engine/traits/pred_engine_trait.hpp | 13 +++++++------ 24 files changed, 88 insertions(+), 80 deletions(-) diff --git a/include/omath/engines/cry_engine/traits/camera_trait.hpp b/include/omath/engines/cry_engine/traits/camera_trait.hpp index 2f9f751..ebcb965 100644 --- a/include/omath/engines/cry_engine/traits/camera_trait.hpp +++ b/include/omath/engines/cry_engine/traits/camera_trait.hpp @@ -11,7 +11,7 @@ namespace omath::cry_engine class CameraTrait final { public: - [[nodiscard]] + [[nodiscard("look-at angle result should not be discarded")]] constexpr static ViewAngles calc_look_at_angle(const Vector3& cam_origin, const Vector3& look_at) noexcept { @@ -20,12 +20,12 @@ namespace omath::cry_engine YawAngle::from_radians(-internal::atan2(direction.x, direction.y)), RollAngle::from_radians(0.f)}; } - [[nodiscard]] + [[nodiscard("view matrix result should not be discarded")]] constexpr static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { return cry_engine::calc_view_matrix(angles, cam_origin); } - [[nodiscard]] + [[nodiscard("projection matrix result should not be discarded")]] constexpr static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port, const float near_plane, const float far_plane, diff --git a/include/omath/engines/cry_engine/traits/mesh_trait.hpp b/include/omath/engines/cry_engine/traits/mesh_trait.hpp index 200c068..4b93b96 100644 --- a/include/omath/engines/cry_engine/traits/mesh_trait.hpp +++ b/include/omath/engines/cry_engine/traits/mesh_trait.hpp @@ -10,7 +10,7 @@ namespace omath::cry_engine class MeshTrait final { public: - [[nodiscard]] + [[nodiscard("rotation matrix result should not be discarded")]] static Mat4X4 rotation_matrix(const ViewAngles& rotation) { return cry_engine::rotation_matrix(rotation); diff --git a/include/omath/engines/cry_engine/traits/pred_engine_trait.hpp b/include/omath/engines/cry_engine/traits/pred_engine_trait.hpp index 13f58c6..f703a09 100644 --- a/include/omath/engines/cry_engine/traits/pred_engine_trait.hpp +++ b/include/omath/engines/cry_engine/traits/pred_engine_trait.hpp @@ -12,6 +12,7 @@ namespace omath::cry_engine class PredEngineTrait final { public: + [[nodiscard("projectile position result should not be discarded")]] constexpr static Vector3 predict_projectile_position(const projectile_prediction::Projectile& projectile, const float pitch, const float yaw, const float time, const float gravity) noexcept @@ -25,7 +26,7 @@ namespace omath::cry_engine return current_pos; } - [[nodiscard]] + [[nodiscard("target position result should not be discarded")]] static constexpr Vector3 predict_target_position(const projectile_prediction::Target& target, const float time, const float gravity) noexcept { @@ -36,19 +37,19 @@ namespace omath::cry_engine return predicted; } - [[nodiscard]] + [[nodiscard("2d distance result should not be discarded")]] static float calc_vector_2d_distance(const Vector3& delta) noexcept { return std::sqrt(delta.x * delta.x + delta.y * delta.y); } - [[nodiscard]] + [[nodiscard("height coordinate result should not be discarded")]] constexpr static float get_vector_height_coordinate(const Vector3& vec) noexcept { return vec.z; } - [[nodiscard]] + [[nodiscard("viewpoint result should not be discarded")]] static Vector3 calc_viewpoint_from_angles(const projectile_prediction::Projectile& projectile, Vector3 predicted_target_position, const std::optional projectile_pitch) noexcept @@ -60,13 +61,13 @@ namespace omath::cry_engine } // Due to specification of maybe_calculate_projectile_launch_pitch_angle, pitch angle must be: // 89 look up, -89 look down - [[nodiscard]] + [[nodiscard("pitch angle result should not be discarded")]] static float calc_direct_pitch_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); return angles::radians_to_degrees(std::asin(direction.z)); } - [[nodiscard]] + [[nodiscard("yaw angle result should not be discarded")]] static float calc_direct_yaw_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); diff --git a/include/omath/engines/frostbite_engine/traits/camera_trait.hpp b/include/omath/engines/frostbite_engine/traits/camera_trait.hpp index 2e3074d..9adaeed 100644 --- a/include/omath/engines/frostbite_engine/traits/camera_trait.hpp +++ b/include/omath/engines/frostbite_engine/traits/camera_trait.hpp @@ -12,7 +12,7 @@ namespace omath::frostbite_engine class CameraTrait final { public: - [[nodiscard]] + [[nodiscard("look-at angle result should not be discarded")]] constexpr static ViewAngles calc_look_at_angle(const Vector3& cam_origin, const Vector3& look_at) noexcept { @@ -22,12 +22,12 @@ namespace omath::frostbite_engine YawAngle::from_radians(internal::atan2(direction.x, direction.z)), RollAngle::from_radians(0.f)}; } - [[nodiscard]] + [[nodiscard("view matrix result should not be discarded")]] constexpr static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { return frostbite_engine::calc_view_matrix(angles, cam_origin); } - [[nodiscard]] + [[nodiscard("projection matrix result should not be discarded")]] constexpr static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port, const float near_plane, const float far_plane, diff --git a/include/omath/engines/frostbite_engine/traits/mesh_trait.hpp b/include/omath/engines/frostbite_engine/traits/mesh_trait.hpp index e113c4e..0fb1106 100644 --- a/include/omath/engines/frostbite_engine/traits/mesh_trait.hpp +++ b/include/omath/engines/frostbite_engine/traits/mesh_trait.hpp @@ -10,7 +10,7 @@ namespace omath::frostbite_engine class MeshTrait final { public: - [[nodiscard]] + [[nodiscard("rotation matrix result should not be discarded")]] static Mat4X4 rotation_matrix(const ViewAngles& rotation) { return frostbite_engine::rotation_matrix(rotation); diff --git a/include/omath/engines/frostbite_engine/traits/pred_engine_trait.hpp b/include/omath/engines/frostbite_engine/traits/pred_engine_trait.hpp index 4e6197c..e500ae2 100644 --- a/include/omath/engines/frostbite_engine/traits/pred_engine_trait.hpp +++ b/include/omath/engines/frostbite_engine/traits/pred_engine_trait.hpp @@ -12,6 +12,7 @@ namespace omath::frostbite_engine class PredEngineTrait final { public: + [[nodiscard("projectile position result should not be discarded")]] constexpr static Vector3 predict_projectile_position(const projectile_prediction::Projectile& projectile, const float pitch, const float yaw, const float time, const float gravity) noexcept @@ -25,7 +26,7 @@ namespace omath::frostbite_engine return current_pos; } - [[nodiscard]] + [[nodiscard("target position result should not be discarded")]] static constexpr Vector3 predict_target_position(const projectile_prediction::Target& target, const float time, const float gravity) noexcept { @@ -36,19 +37,19 @@ namespace omath::frostbite_engine return predicted; } - [[nodiscard]] + [[nodiscard("2d distance result should not be discarded")]] static float calc_vector_2d_distance(const Vector3& delta) noexcept { return std::sqrt(delta.x * delta.x + delta.z * delta.z); } - [[nodiscard]] + [[nodiscard("height coordinate result should not be discarded")]] constexpr static float get_vector_height_coordinate(const Vector3& vec) noexcept { return vec.y; } - [[nodiscard]] + [[nodiscard("viewpoint result should not be discarded")]] static Vector3 calc_viewpoint_from_angles(const projectile_prediction::Projectile& projectile, Vector3 predicted_target_position, const std::optional projectile_pitch) noexcept @@ -60,13 +61,13 @@ namespace omath::frostbite_engine } // Due to specification of maybe_calculate_projectile_launch_pitch_angle, pitch angle must be: // 89 look up, -89 look down - [[nodiscard]] + [[nodiscard("pitch angle result should not be discarded")]] static float calc_direct_pitch_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); return angles::radians_to_degrees(std::asin(direction.y)); } - [[nodiscard]] + [[nodiscard("yaw angle result should not be discarded")]] static float calc_direct_yaw_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); diff --git a/include/omath/engines/iw_engine/traits/camera_trait.hpp b/include/omath/engines/iw_engine/traits/camera_trait.hpp index 0143ea2..dec6bd4 100644 --- a/include/omath/engines/iw_engine/traits/camera_trait.hpp +++ b/include/omath/engines/iw_engine/traits/camera_trait.hpp @@ -12,7 +12,7 @@ namespace omath::iw_engine class CameraTrait final { public: - [[nodiscard]] + [[nodiscard("look-at angle result should not be discarded")]] constexpr static ViewAngles calc_look_at_angle(const Vector3& cam_origin, const Vector3& look_at) noexcept { @@ -22,12 +22,12 @@ namespace omath::iw_engine YawAngle::from_radians(internal::atan2(direction.y, direction.x)), RollAngle::from_radians(0.f)}; } - [[nodiscard]] + [[nodiscard("view matrix result should not be discarded")]] constexpr static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { return iw_engine::calc_view_matrix(angles, cam_origin); } - [[nodiscard]] + [[nodiscard("projection matrix result should not be discarded")]] constexpr static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port, const float near_plane, const float far_plane, diff --git a/include/omath/engines/iw_engine/traits/mesh_trait.hpp b/include/omath/engines/iw_engine/traits/mesh_trait.hpp index 4cbc5c9..907c477 100644 --- a/include/omath/engines/iw_engine/traits/mesh_trait.hpp +++ b/include/omath/engines/iw_engine/traits/mesh_trait.hpp @@ -10,7 +10,7 @@ namespace omath::iw_engine class MeshTrait final { public: - [[nodiscard]] + [[nodiscard("rotation matrix result should not be discarded")]] static Mat4X4 rotation_matrix(const ViewAngles& rotation) { return iw_engine::rotation_matrix(rotation); diff --git a/include/omath/engines/iw_engine/traits/pred_engine_trait.hpp b/include/omath/engines/iw_engine/traits/pred_engine_trait.hpp index 5b441b9..c522094 100644 --- a/include/omath/engines/iw_engine/traits/pred_engine_trait.hpp +++ b/include/omath/engines/iw_engine/traits/pred_engine_trait.hpp @@ -13,6 +13,7 @@ namespace omath::iw_engine class PredEngineTrait final { public: + [[nodiscard("projectile position result should not be discarded")]] constexpr static Vector3 predict_projectile_position(const projectile_prediction::Projectile& projectile, const float pitch, const float yaw, const float time, const float gravity) noexcept @@ -26,7 +27,7 @@ namespace omath::iw_engine return current_pos; } - [[nodiscard]] + [[nodiscard("target position result should not be discarded")]] static constexpr Vector3 predict_target_position(const projectile_prediction::Target& target, const float time, const float gravity) noexcept { @@ -37,19 +38,19 @@ namespace omath::iw_engine return predicted; } - [[nodiscard]] + [[nodiscard("2d distance result should not be discarded")]] static float calc_vector_2d_distance(const Vector3& delta) noexcept { return std::sqrt(delta.x * delta.x + delta.y * delta.y); } - [[nodiscard]] + [[nodiscard("height coordinate result should not be discarded")]] constexpr static float get_vector_height_coordinate(const Vector3& vec) noexcept { return vec.z; } - [[nodiscard]] + [[nodiscard("viewpoint result should not be discarded")]] static Vector3 calc_viewpoint_from_angles(const projectile_prediction::Projectile& projectile, Vector3 predicted_target_position, const std::optional projectile_pitch) noexcept @@ -61,7 +62,7 @@ namespace omath::iw_engine } // Due to specification of maybe_calculate_projectile_launch_pitch_angle, pitch angle must be: // 89 look up, -89 look down - [[nodiscard]] + [[nodiscard("pitch angle result should not be discarded")]] static float calc_direct_pitch_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto distance = origin.distance_to(view_to); @@ -69,7 +70,7 @@ namespace omath::iw_engine return angles::radians_to_degrees(std::asin(delta.z / distance)); } - [[nodiscard]] + [[nodiscard("yaw angle result should not be discarded")]] static float calc_direct_yaw_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto delta = view_to - origin; diff --git a/include/omath/engines/opengl_engine/traits/camera_trait.hpp b/include/omath/engines/opengl_engine/traits/camera_trait.hpp index d953297..027d887 100644 --- a/include/omath/engines/opengl_engine/traits/camera_trait.hpp +++ b/include/omath/engines/opengl_engine/traits/camera_trait.hpp @@ -12,7 +12,7 @@ namespace omath::opengl_engine class CameraTrait final { public: - [[nodiscard]] + [[nodiscard("look-at angle result should not be discarded")]] constexpr static ViewAngles calc_look_at_angle(const Vector3& cam_origin, const Vector3& look_at) noexcept { @@ -22,12 +22,12 @@ namespace omath::opengl_engine YawAngle::from_radians(-internal::atan2(direction.x, -direction.z)), RollAngle::from_radians(0.f)}; } - [[nodiscard]] + [[nodiscard("view matrix result should not be discarded")]] constexpr static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { return opengl_engine::calc_view_matrix(angles, cam_origin); } - [[nodiscard]] + [[nodiscard("projection matrix result should not be discarded")]] constexpr static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port, const float near_plane, const float far_plane, diff --git a/include/omath/engines/opengl_engine/traits/mesh_trait.hpp b/include/omath/engines/opengl_engine/traits/mesh_trait.hpp index 2de8f8e..8f2809d 100644 --- a/include/omath/engines/opengl_engine/traits/mesh_trait.hpp +++ b/include/omath/engines/opengl_engine/traits/mesh_trait.hpp @@ -10,7 +10,7 @@ namespace omath::opengl_engine class MeshTrait final { public: - [[nodiscard]] + [[nodiscard("rotation matrix result should not be discarded")]] static Mat4X4 rotation_matrix(const ViewAngles& rotation) { return opengl_engine::rotation_matrix(rotation); diff --git a/include/omath/engines/opengl_engine/traits/pred_engine_trait.hpp b/include/omath/engines/opengl_engine/traits/pred_engine_trait.hpp index f9f463f..01b6707 100644 --- a/include/omath/engines/opengl_engine/traits/pred_engine_trait.hpp +++ b/include/omath/engines/opengl_engine/traits/pred_engine_trait.hpp @@ -12,6 +12,7 @@ namespace omath::opengl_engine class PredEngineTrait final { public: + [[nodiscard("projectile position result should not be discarded")]] constexpr static Vector3 predict_projectile_position(const projectile_prediction::Projectile& projectile, const float pitch, const float yaw, const float time, const float gravity) noexcept @@ -25,7 +26,7 @@ namespace omath::opengl_engine return current_pos; } - [[nodiscard]] + [[nodiscard("target position result should not be discarded")]] static constexpr Vector3 predict_target_position(const projectile_prediction::Target& target, const float time, const float gravity) noexcept { @@ -36,19 +37,19 @@ namespace omath::opengl_engine return predicted; } - [[nodiscard]] + [[nodiscard("2d distance result should not be discarded")]] static float calc_vector_2d_distance(const Vector3& delta) noexcept { return std::sqrt(delta.x * delta.x + delta.z * delta.z); } - [[nodiscard]] + [[nodiscard("height coordinate result should not be discarded")]] constexpr static float get_vector_height_coordinate(const Vector3& vec) noexcept { return vec.y; } - [[nodiscard]] + [[nodiscard("viewpoint result should not be discarded")]] static Vector3 calc_viewpoint_from_angles(const projectile_prediction::Projectile& projectile, Vector3 predicted_target_position, const std::optional projectile_pitch) noexcept @@ -60,13 +61,13 @@ namespace omath::opengl_engine } // Due to specification of maybe_calculate_projectile_launch_pitch_angle, pitch angle must be: // 89 look up, -89 look down - [[nodiscard]] + [[nodiscard("pitch angle result should not be discarded")]] static float calc_direct_pitch_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); return angles::radians_to_degrees(std::asin(direction.y)); } - [[nodiscard]] + [[nodiscard("yaw angle result should not be discarded")]] static float calc_direct_yaw_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); diff --git a/include/omath/engines/rage_engine/traits/camera_trait.hpp b/include/omath/engines/rage_engine/traits/camera_trait.hpp index 55643fb..38341ab 100644 --- a/include/omath/engines/rage_engine/traits/camera_trait.hpp +++ b/include/omath/engines/rage_engine/traits/camera_trait.hpp @@ -12,7 +12,7 @@ namespace omath::rage_engine class CameraTrait final { public: - [[nodiscard]] + [[nodiscard("look-at angle result should not be discarded")]] constexpr static ViewAngles calc_look_at_angle(const Vector3& cam_origin, const Vector3& look_at) noexcept { @@ -22,12 +22,12 @@ namespace omath::rage_engine YawAngle::from_radians(-internal::atan2(direction.x, direction.y)), RollAngle::from_radians(0.f)}; } - [[nodiscard]] + [[nodiscard("view matrix result should not be discarded")]] constexpr static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { return rage_engine::calc_view_matrix(angles, cam_origin); } - [[nodiscard]] + [[nodiscard("projection matrix result should not be discarded")]] constexpr static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port, const float near_plane, const float far_plane, diff --git a/include/omath/engines/rage_engine/traits/mesh_trait.hpp b/include/omath/engines/rage_engine/traits/mesh_trait.hpp index 86c8c13..46a3014 100644 --- a/include/omath/engines/rage_engine/traits/mesh_trait.hpp +++ b/include/omath/engines/rage_engine/traits/mesh_trait.hpp @@ -11,7 +11,7 @@ namespace omath::rage_engine class MeshTrait final { public: - [[nodiscard]] + [[nodiscard("rotation matrix result should not be discarded")]] static Mat4X4 rotation_matrix(const ViewAngles& rotation) { return rage_engine::rotation_matrix(rotation); diff --git a/include/omath/engines/rage_engine/traits/pred_engine_trait.hpp b/include/omath/engines/rage_engine/traits/pred_engine_trait.hpp index 0d91646..81cc2f5 100644 --- a/include/omath/engines/rage_engine/traits/pred_engine_trait.hpp +++ b/include/omath/engines/rage_engine/traits/pred_engine_trait.hpp @@ -13,6 +13,7 @@ namespace omath::rage_engine class PredEngineTrait final { public: + [[nodiscard("projectile position result should not be discarded")]] constexpr static Vector3 predict_projectile_position(const projectile_prediction::Projectile& projectile, const float pitch, const float yaw, const float time, const float gravity) noexcept @@ -26,7 +27,7 @@ namespace omath::rage_engine return current_pos; } - [[nodiscard]] + [[nodiscard("target position result should not be discarded")]] static constexpr Vector3 predict_target_position(const projectile_prediction::Target& target, const float time, const float gravity) noexcept { @@ -37,19 +38,19 @@ namespace omath::rage_engine return predicted; } - [[nodiscard]] + [[nodiscard("2d distance result should not be discarded")]] static float calc_vector_2d_distance(const Vector3& delta) noexcept { return std::sqrt(delta.x * delta.x + delta.y * delta.y); } - [[nodiscard]] + [[nodiscard("height coordinate result should not be discarded")]] constexpr static float get_vector_height_coordinate(const Vector3& vec) noexcept { return vec.z; } - [[nodiscard]] + [[nodiscard("viewpoint result should not be discarded")]] static Vector3 calc_viewpoint_from_angles(const projectile_prediction::Projectile& projectile, Vector3 predicted_target_position, const std::optional projectile_pitch) noexcept @@ -59,13 +60,13 @@ namespace omath::rage_engine return {predicted_target_position.x, predicted_target_position.y, projectile.m_origin.z + height}; } - [[nodiscard]] + [[nodiscard("pitch angle result should not be discarded")]] static float calc_direct_pitch_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); return angles::radians_to_degrees(std::asin(direction.z)); } - [[nodiscard]] + [[nodiscard("yaw angle result should not be discarded")]] static float calc_direct_yaw_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); diff --git a/include/omath/engines/source_engine/traits/camera_trait.hpp b/include/omath/engines/source_engine/traits/camera_trait.hpp index 8e65621..8fe501b 100644 --- a/include/omath/engines/source_engine/traits/camera_trait.hpp +++ b/include/omath/engines/source_engine/traits/camera_trait.hpp @@ -12,7 +12,7 @@ namespace omath::source_engine class CameraTrait final { public: - [[nodiscard]] + [[nodiscard("look-at angle result should not be discarded")]] constexpr static ViewAngles calc_look_at_angle(const Vector3& cam_origin, const Vector3& look_at) noexcept { @@ -22,12 +22,12 @@ namespace omath::source_engine YawAngle::from_radians(internal::atan2(direction.y, direction.x)), RollAngle::from_radians(0.f)}; } - [[nodiscard]] + [[nodiscard("view matrix result should not be discarded")]] constexpr static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { return source_engine::calc_view_matrix(angles, cam_origin); } - [[nodiscard]] + [[nodiscard("projection matrix result should not be discarded")]] constexpr static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port, const float near_plane, const float far_plane, diff --git a/include/omath/engines/source_engine/traits/mesh_trait.hpp b/include/omath/engines/source_engine/traits/mesh_trait.hpp index 2320465..d7ac81c 100644 --- a/include/omath/engines/source_engine/traits/mesh_trait.hpp +++ b/include/omath/engines/source_engine/traits/mesh_trait.hpp @@ -10,7 +10,7 @@ namespace omath::source_engine class MeshTrait final { public: - [[nodiscard]] + [[nodiscard("rotation matrix result should not be discarded")]] static Mat4X4 rotation_matrix(const ViewAngles& rotation) { return source_engine::rotation_matrix(rotation); diff --git a/include/omath/engines/source_engine/traits/pred_engine_trait.hpp b/include/omath/engines/source_engine/traits/pred_engine_trait.hpp index ef4144c..3fa8dcd 100644 --- a/include/omath/engines/source_engine/traits/pred_engine_trait.hpp +++ b/include/omath/engines/source_engine/traits/pred_engine_trait.hpp @@ -13,6 +13,7 @@ namespace omath::source_engine class PredEngineTrait final { public: + [[nodiscard("projectile position result should not be discarded")]] constexpr static Vector3 predict_projectile_position(const projectile_prediction::Projectile& projectile, const float pitch, const float yaw, const float time, const float gravity) noexcept @@ -26,7 +27,7 @@ namespace omath::source_engine return current_pos; } - [[nodiscard]] + [[nodiscard("target position result should not be discarded")]] static constexpr Vector3 predict_target_position(const projectile_prediction::Target& target, const float time, const float gravity) noexcept { @@ -37,19 +38,19 @@ namespace omath::source_engine return predicted; } - [[nodiscard]] + [[nodiscard("2d distance result should not be discarded")]] static float calc_vector_2d_distance(const Vector3& delta) noexcept { return std::sqrt(delta.x * delta.x + delta.y * delta.y); } - [[nodiscard]] + [[nodiscard("height coordinate result should not be discarded")]] constexpr static float get_vector_height_coordinate(const Vector3& vec) noexcept { return vec.z; } - [[nodiscard]] + [[nodiscard("viewpoint result should not be discarded")]] static Vector3 calc_viewpoint_from_angles(const projectile_prediction::Projectile& projectile, Vector3 predicted_target_position, const std::optional projectile_pitch) noexcept @@ -61,7 +62,7 @@ namespace omath::source_engine } // Due to specification of maybe_calculate_projectile_launch_pitch_angle, pitch angle must be: // 89 look up, -89 look down - [[nodiscard]] + [[nodiscard("pitch angle result should not be discarded")]] static float calc_direct_pitch_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto distance = origin.distance_to(view_to); @@ -69,7 +70,7 @@ namespace omath::source_engine return angles::radians_to_degrees(std::asin(delta.z / distance)); } - [[nodiscard]] + [[nodiscard("yaw angle result should not be discarded")]] static float calc_direct_yaw_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto delta = view_to - origin; diff --git a/include/omath/engines/unity_engine/traits/camera_trait.hpp b/include/omath/engines/unity_engine/traits/camera_trait.hpp index bf59185..eeddfad 100644 --- a/include/omath/engines/unity_engine/traits/camera_trait.hpp +++ b/include/omath/engines/unity_engine/traits/camera_trait.hpp @@ -12,7 +12,7 @@ namespace omath::unity_engine class CameraTrait final { public: - [[nodiscard]] + [[nodiscard("look-at angle result should not be discarded")]] constexpr static ViewAngles calc_look_at_angle(const Vector3& cam_origin, const Vector3& look_at) noexcept { @@ -22,12 +22,12 @@ namespace omath::unity_engine YawAngle::from_radians(internal::atan2(direction.x, direction.z)), RollAngle::from_radians(0.f)}; } - [[nodiscard]] + [[nodiscard("view matrix result should not be discarded")]] constexpr static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { return unity_engine::calc_view_matrix(angles, cam_origin); } - [[nodiscard]] + [[nodiscard("projection matrix result should not be discarded")]] constexpr static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port, const float near_plane, const float far_plane, diff --git a/include/omath/engines/unity_engine/traits/mesh_trait.hpp b/include/omath/engines/unity_engine/traits/mesh_trait.hpp index 5627820..4aa0da0 100644 --- a/include/omath/engines/unity_engine/traits/mesh_trait.hpp +++ b/include/omath/engines/unity_engine/traits/mesh_trait.hpp @@ -10,7 +10,7 @@ namespace omath::unity_engine class MeshTrait final { public: - [[nodiscard]] + [[nodiscard("rotation matrix result should not be discarded")]] static Mat4X4 rotation_matrix(const ViewAngles& rotation) { return unity_engine::rotation_matrix(rotation); diff --git a/include/omath/engines/unity_engine/traits/pred_engine_trait.hpp b/include/omath/engines/unity_engine/traits/pred_engine_trait.hpp index 8c71141..ea088e8 100644 --- a/include/omath/engines/unity_engine/traits/pred_engine_trait.hpp +++ b/include/omath/engines/unity_engine/traits/pred_engine_trait.hpp @@ -12,6 +12,7 @@ namespace omath::unity_engine class PredEngineTrait final { public: + [[nodiscard("projectile position result should not be discarded")]] constexpr static Vector3 predict_projectile_position(const projectile_prediction::Projectile& projectile, const float pitch, const float yaw, const float time, const float gravity) noexcept @@ -25,7 +26,7 @@ namespace omath::unity_engine return current_pos; } - [[nodiscard]] + [[nodiscard("target position result should not be discarded")]] static constexpr Vector3 predict_target_position(const projectile_prediction::Target& target, const float time, const float gravity) noexcept { @@ -36,19 +37,19 @@ namespace omath::unity_engine return predicted; } - [[nodiscard]] + [[nodiscard("2d distance result should not be discarded")]] static float calc_vector_2d_distance(const Vector3& delta) noexcept { return std::sqrt(delta.x * delta.x + delta.z * delta.z); } - [[nodiscard]] + [[nodiscard("height coordinate result should not be discarded")]] constexpr static float get_vector_height_coordinate(const Vector3& vec) noexcept { return vec.y; } - [[nodiscard]] + [[nodiscard("viewpoint result should not be discarded")]] static Vector3 calc_viewpoint_from_angles(const projectile_prediction::Projectile& projectile, Vector3 predicted_target_position, const std::optional projectile_pitch) noexcept @@ -60,13 +61,13 @@ namespace omath::unity_engine } // Due to specification of maybe_calculate_projectile_launch_pitch_angle, pitch angle must be: // 89 look up, -89 look down - [[nodiscard]] + [[nodiscard("pitch angle result should not be discarded")]] static float calc_direct_pitch_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); return angles::radians_to_degrees(std::asin(direction.y)); } - [[nodiscard]] + [[nodiscard("yaw angle result should not be discarded")]] static float calc_direct_yaw_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); diff --git a/include/omath/engines/unreal_engine/traits/camera_trait.hpp b/include/omath/engines/unreal_engine/traits/camera_trait.hpp index 8498a29..1b4a862 100644 --- a/include/omath/engines/unreal_engine/traits/camera_trait.hpp +++ b/include/omath/engines/unreal_engine/traits/camera_trait.hpp @@ -12,7 +12,7 @@ namespace omath::unreal_engine class CameraTrait final { public: - [[nodiscard]] + [[nodiscard("look-at angle result should not be discarded")]] constexpr static ViewAngles calc_look_at_angle(const Vector3& cam_origin, const Vector3& look_at) noexcept { @@ -22,12 +22,12 @@ namespace omath::unreal_engine YawAngle::from_radians(internal::atan2(direction.y, direction.x)), RollAngle::from_radians(0.f)}; } - [[nodiscard]] + [[nodiscard("view matrix result should not be discarded")]] constexpr static Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3& cam_origin) noexcept { return unreal_engine::calc_view_matrix(angles, cam_origin); } - [[nodiscard]] + [[nodiscard("projection matrix result should not be discarded")]] constexpr static Mat4X4 calc_projection_matrix(const projection::FieldOfView& fov, const projection::ViewPort& view_port, const double near_plane, const double far_plane, diff --git a/include/omath/engines/unreal_engine/traits/mesh_trait.hpp b/include/omath/engines/unreal_engine/traits/mesh_trait.hpp index 5da0a2d..16a74b3 100644 --- a/include/omath/engines/unreal_engine/traits/mesh_trait.hpp +++ b/include/omath/engines/unreal_engine/traits/mesh_trait.hpp @@ -10,7 +10,7 @@ namespace omath::unreal_engine class MeshTrait final { public: - [[nodiscard]] + [[nodiscard("rotation matrix result should not be discarded")]] static Mat4X4 rotation_matrix(const ViewAngles& rotation) { return unreal_engine::rotation_matrix(rotation); diff --git a/include/omath/engines/unreal_engine/traits/pred_engine_trait.hpp b/include/omath/engines/unreal_engine/traits/pred_engine_trait.hpp index b98b65d..5068ad9 100644 --- a/include/omath/engines/unreal_engine/traits/pred_engine_trait.hpp +++ b/include/omath/engines/unreal_engine/traits/pred_engine_trait.hpp @@ -12,6 +12,7 @@ namespace omath::unreal_engine class PredEngineTrait final { public: + [[nodiscard("projectile position result should not be discarded")]] static Vector3 predict_projectile_position(const projectile_prediction::Projectile& projectile, const double pitch, const double yaw, const double time, const double gravity) noexcept @@ -27,7 +28,7 @@ namespace omath::unreal_engine return current_pos; } - [[nodiscard]] + [[nodiscard("target position result should not be discarded")]] static Vector3 predict_target_position(const projectile_prediction::Target& target, const double time, const double gravity) noexcept { @@ -39,19 +40,19 @@ namespace omath::unreal_engine return predicted; } - [[nodiscard]] + [[nodiscard("2d distance result should not be discarded")]] static double calc_vector_2d_distance(const Vector3& delta) noexcept { return std::sqrt(delta.x * delta.x + delta.z * delta.z); } - [[nodiscard]] + [[nodiscard("height coordinate result should not be discarded")]] static double get_vector_height_coordinate(const Vector3& vec) noexcept { return vec.y; } - [[nodiscard]] + [[nodiscard("viewpoint result should not be discarded")]] static Vector3 calc_viewpoint_from_angles(const projectile_prediction::Projectile& projectile, Vector3 predicted_target_position, const std::optional projectile_pitch) noexcept @@ -64,7 +65,7 @@ namespace omath::unreal_engine // Due to specification of maybe_calculate_projectile_launch_pitch_angle, pitch angle must be: // 89 look up, -89 look down - [[nodiscard]] + [[nodiscard("pitch angle result should not be discarded")]] static double calc_direct_pitch_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized(); @@ -72,7 +73,7 @@ namespace omath::unreal_engine return angles::radians_to_degrees(std::asin(direction.z)); } - [[nodiscard]] + [[nodiscard("yaw angle result should not be discarded")]] static double calc_direct_yaw_angle(const Vector3& origin, const Vector3& view_to) noexcept { const auto direction = (view_to - origin).normalized();