@series-inc/rundot-syncplay 6.0.0-rc.57 → 6.0.0-rc.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -219,18 +219,6 @@ inline void checkpointRecordSchemaGuard(const CheckpointStaticSlab& value) noexc
219
219
  [[maybe_unused]] const auto& [
220
220
  totalAllocatedBytes,
221
221
  stampedAllocatedBytes,
222
- jointsOffset,
223
- jointsCount,
224
- legacyGeometryOffset,
225
- legacyGeometryCount,
226
- forcesOffset,
227
- forcesCount,
228
- fluidsOffset,
229
- fluidsCount,
230
- surfaceVelocitiesOffset,
231
- surfaceVelocitiesCount,
232
- bodyMaterialFramesOffset,
233
- bodyMaterialFramesCount,
234
222
  bodyMaterialsOffset,
235
223
  bodyMaterialsCount,
236
224
  topologyBodyIdsOffset,
@@ -242,7 +230,17 @@ inline void checkpointRecordSchemaGuard(const CheckpointStaticSlab& value) noexc
242
230
  bodyDefinitionSignaturesOffset,
243
231
  bodyDefinitionSignaturesCount,
244
232
  jointDefinitionSignaturesOffset,
245
- jointDefinitionSignaturesCount
233
+ jointDefinitionSignaturesCount,
234
+ jointValuesOffset,
235
+ jointValuesCount,
236
+ forcesOffset,
237
+ forcesCount,
238
+ fluidsOffset,
239
+ fluidsCount,
240
+ surfaceVelocitiesOffset,
241
+ surfaceVelocitiesCount,
242
+ bodyMaterialFramesOffset,
243
+ bodyMaterialFramesCount
246
244
  ] = value;
247
245
  }
