Skip to content

Commit 2fe029d

Browse files
committed
Merge pull request #104449 from mihe/jolt/v5.3.0
Jolt: Update to 5.3.0
2 parents 8bd9cde + 5d00161 commit 2fe029d

File tree

109 files changed

+2230
-1234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2230
-1234
lines changed

modules/jolt_physics/SCsub

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,9 @@ thirdparty_sources = [
132132
"Jolt/Skeleton/Skeleton.cpp",
133133
"Jolt/Skeleton/SkeletonMapper.cpp",
134134
"Jolt/Skeleton/SkeletonPose.cpp",
135-
"Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.cpp",
136-
"Jolt/TriangleGrouper/TriangleGrouperMorton.cpp",
137135
"Jolt/TriangleSplitter/TriangleSplitter.cpp",
138136
"Jolt/TriangleSplitter/TriangleSplitterBinning.cpp",
139-
"Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.cpp",
140-
"Jolt/TriangleSplitter/TriangleSplitterLongestAxis.cpp",
141137
"Jolt/TriangleSplitter/TriangleSplitterMean.cpp",
142-
"Jolt/TriangleSplitter/TriangleSplitterMorton.cpp",
143138
]
144139

145140
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]

modules/jolt_physics/shapes/jolt_height_map_shape_3d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ JPH::ShapeRefC JoltHeightMapShape3D::_build_height_field() const {
103103
}
104104
}
105105

106-
JPH::HeightFieldShapeSettings shape_settings(heights_rev.ptr(), JPH::Vec3(offset_x, 0, offset_y), JPH::Vec3::sReplicate(1.0f), (JPH::uint32)width);
106+
JPH::HeightFieldShapeSettings shape_settings(heights_rev.ptr(), JPH::Vec3(offset_x, 0, offset_y), JPH::Vec3::sOne(), (JPH::uint32)width);
107107

108108
shape_settings.mBitsPerSample = shape_settings.CalculateBitsPerSampleForError(0.0f);
109109
shape_settings.mActiveEdgeCosThresholdAngle = JoltProjectSettings::active_edge_threshold_cos;

