@series-inc/rundot-syncplay 6.0.0-rc.59 → 6.0.0-rc.60
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.
- package/core/native/physics/capsule_triangle_native.inc +17 -0
- package/core/native/physics/constraint_rows.cpp +12 -10
- package/core/native/physics/physics.cpp +555 -89
- package/core/native/physics/physics.hpp +4 -0
- package/core/native/physics/world.cpp +7 -8
- package/core/src/physics/physics-profile-wasm-module.generated.mjs +5 -5
- package/core/src/physics/physics-wasm-module.generated.mjs +5 -5
- package/core/src/physics2d/physics2d-wasm-module.generated.mjs +1 -1
- package/dist/canonical.d.ts +11 -0
- package/dist/canonical.js +45 -1
- package/dist/session-wire.js +23 -11
- package/package.json +2 -2
|
@@ -11,6 +11,23 @@ exact_dyadic::Operation& arithmetic(SolverOperation& operation){
|
|
|
11
11
|
return *operation.triangleArithmetic;
|
|
12
12
|
}
|
|
13
13
|
void work(SolverOperation& operation,std::uint64_t amount=1){if(!operation.triangleQuota.charge(amount))throw TriangleNativeFailure{tp::Failure::WorkExhausted};}
|
|
14
|
+
// Same quota state and failure point as `count` sequential work(operation, amount) calls.
|
|
15
|
+
void workRepeated(SolverOperation& operation,std::uint64_t amount,std::uint64_t count){
|
|
16
|
+
if(count==0)return;
|
|
17
|
+
#if defined(RUNDOT_PHYSICS_DEBUG_INVARIANTS)
|
|
18
|
+
std::uint64_t expectedRemaining=operation.triangleQuota.remainingWork,charged=0;
|
|
19
|
+
while(charged<count&&expectedRemaining>=amount){expectedRemaining-=amount;charged+=1;}
|
|
20
|
+
const bool expectedThrow=charged<count;
|
|
21
|
+
const std::uint64_t before=operation.triangleQuota.remainingWork;
|
|
22
|
+
const auto affordableCheck=before/amount;
|
|
23
|
+
RUNDOT_PHYSICS_DEBUG_ASSERT((affordableCheck<count)==expectedThrow);
|
|
24
|
+
RUNDOT_PHYSICS_DEBUG_ASSERT(before-amount*std::min(affordableCheck,count)==expectedRemaining);
|
|
25
|
+
#endif
|
|
26
|
+
const std::uint64_t affordable=operation.triangleQuota.remainingWork/amount;
|
|
27
|
+
if(affordable>=count){operation.triangleQuota.remainingWork-=amount*count;return;}
|
|
28
|
+
operation.triangleQuota.remainingWork-=amount*affordable;
|
|
29
|
+
throw TriangleNativeFailure{tp::Failure::WorkExhausted};
|
|
30
|
+
}
|
|
14
31
|
void stage(SolverOperation& operation,std::uint64_t bytes){if(bytes>operation.triangleStagingRemaining)throw TriangleNativeFailure{tp::Failure::ArithmeticExhausted};operation.triangleStagingRemaining-=bytes;}\
|
|
15
32
|
template<class T>void append(SolverOperation& operation,std::vector<T>& list,T value){
|
|
16
33
|
work(operation);
|
|
@@ -664,24 +664,26 @@ SixDofResponseStatus recordSixDofConstraintImpulse(
|
|
|
664
664
|
if (!std::isfinite(appliedImpulse) || !validSixDofPreparedRow(row)) {
|
|
665
665
|
return SixDofResponseStatus::Unrepresentable;
|
|
666
666
|
}
|
|
667
|
-
|
|
668
|
-
auto& scalar =
|
|
667
|
+
// Stage only the values that change; `history` stays untouched on every failure path.
|
|
668
|
+
auto& scalar = history.rows[slot];
|
|
669
669
|
if (scalar.engaged && scalar.kind != metadata.kind) return SixDofResponseStatus::InvalidState;
|
|
670
|
-
scalar.
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
scalar.appliedImpulse += appliedImpulse;
|
|
674
|
-
if (!std::isfinite(scalar.appliedImpulse)) return SixDofResponseStatus::Unrepresentable;
|
|
670
|
+
const double nextAppliedImpulse = scalar.appliedImpulse + appliedImpulse;
|
|
671
|
+
if (!std::isfinite(nextAppliedImpulse)) return SixDofResponseStatus::Unrepresentable;
|
|
672
|
+
std::array<std::array<double, 6>, 2> nextEndpointImpulse = history.endpointImpulse;
|
|
675
673
|
for (std::uint32_t endpoint = 0; endpoint < 2; ++endpoint) {
|
|
676
674
|
const auto& jacobian = endpoint == 0 ? row.jacobianA : row.jacobianB;
|
|
677
675
|
for (std::uint32_t component = 0; component < 6; ++component) {
|
|
678
|
-
|
|
676
|
+
nextEndpointImpulse[endpoint][component] += jacobian[component] * appliedImpulse;
|
|
679
677
|
}
|
|
680
|
-
if (!finiteSixDofValues(
|
|
678
|
+
if (!finiteSixDofValues(nextEndpointImpulse[endpoint])) {
|
|
681
679
|
return SixDofResponseStatus::Unrepresentable;
|
|
682
680
|
}
|
|
683
681
|
}
|
|
684
|
-
|
|
682
|
+
scalar.kind = metadata.kind;
|
|
683
|
+
scalar.engaged = true;
|
|
684
|
+
scalar.accumulatedImpulse = row.scalar.accumulatedImpulse;
|
|
685
|
+
scalar.appliedImpulse = nextAppliedImpulse;
|
|
686
|
+
history.endpointImpulse = nextEndpointImpulse;
|
|
685
687
|
return SixDofResponseStatus::Success;
|
|
686
688
|
}
|
|
687
689
|
|