feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -50,6 +50,9 @@ public:
/// Vector with all zeros
static JPH_INLINE DVec3 sZero();
/// Vector with all ones
static JPH_INLINE DVec3 sOne();
/// Vectors with the principal axis
static JPH_INLINE DVec3 sAxisX() { return DVec3(1, 0, 0); }
static JPH_INLINE DVec3 sAxisY() { return DVec3(0, 1, 0); }

View file

@ -147,6 +147,11 @@ DVec3 DVec3::sReplicate(double inV)
#endif
}
DVec3 DVec3::sOne()
{
return sReplicate(1.0);
}
DVec3 DVec3::sNaN()
{
return sReplicate(numeric_limits<double>::quiet_NaN());
@ -727,7 +732,7 @@ DVec3 DVec3::Abs() const
DVec3 DVec3::Reciprocal() const
{
return sReplicate(1.0) / mValue;
return sOne() / mValue;
}
DVec3 DVec3::Cross(DVec3Arg inV2) const

View file

@ -30,7 +30,7 @@ bool EigenValueSymmetric(const Matrix &inMatrix, Matrix &outEigVec, Vector &outE
{
// This algorithm can generate infinite values, see comment below
FPExceptionDisableInvalid disable_invalid;
(void)disable_invalid;
JPH_UNUSED(disable_invalid);
// Maximum number of sweeps to make
const int cMaxSweeps = 50;

View file

@ -5,6 +5,7 @@
#pragma once
#include <Jolt/Math/Vec4.h>
#include <Jolt/Core/FPException.h>
JPH_NAMESPACE_BEGIN
@ -132,6 +133,9 @@ template <int RoundingMode>
JPH_INLINE HalfFloat FromFloat(float inV)
{
#ifdef JPH_USE_F16C
FPExceptionDisableOverflow disable_overflow;
JPH_UNUSED(disable_overflow);
union
{
__m128i u128;

View file

@ -9,6 +9,9 @@ JPH_NAMESPACE_BEGIN
/// The constant \f$\pi\f$
static constexpr float JPH_PI = 3.14159265358979323846f;
/// A large floating point value which, when squared, is still much smaller than FLT_MAX
static constexpr float cLargeFloat = 1.0e15f;
/// Convert a value from degrees to radians
JPH_INLINE constexpr float DegreesToRadians(float inV)
{

View file

@ -46,6 +46,9 @@ public:
/// Vector with all zeros
static JPH_INLINE Vec3 sZero();
/// Vector with all ones
static JPH_INLINE Vec3 sOne();
/// Vector with all NaN's
static JPH_INLINE Vec3 sNaN();

View file

@ -122,6 +122,11 @@ Vec3 Vec3::sReplicate(float inV)
#endif
}
Vec3 Vec3::sOne()
{
return sReplicate(1.0f);
}
Vec3 Vec3::sNaN()
{
return sReplicate(numeric_limits<float>::quiet_NaN());
@ -584,7 +589,7 @@ Vec3 Vec3::Abs() const
Vec3 Vec3::Reciprocal() const
{
return sReplicate(1.0f) / mValue;
return sOne() / mValue;
}
Vec3 Vec3::Cross(Vec3Arg inV2) const

View file

@ -38,6 +38,9 @@ public:
/// Vector with all zeros
static JPH_INLINE Vec4 sZero();
/// Vector with all ones
static JPH_INLINE Vec4 sOne();
/// Vector with all NaN's
static JPH_INLINE Vec4 sNaN();

View file

@ -82,6 +82,11 @@ Vec4 Vec4::sReplicate(float inV)
#endif
}
Vec4 Vec4::sOne()
{
return sReplicate(1.0f);
}
Vec4 Vec4::sNaN()
{
return sReplicate(numeric_limits<float>::quiet_NaN());
@ -614,7 +619,7 @@ Vec4 Vec4::Abs() const
Vec4 Vec4::Reciprocal() const
{
return sReplicate(1.0f) / mValue;
return sOne() / mValue;
}
Vec4 Vec4::DotV(Vec4Arg inV2) const
@ -805,7 +810,7 @@ void Vec4::SinCos(Vec4 &outSin, Vec4 &outCos) const
// Taylor expansion:
// Cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! + ... = (((x2/8!- 1/6!) * x2 + 1/4!) * x2 - 1/2!) * x2 + 1
Vec4 taylor_cos = ((2.443315711809948e-5f * x2 - Vec4::sReplicate(1.388731625493765e-3f)) * x2 + Vec4::sReplicate(4.166664568298827e-2f)) * x2 * x2 - 0.5f * x2 + Vec4::sReplicate(1.0f);
Vec4 taylor_cos = ((2.443315711809948e-5f * x2 - Vec4::sReplicate(1.388731625493765e-3f)) * x2 + Vec4::sReplicate(4.166664568298827e-2f)) * x2 * x2 - 0.5f * x2 + Vec4::sOne();
// Sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... = ((-x2/7! + 1/5!) * x2 - 1/3!) * x2 * x + x
Vec4 taylor_sin = ((-1.9515295891e-4f * x2 + Vec4::sReplicate(8.3321608736e-3f)) * x2 - Vec4::sReplicate(1.6666654611e-1f)) * x2 * x + x;
@ -880,14 +885,14 @@ Vec4 Vec4::ASin() const
Vec4 a = Vec4::sXor(*this, asin_sign.ReinterpretAsFloat());
// ASin is not defined outside the range [-1, 1] but it often happens that a value is slightly above 1 so we just clamp here
a = Vec4::sMin(a, Vec4::sReplicate(1.0f));
a = Vec4::sMin(a, Vec4::sOne());
// When |x| <= 0.5 we use the asin approximation as is
Vec4 z1 = a * a;
Vec4 x1 = a;
// When |x| > 0.5 we use the identity asin(x) = PI / 2 - 2 * asin(sqrt((1 - x) / 2))
Vec4 z2 = 0.5f * (Vec4::sReplicate(1.0f) - a);
Vec4 z2 = 0.5f * (Vec4::sOne() - a);
Vec4 x2 = z2.Sqrt();
// Select which of the two situations we have
@ -923,7 +928,7 @@ Vec4 Vec4::ATan() const
// If x > Tan(PI / 8)
UVec4 greater1 = Vec4::sGreater(x, Vec4::sReplicate(0.4142135623730950f));
Vec4 x1 = (x - Vec4::sReplicate(1.0f)) / (x + Vec4::sReplicate(1.0f));
Vec4 x1 = (x - Vec4::sOne()) / (x + Vec4::sOne());
// If x > Tan(3 * PI / 8)
UVec4 greater2 = Vec4::sGreater(x, Vec4::sReplicate(2.414213562373095f));