added more noexcept

This commit is contained in:
2025-05-05 01:46:50 +03:00
parent a6e4c0461d
commit 50ddf2d31e
25 changed files with 79 additions and 79 deletions

View File

@@ -13,5 +13,5 @@ namespace omath::primitives
[[nodiscard]]
std::array<Triangle<Vector3<float>>, 12> create_box(const Vector3<float>& top, const Vector3<float>& bottom,
const Vector3<float>& dir_forward, const Vector3<float>& dir_right,
float ratio = 4.f);
float ratio = 4.f) noexcept;
}

View File

@@ -16,10 +16,10 @@ namespace omath::collision
bool infinite_length = false;
[[nodiscard]]
Vector3<float> direction_vector() const;
Vector3<float> direction_vector() const noexcept;
[[nodiscard]]
Vector3<float> direction_vector_normalized() const;
Vector3<float> direction_vector_normalized() const noexcept;
};
class LineTracer
{
@@ -27,11 +27,11 @@ namespace omath::collision
LineTracer() = delete;
[[nodiscard]]
static bool can_trace_line(const Ray& ray, const Triangle<Vector3<float>>& triangle);
static bool can_trace_line(const Ray& ray, const Triangle<Vector3<float>>& triangle) noexcept;
// Realization of MöllerTrumbore intersection algorithm
// https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm
[[nodiscard]]
static Vector3<float> get_ray_hit_point(const Ray& ray, const Triangle<Vector3<float>>& triangle);
static Vector3<float> get_ray_hit_point(const Ray& ray, const Triangle<Vector3<float>>& triangle) noexcept;
};
} // namespace omath::collision

View File

@@ -16,7 +16,7 @@ namespace omath::iw_engine
void look_at(const Vector3<float>& target) override;
protected:
[[nodiscard]] Mat4X4 calc_view_matrix() const override;
[[nodiscard]] Mat4X4 calc_projection_matrix() const override;
[[nodiscard]] Mat4X4 calc_view_matrix() const noexcept override;
[[nodiscard]] Mat4X4 calc_projection_matrix() const noexcept override;
};
} // namespace omath::iw_engine

View File

@@ -13,7 +13,7 @@ namespace omath::opengl_engine
Camera(const Vector3<float>& position, const ViewAngles& view_angles, const projection::ViewPort& view_port,
const Angle<float, 0.f, 180.f, AngleFlags::Clamped>& fov, float near, float far);
void look_at(const Vector3<float>& target) override;
[[nodiscard]] Mat4X4 calc_view_matrix() const override;
[[nodiscard]] Mat4X4 calc_projection_matrix() const override;
[[nodiscard]] Mat4X4 calc_view_matrix() const noexcept override;
[[nodiscard]] Mat4X4 calc_projection_matrix() const noexcept override;
};
} // namespace omath::opengl_engine

View File

