Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,16 @@ Files extracted from upstream source:
- All files in `Jolt/`, except `Jolt/Jolt.cmake` and any files dependent on `ENABLE_OBJECT_STREAM`, as seen in `Jolt/Jolt.cmake`
- `LICENSE`

Patches:

- `0001-backport-upstream-commit-b385bc3d7.patch` ([GH-111087](https://github.com/godotengine/godot/pull/111087))
- `0002-backport-upstream-commit-ccfe0a0df.patch` ([GH-111408](https://github.com/godotengine/godot/pull/111408))
- `0003-backport-upstream-commit-9e48d59be.patch` ([GH-111767](https://github.com/godotengine/godot/pull/111767))
- `0004-backport-upstream-commit-ee3725250.patch` ([GH-115089](https://github.com/godotengine/godot/pull/115089))
- `0005-backport-upstream-commit-bc7f1fb8c.patch` ([GH-115305](https://github.com/godotengine/godot/pull/115305))
- `0006-backport-upstream-commit-365a15367.patch` ([GH-115305](https://github.com/godotengine/godot/pull/115305))
- `0007-backport-upstream-commit-e0a6a9a16.patch` ([GH-115327](https://github.com/godotengine/godot/pull/115327))


## libbacktrace

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/thirdparty/jolt_physics/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h b/thirdparty/jolt_physics/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h
index ec84776a46..387c0d9737 100644
--- a/thirdparty/jolt_physics/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h
+++ b/thirdparty/jolt_physics/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h
@@ -143,8 +143,21 @@ public:
mInvI2 = inBody2.IsDynamic()? inBody2.GetMotionProperties()->GetInverseInertiaForRotation(inRotation2) : Mat44::sZero();

// Calculate effective mass: K^-1 = (J M^-1 J^T)^-1
- if (!mEffectiveMass.SetInversed3x3(mInvI1 + mInvI2))
- Deactivate();
+ Mat44 inertia_sum = mInvI1 + mInvI2;
+ if (!mEffectiveMass.SetInversed3x3(inertia_sum))
+ {
+ // If a column is zero, the axis is locked and we set the column to identity.
+ // This does not matter because any impulse will always be multiplied with mInvI1 or mInvI2 which will result in zero for the locked coordinate.
+ Vec4 zero = Vec4::sZero();
+ if (inertia_sum.GetColumn4(0) == zero)
+ inertia_sum.SetColumn4(0, Vec4(1, 0, 0, 0));
+ if (inertia_sum.GetColumn4(1) == zero)
+ inertia_sum.SetColumn4(1, Vec4(0, 1, 0, 0));
+ if (inertia_sum.GetColumn4(2) == zero)
+ inertia_sum.SetColumn4(2, Vec4(0, 0, 1, 0));
+ if (!mEffectiveMass.SetInversed3x3(inertia_sum))
+ Deactivate();
+ }
}

/// Deactivate this constraint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/thirdparty/jolt_physics/Jolt/Core/Core.h b/thirdparty/jolt_physics/Jolt/Core/Core.h
index b306f5a686..b433a77946 100644
--- a/thirdparty/jolt_physics/Jolt/Core/Core.h
+++ b/thirdparty/jolt_physics/Jolt/Core/Core.h
@@ -453,6 +453,7 @@ JPH_SUPPRESS_WARNINGS_STD_BEGIN
#include <functional>
#include <algorithm>
#include <cstdint>
+#include <type_traits>
#if defined(JPH_COMPILER_MSVC) || (defined(JPH_COMPILER_CLANG) && defined(_MSC_VER)) // MSVC or clang-cl
#include <malloc.h> // for alloca
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/thirdparty/jolt_physics/Jolt/RegisterTypes.cpp b/thirdparty/jolt_physics/Jolt/RegisterTypes.cpp
index ccfcc1bbe0..e343dd2fa7 100644
--- a/thirdparty/jolt_physics/Jolt/RegisterTypes.cpp
+++ b/thirdparty/jolt_physics/Jolt/RegisterTypes.cpp
@@ -74,6 +74,10 @@ void RegisterTypesInternal(uint64 inVersionID)
{
Trace("Version mismatch, make sure you compile the client code with the same Jolt version and compiler definitions!");
uint64 mismatch = JPH_VERSION_ID ^ inVersionID;
+ if (mismatch & 0xffffff)
+ Trace("Client reported version %d.%d.%d, library version is %d.%d.%d.",
+ (inVersionID >> 16) & 0xff, (inVersionID >> 8) & 0xff, inVersionID & 0xff,
+ JPH_VERSION_MAJOR, JPH_VERSION_MINOR, JPH_VERSION_PATCH);
auto check_bit = [mismatch](int inBit, const char *inLabel) { if (mismatch & (uint64(1) << (inBit + 23))) Trace("Mismatching define %s.", inLabel); };
check_bit(1, "JPH_DOUBLE_PRECISION");
check_bit(2, "JPH_CROSS_PLATFORM_DETERMINISTIC");
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp
index e8a8c21459..4fb6c58c18 100644
--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp
+++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CastConvexVsTriangles.cpp
@@ -92,11 +92,14 @@ void CastConvexVsTriangles::Cast(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2, uint8
static_cast<const ConvexShape *>(mShapeCast.mShape)->GetSupportingFace(SubShapeID(), transform_1_to_2.Multiply3x3Transposed(-contact_normal), mShapeCast.mScale, mCenterOfMassTransform2 * transform_1_to_2, result.mShape1Face);

// Get face of the triangle
- triangle.GetSupportingFace(contact_normal, result.mShape2Face);
+ result.mShape2Face.resize(3);
+ result.mShape2Face[0] = mCenterOfMassTransform2 * v0;
+ result.mShape2Face[1] = mCenterOfMassTransform2 * v1;
+ result.mShape2Face[2] = mCenterOfMassTransform2 * v2;

- // Convert to world space
- for (Vec3 &p : result.mShape2Face)
- p = mCenterOfMassTransform2 * p;
+ // When inside out, we need to swap the triangle winding
+ if (mScaleSign < 0.0f)
+ std::swap(result.mShape2Face[1], result.mShape2Face[2]);
}

JPH_IF_TRACK_NARROWPHASE_STATS(TrackNarrowPhaseCollector track;)
diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp
index e03659454d..05c21eebfa 100644
--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp
+++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideConvexVsTriangles.cpp
@@ -145,6 +145,10 @@ void CollideConvexVsTriangles::Collide(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2,
result.mShape2Face[0] = mTransform1 * v0;
result.mShape2Face[1] = mTransform1 * v1;
result.mShape2Face[2] = mTransform1 * v2;
+
+ // When inside out, we need to swap the triangle winding
+ if (mScaleSign2 < 0.0f)
+ std::swap(result.mShape2Face[1], result.mShape2Face[2]);
}

// Notify the collector
diff --git a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp
index 18441ea73b..566efb38ae 100644
--- a/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp
+++ b/thirdparty/jolt_physics/Jolt/Physics/Collision/CollideSphereVsTriangles.cpp
@@ -111,6 +111,10 @@ void CollideSphereVsTriangles::Collide(Vec3Arg inV0, Vec3Arg inV1, Vec3Arg inV2,
result.mShape2Face[0] = mTransform2 * (mSphereCenterIn2 + v0);
result.mShape2Face[1] = mTransform2 * (mSphereCenterIn2 + v1);
result.mShape2Face[2] = mTransform2 * (mSphereCenterIn2 + v2);
+
+ // When inside out, we need to swap the triangle winding
+ if (mScaleSign2 < 0.0f)
+ std::swap(result.mShape2Face[1], result.mShape2Face[2]);
}

// Notify the collector
Loading
Loading