added even more missing nodiscard messages

This commit is contained in:
2026-06-15 20:31:57 +03:00
parent 2779bae82f
commit fee4e4b9e3
24 changed files with 88 additions and 80 deletions
@@ -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<float>& cam_origin,
const Vector3<float>& 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<float>& 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,
@@ -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);
@@ -12,6 +12,7 @@ namespace omath::cry_engine
class PredEngineTrait final
{
public:
[[nodiscard("projectile position result should not be discarded")]]
constexpr static Vector3<float> predict_projectile_position(const projectile_prediction::Projectile<float>& 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<float> predict_target_position(const projectile_prediction::Target<float>& 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<float>& 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<float>& vec) noexcept
{
return vec.z;
}
[[nodiscard]]
[[nodiscard("viewpoint result should not be discarded")]]
static Vector3<float> calc_viewpoint_from_angles(const projectile_prediction::Projectile<float>& projectile,
Vector3<float> predicted_target_position,
const std::optional<float> 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<float>& origin, const Vector3<float>& 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<float>& origin, const Vector3<float>& view_to) noexcept
{
const auto direction = (view_to - origin).normalized();
@@ -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<float>& cam_origin,
const Vector3<float>& 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<float>& 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,
@@ -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);
@@ -12,6 +12,7 @@ namespace omath::frostbite_engine
class PredEngineTrait final
{
public:
[[nodiscard("projectile position result should not be discarded")]]
constexpr static Vector3<float> predict_projectile_position(const projectile_prediction::Projectile<float>& 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<float> predict_target_position(const projectile_prediction::Target<float>& 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<float>& 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<float>& vec) noexcept
{
return vec.y;
}
[[nodiscard]]
[[nodiscard("viewpoint result should not be discarded")]]
static Vector3<float> calc_viewpoint_from_angles(const projectile_prediction::Projectile<float>& projectile,
Vector3<float> predicted_target_position,
const std::optional<float> 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<float>& origin, const Vector3<float>& 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<float>& origin, const Vector3<float>& view_to) noexcept
{
const auto direction = (view_to - origin).normalized();
@@ -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<float>& cam_origin,
const Vector3<float>& 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<float>& 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,
@@ -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);
@@ -13,6 +13,7 @@ namespace omath::iw_engine
class PredEngineTrait final
{
public:
[[nodiscard("projectile position result should not be discarded")]]
constexpr static Vector3<float> predict_projectile_position(const projectile_prediction::Projectile<float>& 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<float> predict_target_position(const projectile_prediction::Target<float>& 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<float>& 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<float>& vec) noexcept
{
return vec.z;
}
[[nodiscard]]
[[nodiscard("viewpoint result should not be discarded")]]
static Vector3<float> calc_viewpoint_from_angles(const projectile_prediction::Projectile<float>& projectile,
Vector3<float> predicted_target_position,
const std::optional<float> 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<float>& origin, const Vector3<float>& 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<float>& origin, const Vector3<float>& view_to) noexcept
{
const auto delta = view_to - origin;
@@ -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<float>& cam_origin,
const Vector3<float>& 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<float>& 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,
@@ -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);
@@ -12,6 +12,7 @@ namespace omath::opengl_engine
class PredEngineTrait final
{
public:
[[nodiscard("projectile position result should not be discarded")]]
constexpr static Vector3<float> predict_projectile_position(const projectile_prediction::Projectile<float>& 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<float> predict_target_position(const projectile_prediction::Target<float>& 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<float>& 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<float>& vec) noexcept
{
return vec.y;
}
[[nodiscard]]
[[nodiscard("viewpoint result should not be discarded")]]
static Vector3<float> calc_viewpoint_from_angles(const projectile_prediction::Projectile<float>& projectile,
Vector3<float> predicted_target_position,
const std::optional<float> 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<float>& origin, const Vector3<float>& 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<float>& origin, const Vector3<float>& view_to) noexcept
{
const auto direction = (view_to - origin).normalized();
@@ -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<float>& cam_origin,
const Vector3<float>& 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<float>& 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,
@@ -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);
@@ -13,6 +13,7 @@ namespace omath::rage_engine
class PredEngineTrait final
{
public:
[[nodiscard("projectile position result should not be discarded")]]
constexpr static Vector3<float>
predict_projectile_position(const projectile_prediction::Projectile<float>& 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<float> predict_target_position(const projectile_prediction::Target<float>& 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<float>& 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<float>& vec) noexcept
{
return vec.z;
}
[[nodiscard]]
[[nodiscard("viewpoint result should not be discarded")]]
static Vector3<float> calc_viewpoint_from_angles(const projectile_prediction::Projectile<float>& projectile,
Vector3<float> predicted_target_position,
const std::optional<float> 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<float>& origin, const Vector3<float>& 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<float>& origin, const Vector3<float>& view_to) noexcept
{
const auto direction = (view_to - origin).normalized();
@@ -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<float>& cam_origin,
const Vector3<float>& 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<float>& 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,
@@ -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);
@@ -13,6 +13,7 @@ namespace omath::source_engine
class PredEngineTrait final
{
public:
[[nodiscard("projectile position result should not be discarded")]]
constexpr static Vector3<float> predict_projectile_position(const projectile_prediction::Projectile<float>& 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<float> predict_target_position(const projectile_prediction::Target<float>& 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<float>& 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<float>& vec) noexcept
{
return vec.z;
}
[[nodiscard]]
[[nodiscard("viewpoint result should not be discarded")]]
static Vector3<float> calc_viewpoint_from_angles(const projectile_prediction::Projectile<float>& projectile,
Vector3<float> predicted_target_position,
const std::optional<float> 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<float>& origin, const Vector3<float>& 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<float>& origin, const Vector3<float>& view_to) noexcept
{
const auto delta = view_to - origin;
@@ -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<float>& cam_origin,
const Vector3<float>& 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<float>& 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,
@@ -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);
@@ -12,6 +12,7 @@ namespace omath::unity_engine
class PredEngineTrait final
{
public:
[[nodiscard("projectile position result should not be discarded")]]
constexpr static Vector3<float> predict_projectile_position(const projectile_prediction::Projectile<float>& 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<float> predict_target_position(const projectile_prediction::Target<float>& 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<float>& 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<float>& vec) noexcept
{
return vec.y;
}
[[nodiscard]]
[[nodiscard("viewpoint result should not be discarded")]]
static Vector3<float> calc_viewpoint_from_angles(const projectile_prediction::Projectile<float>& projectile,
Vector3<float> predicted_target_position,
const std::optional<float> 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<float>& origin, const Vector3<float>& 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<float>& origin, const Vector3<float>& view_to) noexcept
{
const auto direction = (view_to - origin).normalized();
@@ -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<double>& cam_origin,
const Vector3<double>& 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<double>& 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,
@@ -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);
@@ -12,6 +12,7 @@ namespace omath::unreal_engine
class PredEngineTrait final
{
public:
[[nodiscard("projectile position result should not be discarded")]]
static Vector3<double> predict_projectile_position(const projectile_prediction::Projectile<double>& 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<double> predict_target_position(const projectile_prediction::Target<double>& 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<double>& 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<double>& vec) noexcept
{
return vec.y;
}
[[nodiscard]]
[[nodiscard("viewpoint result should not be discarded")]]
static Vector3<double> calc_viewpoint_from_angles(const projectile_prediction::Projectile<double>& projectile,
Vector3<double> predicted_target_position,
const std::optional<double> 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<double>& origin, const Vector3<double>& 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<double>& origin, const Vector3<double>& view_to) noexcept
{
const auto direction = (view_to - origin).normalized();