248
246
  inline void checkpointRecordSchemaGuard(const BodyId& value) noexcept {
@@ -284,14 +282,24 @@ inline void checkpointDataSchemaGuard(const CheckpointData& data) noexcept {
284
282
  nextFluidId,
285
283
  jointsOffset,
286
284
  jointsCount,
285
+ legacyGeometryOffset,
286
+ legacyGeometryCount,
287
287
  contactCacheOffset,
288
288
  contactCacheCount,
289
+ forcesOffset,
290
+ forcesCount,
289
291
  tickForcesOffset,
290
292
  tickForcesCount,
291
293
  supportSpringsOffset,
292
294
  supportSpringsCount,
293
295
  supportForcesOffset,
294
296
  supportForcesCount,
297
+ fluidsOffset,
298
+ fluidsCount,
299
+ surfaceVelocitiesOffset,
300
+ surfaceVelocitiesCount,
301
+ bodyMaterialFramesOffset,
302
+ bodyMaterialFramesCount,
295
303
  jointWarmStateOffset,
296
304
  jointWarmStateCount,
297
305
  contactEventsOffset,
@@ -320,14 +328,24 @@ inline void checkpointDataSchemaGuard(const CheckpointData& data) noexcept {
320
328
  static_cast<void>(nextFluidId);
321
329
  static_cast<void>(jointsOffset);
322
330
  static_cast<void>(jointsCount);
331
+ static_cast<void>(legacyGeometryOffset);
332
+ static_cast<void>(legacyGeometryCount);
323
333
  static_cast<void>(contactCacheOffset);
324
334
  static_cast<void>(contactCacheCount);
335
+ static_cast<void>(forcesOffset);
336
+ static_cast<void>(forcesCount);
325
337
  static_cast<void>(tickForcesOffset);
326
338
  static_cast<void>(tickForcesCount);
327
339
  static_cast<void>(supportSpringsOffset);
328
340
  static_cast<void>(supportSpringsCount);
329
341
  static_cast<void>(supportForcesOffset);
330
342
  static_cast<void>(supportForcesCount);
343
+ static_cast<void>(fluidsOffset);
344
+ static_cast<void>(fluidsCount);
345
+ static_cast<void>(surfaceVelocitiesOffset);
346
+ static_cast<void>(surfaceVelocitiesCount);
347
+ static_cast<void>(bodyMaterialFramesOffset);
348
+ static_cast<void>(bodyMaterialFramesCount);
331
349
  static_cast<void>(jointWarmStateOffset);
332
350
  static_cast<void>(jointWarmStateCount);
333
351
  static_cast<void>(contactEventsOffset);
@@ -5341,6 +5341,19 @@ Collision finalizeCompoundManifold(
5341
5341
  return best;
5342
5342
  }
5343
5343
 
5344
+ bool isSmallDynamicWorld(const SolverOperation& operation) {
5345
+ if (operation.proxyHook != nullptr || operation.storage.soaBodies.empty()) return false;
5346
+ if (operation.storage.soaBodies.size() <= 16) return true;
5347
+ std::uint32_t dynamicCount = 0;
5348
+ for (const Body& body : operation.storage.soaBodies) {
5349
+ if (body.dynamic) {
5350
+ dynamicCount += 1;
5351
+ if (dynamicCount > 16) return false;
5352
+ }
5353
+ }
5354
+ return dynamicCount > 0;
5355
+ }
5356
+
5344
5357
  Collision collide(SolverOperation& operation, const Body& a, const Body& b) {
5345
5358
 
5346
5359
  if (operation.materialMotionEpochs != nullptr) return collideMaterialCurrent(operation, a, b);
@@ -5505,10 +5518,7 @@ Collision collide(SolverOperation& operation, const Body& a, const Body& b) {
5505
5518
  && operation.stepSubsteps > 1
5506
5519
  && operation.storage.soaBodies.size() > 360;
5507
5520
  const bool isSmallWorld = !operation.fixedAxisQueryContacts
5508
- && (isLargeStackWorld
5509
- || (operation.proxyHook == nullptr
5510
- && operation.storage.soaBodies.size() > 0
5511
- && operation.storage.soaBodies.size() <= 16));
5521
+ && (isLargeStackWorld || isSmallDynamicWorld(operation));
5512
5522
  return boxBox(a, b, isSmallWorld, isLargeStackWorld);
5513
5523
  }
5514
5524
 
@@ -10348,7 +10358,7 @@ void applyWarmContactApplication(Body& a, Body& b, bool movableA, bool movableB,
10348
10358
  void warmStartSoAContacts(SolverOperation& operation, Body* bodies, std::uint32_t bodyCount) {
10349
10359
  constexpr std::uint32_t cacheStride = kContactCacheStride;
10350
10360
  const bool isLargeStackWorld = operation.proxyHook == nullptr && operation.stepSubsteps > 1 && bodyCount > 360;
10351
- const bool useSmallWarm = isLargeStackWorld || (bodyCount <= 16 && operation.proxyHook == nullptr);
10361
+ const bool useSmallWarm = isLargeStackWorld || isSmallDynamicWorld(operation);
10352
10362
  std::uint32_t cachedFirst = std::numeric_limits<std::uint32_t>::max();
10353
10363
  std::uint32_t cachedSecond = std::numeric_limits<std::uint32_t>::max();
10354
10364
  Collision cachedContact;
@@ -10552,7 +10562,6 @@ bool discoverContactWakes(
10552
10562
  const bool aSleepingDyn = a.dynamic && a.sleeping;
10553
10563
  const bool bSleepingDyn = b.dynamic && b.sleeping;
10554
10564
  if (!aSleepingDyn && !bSleepingDyn) return;
10555
- if (aSleepingDyn && bSleepingDyn) return;
10556
10565
  if (collisionDisabled(operation, first, second)) return;
10557
10566
  const bool bSurfaceMoving = bodySurfaceMoving(operation, second);
10558
10567
  const bool aSurfaceMoving = bodySurfaceMoving(operation, first);
@@ -10662,7 +10671,7 @@ void resolveSoAContacts(SolverOperation& operation, Body* bodies, std::uint32_t
10662
10671
  const bool applyPositionCorrection = policy.applyPositionCorrection;
10663
10672
  const bool solveVelocity = policy.solveVelocity;
10664
10673
  const bool isLargeStackWorld = operation.proxyHook == nullptr && operation.stepSubsteps > 1 && bodyCount > 360;
10665
- const bool isSmallCandidateWorld = isLargeStackWorld || (bodyCount <= 16 && operation.proxyHook == nullptr);
10674
+ const bool isSmallCandidateWorld = isLargeStackWorld || isSmallDynamicWorld(operation);
10666
10675
  if (beginSubstep) {
10667
10676
  operation.storage.contactConstraintOverflow = false;
10668
10677
  if (pass != ContactPass::OwnedPositionCorrection) {
@@ -11000,6 +11009,7 @@ void resolveSoAContacts(SolverOperation& operation, Body* bodies, std::uint32_t
11000
11009
  if (operation.materialMotionEpochs != nullptr) {
11001
11010
  operation.storage.broadphaseBoundsReady = false;
11002
11011
  operation.storage.sweepPairsReady = false;
11012
+ operation.storage.hasWakeCandidatePair = true;
11003
11013
  } else {
11004
11014
  const bool movedA = bodies[first].x != oldAX || bodies[first].y != oldAY || bodies[first].z != oldAZ;
11005
11015
  const bool movedB = bodies[second].x != oldBX || bodies[second].y != oldBY || bodies[second].z != oldBZ;
@@ -11037,10 +11047,12 @@ void resolveSoAContacts(SolverOperation& operation, Body* bodies, std::uint32_t
11037
11047
  }
11038
11048
  if (pairsOrOrderChanged) {
11039
11049
  operation.storage.sweepPairsReady = false;
11050
+ operation.storage.hasWakeCandidatePair = true;
11040
11051
  }
11041
11052
  } else {
11042
11053
  operation.storage.broadphaseBoundsReady = false;
11043
11054
  operation.storage.sweepPairsReady = false;
11055
+ operation.storage.hasWakeCandidatePair = true;
11044
11056
  }
11045
11057
  }
11046
11058
  }
@@ -12090,12 +12102,14 @@ void updateJointIslandMembership(SolverOperation& operation,
12090
12102
  const Body& b = bodies[second];
12091
12103
  const bool aSleep = a.dynamic && a.sleeping;
12092
12104
  const bool bSleep = b.dynamic && b.sleeping;
12093
- if (aSleep != bSleep) {
12094
- const Body& awake = aSleep ? b : a;
12095
- const std::uint32_t awakeIdx = aSleep ? second : first;
12096
- if (awake.dynamic || awake.kinematic
12097
- || awake.vx != 0.0 || awake.vy != 0.0 || awake.vz != 0.0
12098
- || (hasSurfaces && bodySurfaceMoving(operation, awakeIdx))) {
12105
+ if (aSleep || bSleep) {
12106
+ const bool bMoving = (b.dynamic && !b.sleeping) || b.kinematic
12107
+ || b.vx != 0.0 || b.vy != 0.0 || b.vz != 0.0
12108
+ || (hasSurfaces && bodySurfaceMoving(operation, second));
12109
+ const bool aMoving = (a.dynamic && !a.sleeping) || a.kinematic
12110
+ || a.vx != 0.0 || a.vy != 0.0 || a.vz != 0.0
12111
+ || (hasSurfaces && bodySurfaceMoving(operation, first));
12112
+ if ((aSleep && bMoving) || (bSleep && aMoving)) {
12099
12113
  anyWakeCandidate = true;
12100
12114
  }
12101
12115
  }
@@ -12169,9 +12183,26 @@ void updateJointIslandMembership(SolverOperation& operation,
12169
12183
  }
12170
12184
  }
12171
12185
 
12186
+ bool anyWakeCandidate = false;
12187
+ const bool hasSurfaces = !operation.inputs.baseSurfaces.empty();
12172
12188
  auto unionDynamicPair = [&](std::uint32_t first, std::uint32_t second) {
12173
- if (first < bodyCount && second < bodyCount && first != second
12174
- && bodies[first].dynamic && bodies[second].dynamic) {
12189
+ if (first >= bodyCount || second >= bodyCount || first == second) return;
12190
+ const Body& a = bodies[first];
12191
+ const Body& b = bodies[second];
12192
+ const bool aSleep = a.dynamic && a.sleeping;
12193
+ const bool bSleep = b.dynamic && b.sleeping;
12194
+ if (aSleep || bSleep) {
12195
+ const bool bMoving = (b.dynamic && !b.sleeping) || b.kinematic
12196
+ || b.vx != 0.0 || b.vy != 0.0 || b.vz != 0.0
12197
+ || (hasSurfaces && bodySurfaceMoving(operation, second));
12198
+ const bool aMoving = (a.dynamic && !a.sleeping) || a.kinematic
12199
+ || a.vx != 0.0 || a.vy != 0.0 || a.vz != 0.0
12200
+ || (hasSurfaces && bodySurfaceMoving(operation, first));
12201
+ if ((aSleep && bMoving) || (bSleep && aMoving)) {
12202
+ anyWakeCandidate = true;
12203
+ }
12204
+ }
12205
+ if (a.dynamic && b.dynamic) {
12175
12206
  sleepUnion(operation, first, second);
12176
12207
  }
12177
12208
  };
@@ -12189,6 +12220,7 @@ void updateJointIslandMembership(SolverOperation& operation,
12189
12220
  operation.storage.broadphaseTree->forEachCollectedPair(unionDynamicPair);
12190
12221
  }
12191
12222
  }
12223
+ operation.storage.hasWakeCandidatePair = anyWakeCandidate;
12192
12224
 
12193
12225
  auto& componentHasJoint = operation.storage.componentHasJoint;
12194
12226
  auto& componentHasActive = operation.storage.componentHasActive;
@@ -23470,7 +23502,9 @@ std::int32_t solveStartingConstraints(SolverOperation& operation,
23470
23502
  hasAnyActiveJointContact);
23471
23503
  }
23472
23504
 
23473
- if (!hasAnyActiveJointContact && hook.fn == nullptr && operation.materialMotionEpochs == nullptr) {
23505
+ if (!hasAnyActiveJointContact
23506
+ && (!hasAnyActiveJointIsland || !operation.storage.hasWakeCandidatePair)
23507
+ && hook.fn == nullptr && operation.materialMotionEpochs == nullptr) {
23474
23508
  for (std::uint32_t index = 0; warmState != nullptr && index < jointCount; ++index) {
23475
23509
  const Joint& joint = operation.storage.soaJoints[index];
23476
23510
  const std::uint64_t expected = jointWarmSignature(