mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-14 07:23:26 +00:00
now template
This commit is contained in:
@@ -13,7 +13,7 @@ namespace omath::projectile_prediction
|
||||
{
|
||||
public:
|
||||
[[nodiscard]]
|
||||
virtual std::optional<Vector3> MaybeCalculateAimPoint(const Projectile& projectile,
|
||||
virtual std::optional<Vector3<float>> MaybeCalculateAimPoint(const Projectile& projectile,
|
||||
const Target& target) const = 0;
|
||||
virtual ~ProjPredEngine() = default;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace omath::projectile_prediction
|
||||
class ProjPredEngineAVX2 final : public ProjPredEngine
|
||||
{
|
||||
public:
|
||||
[[nodiscard]] std::optional<Vector3> MaybeCalculateAimPoint(const Projectile& projectile,
|
||||
[[nodiscard]] std::optional<Vector3<float>> MaybeCalculateAimPoint(const Projectile& projectile,
|
||||
const Target& target) const override;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace omath::projectile_prediction
|
||||
~ProjPredEngineAVX2() override = default;
|
||||
|
||||
private:
|
||||
[[nodiscard]] static std::optional<float> CalculatePitch(const Vector3& projOrigin, const Vector3& targetPos,
|
||||
[[nodiscard]] static std::optional<float> CalculatePitch(const Vector3<float>& projOrigin, const Vector3<float>& targetPos,
|
||||
float bulletGravity, float v0, float time);
|
||||
const float m_gravityConstant;
|
||||
const float m_simulationTimeStep;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace omath::projectile_prediction
|
||||
float distanceTolerance);
|
||||
|
||||
[[nodiscard]]
|
||||
std::optional<Vector3> MaybeCalculateAimPoint(const Projectile& projectile,
|
||||
std::optional<Vector3<float>> MaybeCalculateAimPoint(const Projectile& projectile,
|
||||
const Target& target) const override;
|
||||
|
||||
private:
|
||||
@@ -31,11 +31,11 @@ namespace omath::projectile_prediction
|
||||
|
||||
[[nodiscard]]
|
||||
std::optional<float> MaybeCalculateProjectileLaunchPitchAngle(const Projectile& projectile,
|
||||
const Vector3& targetPosition) const;
|
||||
const Vector3<float>& targetPosition) const;
|
||||
|
||||
|
||||
[[nodiscard]]
|
||||
bool IsProjectileReachedTarget(const Vector3& targetPosition, const Projectile& projectile, float pitch,
|
||||
bool IsProjectileReachedTarget(const Vector3<float>& targetPosition, const Projectile& projectile, float pitch,
|
||||
float time) const;
|
||||
};
|
||||
} // namespace omath::projectile_prediction
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace omath::projectile_prediction
|
||||
public:
|
||||
|
||||
[[nodiscard]]
|
||||
Vector3 PredictPosition(float pitch, float yaw, float time, float gravity) const;
|
||||
Vector3<float> PredictPosition(float pitch, float yaw, float time, float gravity) const;
|
||||
|
||||
Vector3 m_origin;
|
||||
Vector3<float> m_origin;
|
||||
float m_launchSpeed{};
|
||||
float m_gravityScale{};
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace omath::projectile_prediction
|
||||
public:
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Vector3 PredictPosition(const float time, const float gravity) const
|
||||
constexpr Vector3<float> PredictPosition(const float time, const float gravity) const
|
||||
{
|
||||
auto predicted = m_origin + m_velocity * time;
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace omath::projectile_prediction
|
||||
return predicted;
|
||||
}
|
||||
|
||||
Vector3 m_origin;
|
||||
Vector3 m_velocity;
|
||||
Vector3<float> m_origin;
|
||||
Vector3<float> m_velocity;
|
||||
bool m_isAirborne{};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user