modules/jolt_physics/spaces/jolt_physics_direct_space_state_3d.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ bool JoltPhysicsDirectSpaceState3D::_body_motion_recover(const JoltBody3D &p_bod
190190
for (int i = 0; i < JoltProjectSettings::motion_query_recovery_iterations; ++i) {
191191
collector.reset();
192192

193-
_collide_shape_kinematics(jolt_shape, JPH::Vec3::sReplicate(1.0f), to_jolt_r(transform_com), settings, to_jolt_r(base_offset), collector, motion_filter, motion_filter, motion_filter, motion_filter);
193+
_collide_shape_kinematics(jolt_shape, JPH::Vec3::sOne(), to_jolt_r(transform_com), settings, to_jolt_r(base_offset), collector, motion_filter, motion_filter, motion_filter, motion_filter);
194194

195195
if (!collector.had_hit()) {
196196
break;
@@ -320,7 +320,7 @@ bool JoltPhysicsDirectSpaceState3D::_body_motion_collide(const JoltBody3D &p_bod
320320

321321
const JoltMotionFilter3D motion_filter(p_body, p_excluded_bodies, p_excluded_objects);
322322
JoltQueryCollectorClosestMulti<JPH::CollideShapeCollector, 32> collector(p_max_collisions);
323-
_collide_shape_kinematics(jolt_shape, JPH::Vec3::sReplicate(1.0f), to_jolt_r(transform_com), settings, to_jolt_r(base_offset), collector, motion_filter, motion_filter, motion_filter, motion_filter);
323+
_collide_shape_kinematics(jolt_shape, JPH::Vec3::sOne(), to_jolt_r(transform_com), settings, to_jolt_r(base_offset), collector, motion_filter, motion_filter, motion_filter, motion_filter);
324324

325325
if (!collector.had_hit() || p_result == nullptr) {
326326
return collector.had_hit();
@@ -418,7 +418,7 @@ void JoltPhysicsDirectSpaceState3D::_generate_manifold(const JPH::CollideShapeRe
418418
const JPH::PhysicsSettings &physics_settings = physics_system.GetPhysicsSettings();
419419
const JPH::Vec3 penetration_axis = p_hit.mPenetrationAxis.Normalized();
420420

421-
JPH::ManifoldBetweenTwoFaces(p_hit.mContactPointOn1, p_hit.mContactPointOn2, penetration_axis, physics_settings.mManifoldToleranceSq, p_hit.mShape1Face, p_hit.mShape2Face, r_contact_points1, r_contact_points2 JPH_IF_DEBUG_RENDERER(, p_center_of_mass));
421+
JPH::ManifoldBetweenTwoFaces(p_hit.mContactPointOn1, p_hit.mContactPointOn2, penetration_axis, physics_settings.mManifoldTolerance, p_hit.mShape1Face, p_hit.mShape2Face, r_contact_points1, r_contact_points2 JPH_IF_DEBUG_RENDERER(, p_center_of_mass));
422422

423423
if (r_contact_points1.size() > 4) {
424424
JPH::PruneContactPoints(penetration_axis, r_contact_points1, r_contact_points2 JPH_IF_DEBUG_RENDERER(, p_center_of_mass));

thirdparty/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ Files generated from upstream source:
448448
## jolt_physics
449449

450450
- Upstream: https://github.com/jrouwe/JoltPhysics
451-
- Version: 5.2.1 (f094082aa2bbfcbebc725dbe8b8f65c7d5152886, 2024)
451+
- Version: 5.3.0 (0373ec0dd762e4bc2f6acdb08371ee84fa23c6db, 2025)
452452
- License: MIT
453453

454454
Files extracted from upstream source:

thirdparty/jolt_physics/Jolt/Core/Array.h

Lines changed: 113 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,83 @@ class [[nodiscard]] Array : private Allocator
4747
using const_iterator = const T *;
4848
using iterator = T *;
4949

50+
/// An iterator that traverses the array in reverse order
51+
class rev_it
52+
{
53+
public:
54+
/// Constructor
55+
rev_it() = default;
56+
explicit rev_it(T *inValue) : mValue(inValue) { }
57+
58+
/// Copying
59+
rev_it(const rev_it &) = default;
60+
rev_it & operator = (const rev_it &) = default;
61+
62+
/// Comparison
63+
bool operator == (const rev_it &inRHS) const { return mValue == inRHS.mValue; }
64+
bool operator != (const rev_it &inRHS) const { return mValue != inRHS.mValue; }
65+
66+
/// Arithmetics
67+
rev_it & operator ++ () { --mValue; return *this; }
68+
rev_it operator ++ (int) { return rev_it(mValue--); }
69+
rev_it & operator -- () { ++mValue; return *this; }
70+
rev_it operator -- (int) { return rev_it(mValue++); }
71+
72+
rev_it operator + (int inValue) { return rev_it(mValue - inValue); }
73+
rev_it operator - (int inValue) { return rev_it(mValue + inValue); }
74+
75+
rev_it & operator += (int inValue) { mValue -= inValue; return *this; }
76+
rev_it & operator -= (int inValue) { mValue += inValue; return *this; }
77+
78+
/// Access
79+
T & operator * () const { return *mValue; }
80+
T & operator -> () const { return *mValue; }
81+
82+
private:
83+
T * mValue;
84+
};
85+
86+
/// A const iterator that traverses the array in reverse order
87+
class crev_it
88+
{
89+
public:
90+
/// Constructor
91+
crev_it() = default;
92+
explicit crev_it(const T *inValue) : mValue(inValue) { }
93+
94+
/// Copying
95+
crev_it(const crev_it &) = default;
96+
explicit crev_it(const rev_it &inValue) : mValue(inValue.mValue) { }
97+
crev_it & operator = (const crev_it &) = default;
98+
crev_it & operator = (const rev_it &inRHS) { mValue = inRHS.mValue; return *this; }
99+
100+
/// Comparison
101+
bool operator == (const crev_it &inRHS) const { return mValue == inRHS.mValue; }
102+
bool operator != (const crev_it &inRHS) const { return mValue != inRHS.mValue; }
103+
104+
/// Arithmetics
105+
crev_it & operator ++ () { --mValue; return *this; }
106+
crev_it operator ++ (int) { return crev_it(mValue--); }
107+
crev_it & operator -- () { ++mValue; return *this; }
108+
crev_it operator -- (int) { return crev_it(mValue++); }
109+
110+
crev_it operator + (int inValue) { return crev_it(mValue - inValue); }
111+
crev_it operator - (int inValue) { return crev_it(mValue + inValue); }
112+
113+
crev_it & operator += (int inValue) { mValue -= inValue; return *this; }
114+
crev_it & operator -= (int inValue) { mValue += inValue; return *this; }
115+
116+
/// Access
117+
const T & operator * () const { return *mValue; }
118+
const T & operator -> () const { return *mValue; }
119+
120+
private:
121+
const T * mValue;
122+
};
123+
124+
using reverse_iterator = rev_it;
125+
using const_reverse_iterator = crev_it;
126+
50127
private:
51128
/// Move elements from one location to another
52129
inline void move(pointer inDestination, pointer inSource, size_type inCount)
@@ -388,18 +465,19 @@ class [[nodiscard]] Array : private Allocator
388465
}
389466

390467
/// Remove one element from the array
391-
void erase(const_iterator inIter)
468+
iterator erase(const_iterator inIter)
392469
{
393470
size_type p = size_type(inIter - begin());
394471
JPH_ASSERT(p < mSize);
395472
mElements[p].~T();
396473
if (p + 1 < mSize)
397474
move(mElements + p, mElements + p + 1, mSize - p - 1);
398475
--mSize;
476+
return const_cast<iterator>(inIter);
399477
}
400478

401479
/// Remove multiple element from the array
402-
void erase(const_iterator inBegin, const_iterator inEnd)
480+
iterator erase(const_iterator inBegin, const_iterator inEnd)
403481
{
404482
size_type p = size_type(inBegin - begin());
405483
size_type n = size_type(inEnd - inBegin);
@@ -408,6 +486,7 @@ class [[nodiscard]] Array : private Allocator
408486
if (p + n < mSize)
409487
move(mElements + p, mElements + p + n, mSize - p - n);
410488
mSize -= n;
489+
return const_cast<iterator>(inBegin);
411490
}
412491

413492
/// Iterators
@@ -421,14 +500,34 @@ class [[nodiscard]] Array : private Allocator
421500
return mElements + mSize;
422501
}
423502

503+
inline crev_it rbegin() const
504+
{
505+
return crev_it(mElements + mSize - 1);
506+
}
507+
508+
inline crev_it rend() const
509+
{
510+
return crev_it(mElements - 1);
511+
}
512+
424513
inline const_iterator cbegin() const
425514
{
426-
return mElements;
515+
return begin();
427516
}
428517

429518
inline const_iterator cend() const
430519
{
431-
return mElements + mSize;
520+
return end();
521+
}
522+
523+
inline crev_it crbegin() const
524+
{
525+
return rbegin();
526+
}
527+
528+
inline crev_it crend() const
529+
{
530+
return rend();
432531
}
433532

434533
inline iterator begin()
@@ -441,6 +540,16 @@ class [[nodiscard]] Array : private Allocator
441540
return mElements + mSize;
442541
}
443542

543+
inline rev_it rbegin()
544+
{
545+
return rev_it(mElements + mSize - 1);
546+
}
547+
548+
inline rev_it rend()
549+
{
550+
return rev_it(mElements - 1);
551+
}
552+
444553
inline const T * data() const
445554
{
446555
return mElements;

thirdparty/jolt_physics/Jolt/Core/Color.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Color;
1212
using ColorArg = Color;
1313

1414
/// Class that holds an RGBA color with 8-bits per component
15-
class [[nodiscard]] JPH_EXPORT_GCC_BUG_WORKAROUND Color
15+
class JPH_EXPORT_GCC_BUG_WORKAROUND [[nodiscard]] Color
1616
{
1717
public:
1818
/// Constructors

thirdparty/jolt_physics/Jolt/Core/Core.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
// Jolt library version
88
#define JPH_VERSION_MAJOR 5
9-
#define JPH_VERSION_MINOR 2
10-
#define JPH_VERSION_PATCH 1
9+
#define JPH_VERSION_MINOR 3
10+
#define JPH_VERSION_PATCH 0
1111

1212
// Determine which features the library was compiled with
1313
#ifdef JPH_DOUBLE_PRECISION
@@ -83,8 +83,8 @@
8383
#define JPH_PLATFORM_ANDROID
8484
#elif defined(__linux__)
8585
#define JPH_PLATFORM_LINUX
86-
#elif defined(__FreeBSD__)
87-
#define JPH_PLATFORM_FREEBSD
86+
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
87+
#define JPH_PLATFORM_BSD
8888
#elif defined(__APPLE__)
8989
#include <TargetConditionals.h>
9090
#if defined(TARGET_OS_IPHONE) && !TARGET_OS_IPHONE
@@ -195,7 +195,11 @@
195195
#elif defined(JPH_PLATFORM_WASM)
196196
// WebAssembly CPU architecture
197197
#define JPH_CPU_WASM
198-
#define JPH_CPU_ADDRESS_BITS 32
198+
#if defined(__wasm64__)
199+
#define JPH_CPU_ADDRESS_BITS 64
200+
#else
201+
#define JPH_CPU_ADDRESS_BITS 32
202+
#endif
199203
#define JPH_VECTOR_ALIGNMENT 16
200204
#define JPH_DVECTOR_ALIGNMENT 32
201205
#ifdef __wasm_simd128__
@@ -360,6 +364,7 @@
360364
JPH_MSVC_SUPPRESS_WARNING(4514) /* 'X' : unreferenced inline function has been removed */ \
361365
JPH_MSVC_SUPPRESS_WARNING(4710) /* 'X' : function not inlined */ \
362366
JPH_MSVC_SUPPRESS_WARNING(4711) /* function 'X' selected for automatic inline expansion */ \
367+
JPH_MSVC_SUPPRESS_WARNING(4714) /* function 'X' marked as __forceinline not inlined */ \
363368
JPH_MSVC_SUPPRESS_WARNING(4820) /* 'X': 'Y' bytes padding added after data member 'Z' */ \
364369
JPH_MSVC_SUPPRESS_WARNING(4100) /* 'X' : unreferenced formal parameter */ \
365370
JPH_MSVC_SUPPRESS_WARNING(4626) /* 'X' : assignment operator was implicitly defined as deleted because a base class assignment operator is inaccessible or deleted */ \
@@ -388,9 +393,9 @@
388393
// Configuration for a popular game console.
389394
// This file is not distributed because it would violate an NDA.
390395
// Creating one should only be a couple of minutes of work if you have the documentation for the platform
391-
// (you only need to define JPH_BREAKPOINT, JPH_PLATFORM_BLUE_GET_TICKS, JPH_PLATFORM_BLUE_MUTEX*, JPH_PLATFORM_BLUE_RWLOCK* and include the right header).
396+
// (you only need to define JPH_BREAKPOINT, JPH_PLATFORM_BLUE_GET_TICKS, JPH_PLATFORM_BLUE_MUTEX*, JPH_PLATFORM_BLUE_RWLOCK*, JPH_PLATFORM_BLUE_SEMAPHORE* and include the right header).
392397
#include <Jolt/Core/PlatformBlue.h>
393-
#elif defined(JPH_PLATFORM_LINUX) || defined(JPH_PLATFORM_ANDROID) || defined(JPH_PLATFORM_MACOS) || defined(JPH_PLATFORM_IOS) || defined(JPH_PLATFORM_FREEBSD)
398+
#elif defined(JPH_PLATFORM_LINUX) || defined(JPH_PLATFORM_ANDROID) || defined(JPH_PLATFORM_MACOS) || defined(JPH_PLATFORM_IOS) || defined(JPH_PLATFORM_BSD)
394399
#if defined(JPH_CPU_X86)
395400
#define JPH_BREAKPOINT __asm volatile ("int $0x3")
396401
#elif defined(JPH_CPU_ARM) || defined(JPH_CPU_RISCV) || defined(JPH_CPU_E2K) || defined(JPH_CPU_PPC) || defined(JPH_CPU_LOONGARCH)
@@ -426,7 +431,8 @@
426431
JPH_MSVC_SUPPRESS_WARNING(4514) \
427432
JPH_MSVC_SUPPRESS_WARNING(5262) \
428433
JPH_MSVC_SUPPRESS_WARNING(5264) \
429-
JPH_MSVC_SUPPRESS_WARNING(4738)
434+
JPH_MSVC_SUPPRESS_WARNING(4738) \
435+
JPH_MSVC_SUPPRESS_WARNING(5045)
430436

431437
#define JPH_SUPPRESS_WARNINGS_STD_END \
432438
JPH_SUPPRESS_WARNING_POP

thirdparty/jolt_physics/Jolt/Core/FPException.h

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,36 @@ JPH_NAMESPACE_BEGIN
1616
class FPExceptionsEnable { };
1717
class FPExceptionDisableInvalid { };
1818
class FPExceptionDisableDivByZero { };
19+
class FPExceptionDisableOverflow { };
1920

2021
#elif defined(JPH_USE_SSE)
2122

22-
/// Enable floating point divide by zero exception and exceptions on invalid numbers
23-
class FPExceptionsEnable : public FPControlWord<0, _MM_MASK_DIV_ZERO | _MM_MASK_INVALID> { };
23+
/// Enable floating point divide by zero exception, overflow exceptions and exceptions on invalid numbers
24+
class FPExceptionsEnable : public FPControlWord<0, _MM_MASK_DIV_ZERO | _MM_MASK_INVALID | _MM_MASK_OVERFLOW> { };
2425

2526
/// Disable invalid floating point value exceptions
2627
class FPExceptionDisableInvalid : public FPControlWord<_MM_MASK_INVALID, _MM_MASK_INVALID> { };
2728

2829
/// Disable division by zero floating point exceptions
2930
class FPExceptionDisableDivByZero : public FPControlWord<_MM_MASK_DIV_ZERO, _MM_MASK_DIV_ZERO> { };
3031

32+
/// Disable floating point overflow exceptions
33+
class FPExceptionDisableOverflow : public FPControlWord<_MM_MASK_OVERFLOW, _MM_MASK_OVERFLOW> { };
34+
3135
#elif defined(JPH_CPU_ARM) && defined(JPH_COMPILER_MSVC)
3236

33-
/// Enable floating point divide by zero exception and exceptions on invalid numbers
34-
class FPExceptionsEnable : public FPControlWord<0, _EM_INVALID | _EM_ZERODIVIDE> { };
37+
/// Enable floating point divide by zero exception, overflow exceptions and exceptions on invalid numbers
38+
class FPExceptionsEnable : public FPControlWord<0, _EM_INVALID | _EM_ZERODIVIDE | _EM_OVERFLOW> { };
3539

3640
/// Disable invalid floating point value exceptions
3741
class FPExceptionDisableInvalid : public FPControlWord<_EM_INVALID, _EM_INVALID> { };
3842

3943
/// Disable division by zero floating point exceptions
4044
class FPExceptionDisableDivByZero : public FPControlWord<_EM_ZERODIVIDE, _EM_ZERODIVIDE> { };
4145

46+
/// Disable floating point overflow exceptions
47+
class FPExceptionDisableOverflow : public FPControlWord<_EM_OVERFLOW, _EM_OVERFLOW> { };
48+
4249
#elif defined(JPH_CPU_ARM)
4350

4451
/// Invalid operation exception bit
@@ -47,15 +54,21 @@ static constexpr uint64 FP_IOE = 1 << 8;
4754
/// Enable divide by zero exception bit
4855
static constexpr uint64 FP_DZE = 1 << 9;
4956

50-
/// Enable floating point divide by zero exception and exceptions on invalid numbers
51-
class FPExceptionsEnable : public FPControlWord<FP_IOE | FP_DZE, FP_IOE | FP_DZE> { };
57+
/// Enable floating point overflow bit
58+
static constexpr uint64 FP_OFE = 1 << 10;
59+
60+
/// Enable floating point divide by zero exception, overflow exceptions and exceptions on invalid numbers
61+
class FPExceptionsEnable : public FPControlWord<FP_IOE | FP_DZE | FP_OFE, FP_IOE | FP_DZE | FP_OFE> { };
5262

5363
/// Disable invalid floating point value exceptions
5464
class FPExceptionDisableInvalid : public FPControlWord<0, FP_IOE> { };
5565

5666
/// Disable division by zero floating point exceptions
5767
class FPExceptionDisableDivByZero : public FPControlWord<0, FP_DZE> { };
5868

69+
/// Disable floating point overflow exceptions
70+
class FPExceptionDisableOverflow : public FPControlWord<0, FP_OFE> { };
71+
5972
#elif defined(JPH_CPU_RISCV)
6073

6174
#error "RISC-V only implements manually checking if exceptions occurred by reading the fcsr register. It doesn't generate exceptions. JPH_FLOATING_POINT_EXCEPTIONS_ENABLED must be disabled."
@@ -76,6 +89,7 @@ class FPExceptionDisableDivByZero : public FPControlWord<0, FP_DZE> { };
7689
class FPExceptionsEnable { };
7790
class FPExceptionDisableInvalid { };
7891
class FPExceptionDisableDivByZero { };
92+
class FPExceptionDisableOverflow { };
7993

8094
#endif
8195

0 commit comments

Comments
 (0)