@@ -8,19 +8,19 @@
namespace omath::opengl_engine
{
[[nodiscard]]
Vector3<float> forward_vector(const ViewAngles& angles);
Vector3<float> forward_vector(const ViewAngles& angles) noexcept;
[[nodiscard]]
Vector3<float> right_vector(const ViewAngles& angles);
Vector3<float> right_vector(const ViewAngles& angles) noexcept;
[[nodiscard]]
Vector3<float> up_vector(const ViewAngles& angles);
Vector3<float> up_vector(const ViewAngles& angles) noexcept;
[[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin);
[[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept;
[[nodiscard]]
Mat4X4 rotation_matrix(const ViewAngles& angles);
Mat4X4 rotation_matrix(const ViewAngles& angles) 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::opengl_engine

View File

@@ -15,7 +15,7 @@ namespace omath::source_engine
void look_at(const Vector3<float>& target) override;
protected:
[[nodiscard]] Mat4X4 calc_view_matrix() const override;
[[nodiscard]] Mat4X4 calc_projection_matrix() const override;
[[nodiscard]] Mat4X4 calc_view_matrix() const noexcept override;
[[nodiscard]] Mat4X4 calc_projection_matrix() const noexcept override;
};
} // namespace omath::source_engine

View File

@@ -7,19 +7,19 @@
namespace omath::source_engine
{
[[nodiscard]]
Vector3<float> forward_vector(const ViewAngles& angles);
Vector3<float> forward_vector(const ViewAngles& angles) noexcept;
[[nodiscard]]
Mat4X4 rotation_matrix(const ViewAngles& angles);
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept;
[[nodiscard]]
Vector3<float> right_vector(const ViewAngles& angles);
Vector3<float> right_vector(const ViewAngles& angles) noexcept;
[[nodiscard]]
Vector3<float> up_vector(const ViewAngles& angles);
Vector3<float> up_vector(const ViewAngles& angles) noexcept;
[[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin);
[[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& 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::source_engine

View File

@@ -16,7 +16,7 @@ namespace omath::unity_engine
void look_at(const Vector3<float>& target) override;
protected:
[[nodiscard]] Mat4X4 calc_view_matrix() const override;
[[nodiscard]] Mat4X4 calc_projection_matrix() const override;
[[nodiscard]] Mat4X4 calc_view_matrix() const noexcept override;
[[nodiscard]] Mat4X4 calc_projection_matrix() const noexcept override;
};
} // namespace omath::unity_engine

View File

@@ -8,19 +8,19 @@
namespace omath::unity_engine
{
[[nodiscard]]
Vector3<float> forward_vector(const ViewAngles& angles);
Vector3<float> forward_vector(const ViewAngles& angles) noexcept;
[[nodiscard]]
Vector3<float> right_vector(const ViewAngles& angles);
Vector3<float> right_vector(const ViewAngles& angles) noexcept;
[[nodiscard]]
Vector3<float> up_vector(const ViewAngles& angles);
Vector3<float> up_vector(const ViewAngles& angles) noexcept;
[[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin);
[[nodiscard]] Mat4X4 calc_view_matrix(const ViewAngles& angles, const Vector3<float>& cam_origin) noexcept;
[[nodiscard]]
Mat4X4 rotation_matrix(const ViewAngles& angles);
Mat4X4 rotation_matrix(const ViewAngles& angles) 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::unity_engine

View File

@@ -9,8 +9,8 @@ namespace omath::projectile_prediction
class ProjPredEngineAvx2 final : public ProjPredEngine
{
public:
[[nodiscard]] std::optional<Vector3<float>> maybe_calculate_aim_point(const Projectile& projectile,
const Target& target) const override;
[[nodiscard]] std::optional<Vector3<float>>
maybe_calculate_aim_point(const Projectile& projectile, const Target& target) const override;
ProjPredEngineAvx2(float gravity_constant, float simulation_time_step, float maximum_simulation_time);
~ProjPredEngineAvx2() override = default;
@@ -18,7 +18,7 @@ namespace omath::projectile_prediction
private:
[[nodiscard]] static std::optional<float> calculate_pitch(const Vector3<float>& proj_origin,
const Vector3<float>& target_pos,
float bullet_gravity, float v0, float time);
float bullet_gravity, float v0, float time) ;
// We use [[maybe_unused]] here since AVX2 is not available for ARM and ARM64 CPU
[[maybe_unused]] const float m_gravity_constant;

View File

@@ -29,11 +29,12 @@ namespace omath::projectile_prediction
const float m_distance_tolerance;
[[nodiscard]]
std::optional<float> maybe_calculate_projectile_launch_pitch_angle(const Projectile& projectile,
const Vector3<float>& target_position) const;
std::optional<float>
maybe_calculate_projectile_launch_pitch_angle(const Projectile& projectile,
const Vector3<float>& target_position) const noexcept;
[[nodiscard]]
bool is_projectile_reached_target(const Vector3<float>& target_position, const Projectile& projectile,
float pitch, float time) const;
float pitch, float time) const noexcept;
};
} // namespace omath::projectile_prediction

View File

@@ -11,7 +11,7 @@ namespace omath::projectile_prediction
{
public:
[[nodiscard]]
Vector3<float> predict_position(float pitch, float yaw, float time, float gravity) const;
Vector3<float> predict_position(float pitch, float yaw, float time, float gravity) const noexcept;
Vector3<float> m_origin;
float m_launch_speed{};

View File

@@ -11,7 +11,7 @@ namespace omath::projectile_prediction
{
public:
[[nodiscard]]
constexpr Vector3<float> predict_position(const float time, const float gravity) const
constexpr Vector3<float> predict_position(const float time, const float gravity) const noexcept
{
auto predicted = m_origin + m_velocity * time;

View File

@@ -41,9 +41,9 @@ namespace omath::projection
protected:
virtual void look_at(const Vector3<float>& target) = 0;
[[nodiscard]] virtual Mat4X4Type calc_view_matrix() const = 0;
[[nodiscard]] virtual Mat4X4Type calc_view_matrix() const noexcept = 0;
[[nodiscard]] virtual Mat4X4Type calc_projection_matrix() const = 0;
[[nodiscard]] virtual Mat4X4Type calc_projection_matrix() const noexcept = 0;
[[nodiscard]] Mat4X4Type calc_view_projection_matrix() const noexcept
{