@series-inc/rundot-syncplay 6.0.0-rc.2 → 6.0.0-rc.21
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/README.md +133 -0
- package/core/deterministic-math.d.ts +75 -1
- package/core/native/instance_ledger.hpp +1095 -0
- package/core/native/legacy_checkpoint_ids.hpp +107 -0
- package/core/native/physics/abi.cpp +39 -211
- package/core/native/physics/abi.hpp +2 -6
- package/core/native/physics/articulation.cpp +1434 -0
- package/core/native/physics/articulation.hpp +279 -0
- package/core/native/physics/buoyancy.cpp +1588 -0
- package/core/native/physics/buoyancy.hpp +254 -0
- package/core/native/physics/capsule_triangle.cpp +168 -0
- package/core/native/physics/capsule_triangle.hpp +40 -0
- package/core/native/physics/capsule_triangle_native.inc +291 -0
- package/core/native/physics/certified_sum.hpp +218 -0
- package/core/native/physics/character.cpp +638 -0
- package/core/native/physics/character.hpp +169 -0
- package/core/native/physics/checkpoint_schema.hpp +379 -0
- package/core/native/physics/cloth.cpp +1401 -0
- package/core/native/physics/cloth.hpp +357 -0
- package/core/native/physics/constraint_rows.cpp +363 -2
- package/core/native/physics/constraint_rows.hpp +72 -1
- package/core/native/physics/deformable_query.cpp +1630 -0
- package/core/native/physics/deformable_query.hpp +578 -0
- package/core/native/physics/distance.cpp +1166 -0
- package/core/native/physics/distance.hpp +151 -0
- package/core/native/physics/exact/exact-applied.cpp +101 -0
- package/core/native/physics/exact/exact-applied.hpp +112 -0
- package/core/native/physics/exact/exact-dyadic.cpp +691 -0
- package/core/native/physics/exact/exact-dyadic.hpp +58 -0
- package/core/native/physics/exact/exact-operation.hpp +51 -0
- package/core/native/physics/exact/word-core.hpp +262 -0
- package/core/native/physics/extended_abi.cpp +1242 -0
- package/core/native/physics/extended_abi.hpp +355 -0
- package/core/native/physics/extended_abi_characters.cpp +261 -0
- package/core/native/physics/extended_abi_characters.hpp +434 -0
- package/core/native/physics/extended_abi_core_features.cpp +713 -0
- package/core/native/physics/extended_abi_core_features.hpp +226 -0
- package/core/native/physics/extended_abi_deformables.cpp +448 -0
- package/core/native/physics/extended_abi_deformables.hpp +867 -0
- package/core/native/physics/extended_abi_vehicles.cpp +411 -0
- package/core/native/physics/extended_abi_vehicles.hpp +222 -0
- package/core/native/physics/fracture.cpp +1981 -0
- package/core/native/physics/fracture.hpp +460 -0
- package/core/native/physics/gear.cpp +563 -0
- package/core/native/physics/gear.hpp +158 -0
- package/core/native/physics/geometry_memory.hpp +476 -0
- package/core/native/physics/geometry_store.cpp +547 -0
- package/core/native/physics/geometry_store.hpp +134 -0
- package/core/native/physics/lag_compensation.cpp +1626 -0
- package/core/native/physics/lag_compensation.hpp +405 -0
- package/core/native/physics/mass_properties.cpp +449 -0
- package/core/native/physics/mass_properties.hpp +23 -0
- package/core/native/physics/material_pose.hpp +988 -0
- package/core/native/physics/particles.cpp +1065 -0
- package/core/native/physics/particles.hpp +261 -0
- package/core/native/physics/path_joint.cpp +781 -0
- package/core/native/physics/path_joint.hpp +154 -0
- package/core/native/physics/physics.cpp +13043 -1065
- package/core/native/physics/physics.hpp +184 -8
- package/core/native/physics/planar_deformable.cpp +2433 -0
- package/core/native/physics/planar_deformable.hpp +889 -0
- package/core/native/physics/platformer_2d.cpp +1353 -0
- package/core/native/physics/platformer_2d.hpp +340 -0
- package/core/native/physics/powered_ragdoll.cpp +1100 -0
- package/core/native/physics/powered_ragdoll.hpp +279 -0
- package/core/native/physics/powertrain.cpp +586 -0
- package/core/native/physics/powertrain.hpp +180 -0
- package/core/native/physics/pulley.cpp +311 -0
- package/core/native/physics/pulley.hpp +121 -0
- package/core/native/physics/ragdoll.cpp +586 -0
- package/core/native/physics/ragdoll.hpp +221 -0
- package/core/native/physics/rope.cpp +692 -0
- package/core/native/physics/rope.hpp +215 -0
- package/core/native/physics/rounded_convex.cpp +1229 -0
- package/core/native/physics/rounded_convex.hpp +287 -0
- package/core/native/physics/sdf_geometry.cpp +1821 -0
- package/core/native/physics/sdf_geometry.hpp +474 -0
- package/core/native/physics/soft_body.cpp +1449 -0
- package/core/native/physics/soft_body.hpp +328 -0
- package/core/native/physics/soft_collision.cpp +1862 -0
- package/core/native/physics/soft_collision.hpp +561 -0
- package/core/native/physics/surface_velocity.cpp +366 -0
- package/core/native/physics/surface_velocity.hpp +243 -0
- package/core/native/physics/topology.cpp +357 -39
- package/core/native/physics/topology.hpp +97 -6
- package/core/native/physics/tracks.cpp +1179 -0
- package/core/native/physics/tracks.hpp +404 -0
- package/core/native/physics/vehicle.cpp +629 -0
- package/core/native/physics/vehicle.hpp +191 -0
- package/core/native/physics/voxel_cooking.cpp +1929 -0
- package/core/native/physics/voxel_cooking.hpp +395 -0
- package/core/native/physics/world.cpp +5290 -854
- package/core/native/physics/world.hpp +796 -24
- package/core/native/physics/world_abi.cpp +3840 -306
- package/core/native/physics/world_abi.hpp +530 -10
- package/core/native/physics/world_digest_visitor.hpp +277 -0
- package/core/native/physics/world_strong_digest.hpp +557 -0
- package/core/native/physics2d/ccd.cpp +1302 -0
- package/core/native/physics2d/ccd.hpp +141 -0
- package/core/native/physics2d/checkpoint_memory.hpp +349 -0
- package/core/native/physics2d/clock_primitives.hpp +138 -0
- package/core/native/physics2d/commands.cpp +174 -28
- package/core/native/physics2d/commands.hpp +3 -1
- package/core/native/physics2d/compound.cpp +581 -0
- package/core/native/physics2d/compound.hpp +248 -0
- package/core/native/physics2d/contour.cpp +325 -0
- package/core/native/physics2d/contour.hpp +143 -0
- package/core/native/physics2d/frame_scope.hpp +124 -0
- package/core/native/physics2d/joint_phases.hpp +93 -0
- package/core/native/physics2d/joints.cpp +587 -150
- package/core/native/physics2d/joints.hpp +5 -0
- package/core/native/physics2d/memory_private.hpp +125 -0
- package/core/native/physics2d/owned_abi.cpp +1354 -879
- package/core/native/physics2d/owned_abi.hpp +190 -52
- package/core/native/physics2d/phase_test_hooks.hpp +17 -0
- package/core/native/physics2d/physics2d.cpp +2073 -120
- package/core/native/physics2d/physics2d.hpp +154 -2
- package/core/native/physics2d/queries.cpp +1055 -79
- package/core/native/physics2d/queries.hpp +71 -5
- package/core/native/physics2d/world.cpp +1313 -353
- package/core/native/physics2d/world.hpp +124 -13
- package/core/native/sha256/sha256_compress_unsigned.hpp +68 -0
- package/core/native/sha256/sha256_fips_constants.hpp +24 -0
- package/core/native/sha256/sha256_length.hpp +56 -0
- package/core/native/sha256/sha256_memo.hpp +48 -0
- package/core/native/sha256/sha256_sink.hpp +234 -0
- package/core/physics2d-owned.d.ts +466 -126
- package/core/runtime.d.ts +192 -19
- package/core/scripts/build-native.mjs +34 -0
- package/core/scripts/build-wasm-physics.mjs +272 -23
- package/core/scripts/extended-physics-profile.mjs +634 -0
- package/core/scripts/generate-physics2d-vectors.mjs +59 -0
- package/core/src/kinetix-deterministic-math.d.ts +2 -0
- package/core/src/kinetix-deterministic-math.mjs +513 -27
- package/core/src/kinetix-owned-runtime-adapter.mjs +788 -0
- package/core/src/kinetix-runtime-adapter-utils.mjs +54 -6
- package/core/src/kinetix-runtime-contract.mjs +55 -9
- package/core/src/kinetix-runtime-identity.mjs +12 -1
- package/core/src/kinetix-session-config.mjs +7 -2
- package/core/src/kinetix-state-report.mjs +36 -0
- package/core/src/physics/abi-constants.mjs +5 -4
- package/core/src/physics/articulation.d.mts +194 -0
- package/core/src/physics/articulation.mjs +1141 -0
- package/core/src/physics/buoyancy.d.mts +143 -0
- package/core/src/physics/buoyancy.mjs +268 -0
- package/core/src/physics/cloth.d.mts +314 -0
- package/core/src/physics/cloth.mjs +1156 -0
- package/core/src/physics/deformable-query.d.mts +217 -0
- package/core/src/physics/deformable-query.mjs +1412 -0
- package/core/src/physics/distance.d.mts +160 -0
- package/core/src/physics/distance.mjs +175 -0
- package/core/src/physics/extended-wasm-instance.d.mts +5 -0
- package/core/src/physics/extended-wasm-instance.mjs +48 -0
- package/core/src/physics/feature-api.d.mts +74 -0
- package/core/src/physics/feature-api.mjs +98 -0
- package/core/src/physics/fracture.d.mts +133 -0
- package/core/src/physics/fracture.mjs +1324 -0
- package/core/src/physics/gear.d.mts +585 -0
- package/core/src/physics/gear.mjs +955 -0
- package/core/src/physics/lag-compensation.d.mts +101 -0
- package/core/src/physics/lag-compensation.mjs +1100 -0
- package/core/src/physics/mass-properties.d.mts +114 -0
- package/core/src/physics/mass-properties.mjs +137 -468
- package/core/src/physics/particles.d.mts +177 -0
- package/core/src/physics/particles.mjs +758 -0
- package/core/src/physics/path-joint.d.mts +171 -0
- package/core/src/physics/path-joint.mjs +1231 -0
- package/core/src/physics/physics-extended-wasm-module.generated.mjs +13 -0
- package/core/src/physics/physics-profile-wasm-module.generated.mjs +48 -0
- package/core/src/physics/physics-wasm-module.generated.mjs +34 -5
- package/core/src/physics/powered-ragdoll.d.mts +188 -0
- package/core/src/physics/powered-ragdoll.mjs +1043 -0
- package/core/src/physics/powertrain.d.mts +260 -0
- package/core/src/physics/powertrain.mjs +621 -0
- package/core/src/physics/pulley.d.mts +98 -0
- package/core/src/physics/pulley.mjs +686 -0
- package/core/src/physics/ragdoll.d.mts +289 -0
- package/core/src/physics/ragdoll.mjs +1323 -0
- package/core/src/physics/rope.d.mts +241 -0
- package/core/src/physics/rope.mjs +319 -0
- package/core/src/physics/rounded-convex.d.mts +328 -0
- package/core/src/physics/rounded-convex.mjs +1404 -0
- package/core/src/physics/sdf-geometry.d.mts +117 -0
- package/core/src/physics/sdf-geometry.mjs +1204 -0
- package/core/src/physics/soft-body.d.mts +144 -0
- package/core/src/physics/soft-body.mjs +1285 -0
- package/core/src/physics/soft-collision.d.mts +651 -0
- package/core/src/physics/soft-collision.mjs +1883 -0
- package/core/src/physics/surface-velocity.d.mts +156 -0
- package/core/src/physics/surface-velocity.mjs +722 -0
- package/core/src/physics/tracks.d.mts +411 -0
- package/core/src/physics/tracks.mjs +1074 -0
- package/core/src/physics/vehicle.d.mts +3 -0
- package/core/src/physics/vehicle.mjs +172 -0
- package/core/src/physics/voxel-cooking.d.mts +219 -0
- package/core/src/physics/voxel-cooking.mjs +1499 -0
- package/core/src/physics/voxel-swept-quad.mjs +110 -0
- package/core/src/physics/wasm-instance.mjs +160 -23
- package/core/src/physics/world.d.mts +62 -0
- package/core/src/physics/world.mjs +1947 -152
- package/core/src/physics2d/body-state.mjs +218 -15
- package/core/src/physics2d/collision.d.mts +52 -0
- package/core/src/physics2d/collision.mjs +234 -0
- package/core/src/physics2d/compound.mjs +454 -0
- package/core/src/physics2d/contour-state.mjs +771 -0
- package/core/src/physics2d/feature-api.d.mts +211 -0
- package/core/src/physics2d/feature-api.mjs +3 -0
- package/core/src/physics2d/fluid-state.mjs +145 -0
- package/core/src/physics2d/joint-state.mjs +1 -1
- package/core/src/physics2d/owned-queries.mjs +3 -1
- package/core/src/physics2d/owned-transport.mjs +268 -122
- package/core/src/physics2d/owned-world.mjs +353 -230
- package/core/src/physics2d/particle-fluid.d.mts +152 -0
- package/core/src/physics2d/particle-fluid.mjs +233 -0
- package/core/src/physics2d/physics2d-wasm-module.generated.mjs +27 -10
- package/core/src/physics2d/query-codec.mjs +61 -13
- package/core/src/physics2d/submerged-geometry.d.mts +51 -0
- package/core/src/physics2d/submerged-geometry.mjs +186 -0
- package/core/src/runtime.mjs +23 -0
- package/core/src/shared/bytes.d.mts +2 -0
- package/core/src/shared/bytes.mjs +33 -0
- package/core/src/shared/sha256.d.mts +3 -0
- package/core/src/shared/sha256.mjs +72 -22
- package/core/units.d.ts +50 -0
- package/core/world.d.ts +253 -5
- package/dist/authority-room.d.ts +9 -0
- package/dist/authority-room.js +45 -16
- package/dist/browser.d.ts +6 -5
- package/dist/browser.js +4 -3
- package/dist/cadence.d.ts +7 -0
- package/dist/cadence.js +19 -0
- package/dist/canonical.d.ts +1 -0
- package/dist/canonical.js +3 -0
- package/dist/checksum-policy.d.ts +10 -0
- package/dist/checksum-policy.js +14 -0
- package/dist/collider-cooking-hull.d.ts +18 -0
- package/dist/collider-cooking-hull.js +248 -0
- package/dist/collider-cooking.d.ts +140 -0
- package/dist/collider-cooking.js +794 -0
- package/dist/compat/v5.d.ts +121 -0
- package/dist/compat/v5.js +479 -0
- package/dist/creator.d.ts +7 -6
- package/dist/creator.js +4 -3
- package/dist/game-byte-section.d.ts +36 -0
- package/dist/game-byte-section.js +350 -0
- package/dist/index.d.ts +13 -6
- package/dist/index.js +9 -4
- package/dist/instant-replay.d.ts +27 -2
- package/dist/instant-replay.js +91 -16
- package/dist/lag-compensation3d.js +11 -10
- package/dist/match-log.d.ts +21 -4
- package/dist/match-log.js +92 -9
- package/dist/math.d.ts +2 -0
- package/dist/math.js +1 -0
- package/dist/modules/character-3d.d.ts +16 -1
- package/dist/modules/character-3d.js +42 -5
- package/dist/modules/combat.js +6 -5
- package/dist/movement3d-revision1.d.ts +2 -0
- package/dist/movement3d-revision1.js +973 -0
- package/dist/movement3d.d.ts +53 -3
- package/dist/movement3d.js +917 -247
- package/dist/networked-client.d.ts +15 -0
- package/dist/networked-client.js +378 -105
- package/dist/node.d.ts +3 -2
- package/dist/node.js +2 -1
- package/dist/physics/2d.d.ts +38 -4
- package/dist/physics/2d.js +57 -36
- package/dist/physics/3d.d.ts +755 -111
- package/dist/physics/3d.js +2355 -158
- package/dist/physics/edit-result-graph.d.ts +36 -0
- package/dist/physics/edit-result-graph.js +141 -0
- package/dist/physics/game-codec3d.d.ts +41 -0
- package/dist/physics/game-codec3d.js +544 -0
- package/dist/physics/installed-checkpoint3d.d.ts +13 -0
- package/dist/physics/installed-checkpoint3d.js +120 -0
- package/dist/physics/installed-runtime3d.d.ts +51 -0
- package/dist/physics/installed-runtime3d.js +372 -0
- package/dist/physics/installed-state-commitment3d.d.ts +2 -0
- package/dist/physics/installed-state-commitment3d.js +24 -0
- package/dist/physics/units.d.ts +38 -0
- package/dist/physics/units.js +56 -0
- package/dist/physics/vehicle-state3d.d.ts +93 -0
- package/dist/physics/vehicle-state3d.js +1191 -0
- package/dist/physics/voxel-body-state.d.ts +61 -0
- package/dist/physics/voxel-body-state.js +410 -0
- package/dist/r3f-render-adapter.d.ts +59 -1
- package/dist/r3f-render-adapter.js +137 -2
- package/dist/replay.d.ts +13 -0
- package/dist/replay.js +95 -70
- package/dist/run-room-transport.js +5 -1
- package/dist/runner.d.ts +17 -2
- package/dist/runner.js +472 -84
- package/dist/runtime-cleanup.d.ts +54 -0
- package/dist/runtime-cleanup.js +266 -0
- package/dist/runtime-lease.d.ts +11 -1
- package/dist/runtime-lease.js +23 -10
- package/dist/runtime-room-metadata.d.ts +2 -8
- package/dist/runtime-room-metadata.js +11 -14
- package/dist/runtime-session.d.ts +8 -0
- package/dist/runtime-session.js +222 -58
- package/dist/schema-codegen.js +3 -0
- package/dist/schema-dsl-binary.d.ts +10 -4
- package/dist/schema-dsl-binary.js +375 -76
- package/dist/scratch-pool.d.ts +32 -0
- package/dist/scratch-pool.js +60 -0
- package/dist/sdk-session.d.ts +1 -0
- package/dist/sdk-session.js +4 -0
- package/dist/secret-config.js +2 -60
- package/dist/secret-crypto.js +70 -36
- package/dist/session-snapshot.d.ts +15 -4
- package/dist/session-snapshot.js +35 -33
- package/dist/session-wire.js +14 -22
- package/dist/sparse-set.d.ts +1 -0
- package/dist/sparse-set.js +22 -0
- package/dist/spatial/spatial-grid-3d.d.ts +41 -0
- package/dist/spatial/spatial-grid-3d.js +115 -0
- package/dist/synctest.d.ts +9 -0
- package/dist/synctest.js +106 -17
- package/dist/testing-network.d.ts +2 -0
- package/dist/testing-network.js +122 -18
- package/dist/testing.d.ts +27 -6
- package/dist/testing.js +297 -56
- package/dist/tools/index.d.ts +3 -2
- package/dist/tools/index.js +3 -2
- package/dist/tools/module-certification.d.ts +6 -0
- package/dist/tools/module-certification.js +26 -2
- package/package.json +18 -5
- package/core/scripts/run-box3d-benchmark.mjs +0 -350
- package/core/src/physics/index.mjs +0 -3169
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <array>
|
|
4
|
+
#include <cmath>
|
|
5
|
+
#include <cstdint>
|
|
6
|
+
#include <span>
|
|
7
|
+
|
|
8
|
+
#include "physics.hpp"
|
|
9
|
+
|
|
10
|
+
namespace rundot::kinetix::physics {
|
|
11
|
+
|
|
12
|
+
constexpr std::uint32_t kCharacterAbiVersion = 1;
|
|
13
|
+
constexpr std::uint32_t kCharacterInputStride = 6;
|
|
14
|
+
constexpr std::uint32_t kCharacterConfigStride = 18;
|
|
15
|
+
constexpr std::uint32_t kCharacterStateStride = 17;
|
|
16
|
+
|
|
17
|
+
enum class CharacterStatus : std::int32_t {
|
|
18
|
+
Success = 0,
|
|
19
|
+
InvalidInput = -1,
|
|
20
|
+
InvalidConfig = -2,
|
|
21
|
+
QueryError = -3,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
struct CharacterVec3 {
|
|
25
|
+
double x = 0.0;
|
|
26
|
+
double y = 0.0;
|
|
27
|
+
double z = 0.0;
|
|
28
|
+
|
|
29
|
+
constexpr bool operator==(const CharacterVec3& other) const = default;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Deterministic vector math utilities
|
|
33
|
+
CharacterVec3 addVec3(const CharacterVec3& a, const CharacterVec3& b);
|
|
34
|
+
CharacterVec3 subVec3(const CharacterVec3& a, const CharacterVec3& b);
|
|
35
|
+
CharacterVec3 scaleVec3(const CharacterVec3& v, double s);
|
|
36
|
+
double dotVec3(const CharacterVec3& a, const CharacterVec3& b);
|
|
37
|
+
CharacterVec3 crossVec3(const CharacterVec3& a, const CharacterVec3& b);
|
|
38
|
+
double lengthSquaredVec3(const CharacterVec3& v);
|
|
39
|
+
double lengthVec3(const CharacterVec3& v);
|
|
40
|
+
CharacterVec3 normalizeVec3(const CharacterVec3& v);
|
|
41
|
+
|
|
42
|
+
struct CharacterShape {
|
|
43
|
+
ShapeKind shape = ShapeKind::Capsule;
|
|
44
|
+
double radius = 0.4;
|
|
45
|
+
double halfHeight = 0.6; // cylinder half-height for capsule
|
|
46
|
+
CharacterVec3 halfExtents = {0.4, 0.9, 0.4}; // half-extents for box
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
struct CharacterConfig {
|
|
50
|
+
CharacterVec3 up = {0.0, 1.0, 0.0};
|
|
51
|
+
double maxSlopeAngle = 0.7853981633974483; // 45 degrees
|
|
52
|
+
double stepHeight = 0.35;
|
|
53
|
+
double skinWidth = 0.02;
|
|
54
|
+
double minStepDistance = 1e-4;
|
|
55
|
+
double groundProbeDistance = 0.1;
|
|
56
|
+
CharacterVec3 gravity = {0.0, -9.81, 0.0};
|
|
57
|
+
std::uint32_t maxSlideIterations = 4;
|
|
58
|
+
bool snapToGround = true;
|
|
59
|
+
CharacterShape shape{};
|
|
60
|
+
std::uint32_t collisionLayer = 1;
|
|
61
|
+
std::uint32_t collisionMask = 0xffffffff;
|
|
62
|
+
std::int32_t excludedBodyIndex = -1;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
struct CharacterInput {
|
|
66
|
+
CharacterVec3 movement = {0.0, 0.0, 0.0};
|
|
67
|
+
double dt = 1.0 / 60.0;
|
|
68
|
+
bool jump = false;
|
|
69
|
+
double jumpSpeed = 5.0;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
struct CharacterHit {
|
|
73
|
+
bool hit = false;
|
|
74
|
+
double distance = 0.0;
|
|
75
|
+
CharacterVec3 point = {0.0, 0.0, 0.0};
|
|
76
|
+
CharacterVec3 normal = {0.0, 0.0, 0.0}; // outward surface normal pointing toward character
|
|
77
|
+
std::int32_t bodyIndex = -1;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
struct CharacterState {
|
|
81
|
+
CharacterVec3 position = {0.0, 0.0, 0.0};
|
|
82
|
+
CharacterVec3 velocity = {0.0, 0.0, 0.0};
|
|
83
|
+
bool grounded = false;
|
|
84
|
+
CharacterVec3 groundNormal = {0.0, 1.0, 0.0};
|
|
85
|
+
double groundDistance = 0.0;
|
|
86
|
+
std::int32_t groundBodyIndex = -1;
|
|
87
|
+
bool hitWall = false;
|
|
88
|
+
bool hitCeiling = false;
|
|
89
|
+
bool steppedUp = false;
|
|
90
|
+
bool depenetrated = false;
|
|
91
|
+
std::uint32_t slideCount = 0;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
struct CharacterQueryCallbacks {
|
|
95
|
+
void* userData = nullptr;
|
|
96
|
+
bool (*shapeCast)(
|
|
97
|
+
void* userData,
|
|
98
|
+
const CharacterShape& shape,
|
|
99
|
+
const CharacterVec3& start,
|
|
100
|
+
const CharacterVec3& direction,
|
|
101
|
+
double maxDistance,
|
|
102
|
+
std::uint32_t layerMask,
|
|
103
|
+
std::int32_t excludedBodyIndex,
|
|
104
|
+
CharacterHit& hit) = nullptr;
|
|
105
|
+
bool (*overlap)(
|
|
106
|
+
void* userData,
|
|
107
|
+
const CharacterShape& shape,
|
|
108
|
+
const CharacterVec3& pos,
|
|
109
|
+
std::uint32_t layerMask,
|
|
110
|
+
std::int32_t excludedBodyIndex,
|
|
111
|
+
CharacterHit& hit) = nullptr;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Core KCC algorithms
|
|
115
|
+
bool checkGroundSupport(
|
|
116
|
+
CharacterState& state,
|
|
117
|
+
const CharacterConfig& config,
|
|
118
|
+
const CharacterQueryCallbacks& queries);
|
|
119
|
+
|
|
120
|
+
bool sweepAndSlide(
|
|
121
|
+
CharacterVec3& currentPos,
|
|
122
|
+
CharacterVec3& move,
|
|
123
|
+
CharacterState& state,
|
|
124
|
+
const CharacterConfig& config,
|
|
125
|
+
const CharacterQueryCallbacks& queries,
|
|
126
|
+
bool isHorizontal);
|
|
127
|
+
|
|
128
|
+
bool tryStepUp(
|
|
129
|
+
CharacterVec3& currentPos,
|
|
130
|
+
const CharacterVec3& horizMove,
|
|
131
|
+
CharacterState& state,
|
|
132
|
+
const CharacterConfig& config,
|
|
133
|
+
const CharacterQueryCallbacks& queries);
|
|
134
|
+
|
|
135
|
+
bool depenetrateCharacter(
|
|
136
|
+
CharacterVec3& currentPos,
|
|
137
|
+
const CharacterConfig& config,
|
|
138
|
+
const CharacterQueryCallbacks& queries);
|
|
139
|
+
|
|
140
|
+
CharacterStatus stepCharacterController(
|
|
141
|
+
CharacterState& state,
|
|
142
|
+
const CharacterInput& input,
|
|
143
|
+
const CharacterConfig& config,
|
|
144
|
+
const CharacterQueryCallbacks& queries);
|
|
145
|
+
|
|
146
|
+
CharacterStatus stepCharacterWithBodies(
|
|
147
|
+
CharacterState& state,
|
|
148
|
+
const CharacterInput& input,
|
|
149
|
+
const CharacterConfig& config,
|
|
150
|
+
const double* bodyData,
|
|
151
|
+
std::uint32_t bodyCount);
|
|
152
|
+
|
|
153
|
+
} // namespace rundot::kinetix::physics
|
|
154
|
+
|
|
155
|
+
extern "C" {
|
|
156
|
+
|
|
157
|
+
std::uint32_t rundot_kinetix_physics_character_abi_version();
|
|
158
|
+
std::uint32_t rundot_kinetix_physics_character_input_stride();
|
|
159
|
+
std::uint32_t rundot_kinetix_physics_character_config_stride();
|
|
160
|
+
std::uint32_t rundot_kinetix_physics_character_state_stride();
|
|
161
|
+
|
|
162
|
+
std::int32_t rundot_kinetix_physics_character_step(
|
|
163
|
+
const double* bodyData,
|
|
164
|
+
std::uint32_t bodyCount,
|
|
165
|
+
const double* inputData,
|
|
166
|
+
const double* configData,
|
|
167
|
+
double* stateData);
|
|
168
|
+
|
|
169
|
+
} // extern "C"
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "world.hpp"
|
|
4
|
+
|
|
5
|
+
#include <cstddef>
|
|
6
|
+
#include <cstdint>
|
|
7
|
+
|
|
8
|
+
namespace rundot::kinetix::physics {
|
|
9
|
+
|
|
10
|
+
inline constexpr std::uint32_t kWorldStrongDigestAlgorithmRevision = 1;
|
|
11
|
+
inline constexpr char kStrongCheckpointDomain[] = "kinetix.world-checkpoint/1";
|
|
12
|
+
inline constexpr char kStrongRecordDomain[] = "kinetix.geometry-record/1";
|
|
13
|
+
inline constexpr char kStrongRootDomain[] = "kinetix.geometry-root/1";
|
|
14
|
+
inline constexpr char kStrongMaterialDomain[] = "kinetix.material-root/1";
|
|
15
|
+
inline constexpr char kStrongTileDomain[] = "kinetix.body-tile/1";
|
|
16
|
+
|
|
17
|
+
static_assert(sizeof(kStrongCheckpointDomain) - 1 == 26);
|
|
18
|
+
static_assert(sizeof(kStrongRecordDomain) - 1 == 25);
|
|
19
|
+
static_assert(sizeof(kStrongRootDomain) - 1 == 23);
|
|
20
|
+
static_assert(sizeof(kStrongMaterialDomain) - 1 == 23);
|
|
21
|
+
static_assert(sizeof(kStrongTileDomain) - 1 == 19);
|
|
22
|
+
|
|
23
|
+
// One field list drives the FNV visitor and the strong visitor.
|
|
24
|
+
#define RUNDOT_CHECKPOINT_FIELDS(X) \
|
|
25
|
+
X(StrongRevision) \
|
|
26
|
+
X(WorldLimits) \
|
|
27
|
+
X(Profile) \
|
|
28
|
+
X(Frame) \
|
|
29
|
+
X(TopologyCounters) \
|
|
30
|
+
X(TopologyIds) \
|
|
31
|
+
X(Bodies) \
|
|
32
|
+
X(Joints) \
|
|
33
|
+
X(Geometry) \
|
|
34
|
+
X(ContactCache) \
|
|
35
|
+
X(Forces) \
|
|
36
|
+
X(TickForces) \
|
|
37
|
+
X(Supports) \
|
|
38
|
+
X(Fluids) \
|
|
39
|
+
X(SurfaceVelocities) \
|
|
40
|
+
X(JointWarm) \
|
|
41
|
+
X(ContactEvents) \
|
|
42
|
+
X(JointReactions) \
|
|
43
|
+
X(JointBreaks) \
|
|
44
|
+
X(FluidInteractions) \
|
|
45
|
+
X(DefinitionSignatures) \
|
|
46
|
+
X(Pose)
|
|
47
|
+
|
|
48
|
+
enum class CheckpointField : std::uint8_t {
|
|
49
|
+
#define RUNDOT_CHECKPOINT_FIELD_ENUM(name) name,
|
|
50
|
+
RUNDOT_CHECKPOINT_FIELDS(RUNDOT_CHECKPOINT_FIELD_ENUM)
|
|
51
|
+
#undef RUNDOT_CHECKPOINT_FIELD_ENUM
|
|
52
|
+
Count
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
enum class StrongSection : std::uint32_t {
|
|
56
|
+
TopologyIds = 1,
|
|
57
|
+
Bodies = 2,
|
|
58
|
+
Joints = 3,
|
|
59
|
+
ContactCache = 4,
|
|
60
|
+
Forces = 5,
|
|
61
|
+
TickForces = 6,
|
|
62
|
+
Fluids = 7,
|
|
63
|
+
SurfaceVelocities = 8,
|
|
64
|
+
JointWarm = 9,
|
|
65
|
+
ContactEvents = 10,
|
|
66
|
+
JointReactions = 11,
|
|
67
|
+
JointBreaks = 12,
|
|
68
|
+
FluidInteractions = 13,
|
|
69
|
+
DefinitionSignatures = 14,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// FNV revision 2 order. Supports stays in the list. The visitor omits an empty channel.
|
|
73
|
+
inline constexpr CheckpointField kFnvFieldOrder[] = {
|
|
74
|
+
CheckpointField::Profile,
|
|
75
|
+
CheckpointField::Frame,
|
|
76
|
+
CheckpointField::TopologyCounters,
|
|
77
|
+
CheckpointField::TopologyIds,
|
|
78
|
+
CheckpointField::Bodies,
|
|
79
|
+
CheckpointField::Joints,
|
|
80
|
+
CheckpointField::Geometry,
|
|
81
|
+
CheckpointField::ContactCache,
|
|
82
|
+
CheckpointField::Forces,
|
|
83
|
+
CheckpointField::TickForces,
|
|
84
|
+
CheckpointField::Supports,
|
|
85
|
+
CheckpointField::Fluids,
|
|
86
|
+
CheckpointField::SurfaceVelocities,
|
|
87
|
+
CheckpointField::ContactEvents,
|
|
88
|
+
CheckpointField::JointReactions,
|
|
89
|
+
CheckpointField::JointBreaks,
|
|
90
|
+
CheckpointField::FluidInteractions,
|
|
91
|
+
CheckpointField::JointWarm,
|
|
92
|
+
CheckpointField::DefinitionSignatures,
|
|
93
|
+
CheckpointField::Pose,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Strong order. Warm state is before the output records.
|
|
97
|
+
inline constexpr CheckpointField kStrongFieldOrder[] = {
|
|
98
|
+
CheckpointField::StrongRevision,
|
|
99
|
+
CheckpointField::WorldLimits,
|
|
100
|
+
CheckpointField::Profile,
|
|
101
|
+
CheckpointField::Frame,
|
|
102
|
+
CheckpointField::TopologyCounters,
|
|
103
|
+
CheckpointField::TopologyIds,
|
|
104
|
+
CheckpointField::Bodies,
|
|
105
|
+
CheckpointField::Joints,
|
|
106
|
+
CheckpointField::Geometry,
|
|
107
|
+
CheckpointField::ContactCache,
|
|
108
|
+
CheckpointField::Forces,
|
|
109
|
+
CheckpointField::TickForces,
|
|
110
|
+
CheckpointField::Supports,
|
|
111
|
+
CheckpointField::Fluids,
|
|
112
|
+
CheckpointField::SurfaceVelocities,
|
|
113
|
+
CheckpointField::JointWarm,
|
|
114
|
+
CheckpointField::ContactEvents,
|
|
115
|
+
CheckpointField::JointReactions,
|
|
116
|
+
CheckpointField::JointBreaks,
|
|
117
|
+
CheckpointField::FluidInteractions,
|
|
118
|
+
CheckpointField::DefinitionSignatures,
|
|
119
|
+
CheckpointField::Pose,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
consteval bool checkpointOrderHas(const CheckpointField* order, std::size_t count, CheckpointField field) {
|
|
123
|
+
std::size_t seen = 0;
|
|
124
|
+
for (std::size_t index = 0; index < count; ++index) {
|
|
125
|
+
if (order[index] == field) ++seen;
|
|
126
|
+
}
|
|
127
|
+
return seen == 1;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
consteval bool checkpointOrdersCover() {
|
|
131
|
+
constexpr CheckpointField kFields[] = {
|
|
132
|
+
#define RUNDOT_CHECKPOINT_FIELD_LIST(name) CheckpointField::name,
|
|
133
|
+
RUNDOT_CHECKPOINT_FIELDS(RUNDOT_CHECKPOINT_FIELD_LIST)
|
|
134
|
+
#undef RUNDOT_CHECKPOINT_FIELD_LIST
|
|
135
|
+
};
|
|
136
|
+
static_assert(std::size(kFields) == static_cast<std::size_t>(CheckpointField::Count));
|
|
137
|
+
for (const CheckpointField field : kFields) {
|
|
138
|
+
if (!checkpointOrderHas(kStrongFieldOrder, std::size(kStrongFieldOrder), field)) return false;
|
|
139
|
+
const bool strongOnly = field == CheckpointField::StrongRevision || field == CheckpointField::WorldLimits;
|
|
140
|
+
const bool inFnv = checkpointOrderHas(kFnvFieldOrder, std::size(kFnvFieldOrder), field);
|
|
141
|
+
if (strongOnly == inFnv) return false;
|
|
142
|
+
}
|
|
143
|
+
return std::size(kStrongFieldOrder) == std::size(kFields)
|
|
144
|
+
&& std::size(kFnvFieldOrder) + 2 == std::size(kFields);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static_assert(checkpointOrdersCover());
|
|
148
|
+
|
|
149
|
+
// These declarations reject new fields, including fields that fit in padding.
|
|
150
|
+
inline void checkpointRecordSchemaGuard(const WorldProfile& value) noexcept {
|
|
151
|
+
[[maybe_unused]] const auto& [abiVersion, numericProfile, id, geometryDigest] = value;
|
|
152
|
+
}
|
|
153
|
+
inline void checkpointRecordSchemaGuard(const WorldLimits& value) noexcept {
|
|
154
|
+
[[maybe_unused]] const auto& [maxBodies, maxJoints, maxFluids, maxFluidInteractions,
|
|
155
|
+
maxGeometryValues, maxContactCacheValues, maxForceValues, maxSupportRecords] = value;
|
|
156
|
+
}
|
|
157
|
+
inline void checkpointRecordSchemaGuard(const WorldSupportSpring& value) noexcept {
|
|
158
|
+
[[maybe_unused]] const auto& [body, support, bodyLocalPoint, supportLocalPoint,
|
|
159
|
+
supportLocalNormal, compression, travel, stiffness, damping] = value;
|
|
160
|
+
}
|
|
161
|
+
inline void checkpointRecordSchemaGuard(const WorldSupportForce& value) noexcept {
|
|
162
|
+
[[maybe_unused]] const auto& [body, support, force, bodyLocalPoint,
|
|
163
|
+
supportLocalPoint, supportReceivesReaction] = value;
|
|
164
|
+
}
|
|
165
|
+
inline void checkpointRecordSchemaGuard(const WorldContactEvent& value) noexcept {
|
|
166
|
+
[[maybe_unused]] const auto& [type, bodyA, bodyB, trigger, sensor, normalImpulse,
|
|
167
|
+
tangentImpulse1, tangentImpulse2, point, normal, penetration, closingSpeed] = value;
|
|
168
|
+
}
|
|
169
|
+
inline void checkpointRecordSchemaGuard(const WorldJointReaction& value) noexcept {
|
|
170
|
+
[[maybe_unused]] const auto& [joint, bodyA, bodyB, force, torque] = value;
|
|
171
|
+
}
|
|
172
|
+
inline void checkpointRecordSchemaGuard(const WorldJointBreakEvent& value) noexcept {
|
|
173
|
+
[[maybe_unused]] const auto& [joint, reasonBits] = value;
|
|
174
|
+
}
|
|
175
|
+
inline void checkpointRecordSchemaGuard(const WorldFluidInteraction& value) noexcept {
|
|
176
|
+
[[maybe_unused]] const auto& [body, fluid, submergedVolume, centerOfBuoyancy,
|
|
177
|
+
totalForce, totalTorque, relativeVelocity, shouldWake] = value;
|
|
178
|
+
}
|
|
179
|
+
inline void checkpointRecordSchemaGuard(const WorldTickSupports& value) noexcept {
|
|
180
|
+
[[maybe_unused]] const auto& [springs, forces] = value;
|
|
181
|
+
}
|
|
182
|
+
inline void checkpointRecordSchemaGuard(const WorldStatePayload& value) noexcept {
|
|
183
|
+
[[maybe_unused]] const auto& [joints, geometry, contactCache, forces, tickForces,
|
|
184
|
+
tickSupports, fluids, jointWarmState, topology, frame, surfaceVelocities,
|
|
185
|
+
contactEvents, jointReactions, jointBreakEvents, fluidInteractions, pose] = value;
|
|
186
|
+
}
|
|
187
|
+
inline void checkpointRecordSchemaGuard(const WorldOwnerToken& value) noexcept {
|
|
188
|
+
[[maybe_unused]] const auto& [id] = value;
|
|
189
|
+
}
|
|
190
|
+
inline void checkpointRecordSchemaGuard(const CheckpointProfile& value) noexcept {
|
|
191
|
+
[[maybe_unused]] const auto& [abiVersion, numericProfile, idLength, id, geometryDigest] = value;
|
|
192
|
+
}
|
|
193
|
+
inline void checkpointRecordSchemaGuard(const BodyTile& value) noexcept {
|
|
194
|
+
[[maybe_unused]] const auto& [memoState, logicalCount, physicalCount, memoLength, memo, values] = value;
|
|
195
|
+
}
|
|
196
|
+
inline void checkpointRecordSchemaGuard(const CheckpointBodyTable& value) noexcept {
|
|
197
|
+
[[maybe_unused]] const auto& [tileValues, valueCount, tiles, tileAllocationBytes,
|
|
198
|
+
selfAllocationBytes, totalAllocatedBytes] = value;
|
|
199
|
+
}
|
|
200
|
+
inline void checkpointRecordSchemaGuard(const BodyId& value) noexcept {
|
|
201
|
+
[[maybe_unused]] const auto& [id] = value;
|
|
202
|
+
}
|
|
203
|
+
inline void checkpointRecordSchemaGuard(const JointId& value) noexcept {
|
|
204
|
+
[[maybe_unused]] const auto& [id] = value;
|
|
205
|
+
}
|
|
206
|
+
inline void checkpointRecordSchemaGuard(const FluidId& value) noexcept {
|
|
207
|
+
[[maybe_unused]] const auto& [id] = value;
|
|
208
|
+
}
|
|
209
|
+
inline void checkpointRecordSchemaGuard(const JointIdentity& value) noexcept {
|
|
210
|
+
[[maybe_unused]] const auto& [id, bodyA, bodyB] = value;
|
|
211
|
+
}
|
|
212
|
+
inline void checkpointRecordSchemaGuard(const TopologyState& value) noexcept {
|
|
213
|
+
[[maybe_unused]] const auto& [nextBodyId, nextJointId, nextFluidId, bodyIds, joints, fluidIds] = value;
|
|
214
|
+
}
|
|
215
|
+
inline void checkpointRecordSchemaGuard(const JointWarmState3D& value) noexcept {
|
|
216
|
+
[[maybe_unused]] const auto& [jointId, signature, previousSubstepDuration,
|
|
217
|
+
rowFeatureKeys, accumulatedImpulse] = value;
|
|
218
|
+
}
|
|
219
|
+
inline void checkpointRecordSchemaGuard(const geometry_private::GeometryDescriptor& value) noexcept {
|
|
220
|
+
[[maybe_unused]] const auto& [kind, count, format, featureOffset] = value;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// A record field addition must fail compilation until its digest mapping is reviewed.
|
|
224
|
+
inline void checkpointDataSchemaGuard(const CheckpointData& data) noexcept {
|
|
225
|
+
const auto& [
|
|
226
|
+
world,
|
|
227
|
+
bodies,
|
|
228
|
+
geometryRoot,
|
|
229
|
+
pose,
|
|
230
|
+
profile,
|
|
231
|
+
totalAllocatedBytes,
|
|
232
|
+
frame,
|
|
233
|
+
nextBodyId,
|
|
234
|
+
nextJointId,
|
|
235
|
+
nextFluidId,
|
|
236
|
+
jointsOffset,
|
|
237
|
+
jointsCount,
|
|
238
|
+
legacyGeometryOffset,
|
|
239
|
+
legacyGeometryCount,
|
|
240
|
+
contactCacheOffset,
|
|
241
|
+
contactCacheCount,
|
|
242
|
+
forcesOffset,
|
|
243
|
+
forcesCount,
|
|
244
|
+
tickForcesOffset,
|
|
245
|
+
tickForcesCount,
|
|
246
|
+
supportSpringsOffset,
|
|
247
|
+
supportSpringsCount,
|
|
248
|
+
supportForcesOffset,
|
|
249
|
+
supportForcesCount,
|
|
250
|
+
fluidsOffset,
|
|
251
|
+
fluidsCount,
|
|
252
|
+
surfaceVelocitiesOffset,
|
|
253
|
+
surfaceVelocitiesCount,
|
|
254
|
+
jointWarmStateOffset,
|
|
255
|
+
jointWarmStateCount,
|
|
256
|
+
contactEventsOffset,
|
|
257
|
+
contactEventsCount,
|
|
258
|
+
jointReactionsOffset,
|
|
259
|
+
jointReactionsCount,
|
|
260
|
+
jointBreakEventsOffset,
|
|
261
|
+
jointBreakEventsCount,
|
|
262
|
+
fluidInteractionsOffset,
|
|
263
|
+
fluidInteractionsCount,
|
|
264
|
+
topologyBodyIdsOffset,
|
|
265
|
+
topologyBodyIdsCount,
|
|
266
|
+
topologyJointsOffset,
|
|
267
|
+
topologyJointsCount,
|
|
268
|
+
topologyFluidIdsOffset,
|
|
269
|
+
topologyFluidIdsCount,
|
|
270
|
+
bodyDefinitionSignaturesOffset,
|
|
271
|
+
bodyDefinitionSignaturesCount,
|
|
272
|
+
jointDefinitionSignaturesOffset,
|
|
273
|
+
jointDefinitionSignaturesCount,
|
|
274
|
+
geometryForm,
|
|
275
|
+
strongMemoState,
|
|
276
|
+
strongMemoLimits,
|
|
277
|
+
strongMemo
|
|
278
|
+
] = data;
|
|
279
|
+
static_cast<void>(world);
|
|
280
|
+
static_cast<void>(bodies);
|
|
281
|
+
static_cast<void>(geometryRoot);
|
|
282
|
+
static_cast<void>(pose);
|
|
283
|
+
static_cast<void>(profile);
|
|
284
|
+
static_cast<void>(totalAllocatedBytes);
|
|
285
|
+
static_cast<void>(frame);
|
|
286
|
+
static_cast<void>(nextBodyId);
|
|
287
|
+
static_cast<void>(nextJointId);
|
|
288
|
+
static_cast<void>(nextFluidId);
|
|
289
|
+
static_cast<void>(jointsOffset);
|
|
290
|
+
static_cast<void>(jointsCount);
|
|
291
|
+
static_cast<void>(legacyGeometryOffset);
|
|
292
|
+
static_cast<void>(legacyGeometryCount);
|
|
293
|
+
static_cast<void>(contactCacheOffset);
|
|
294
|
+
static_cast<void>(contactCacheCount);
|
|
295
|
+
static_cast<void>(forcesOffset);
|
|
296
|
+
static_cast<void>(forcesCount);
|
|
297
|
+
static_cast<void>(tickForcesOffset);
|
|
298
|
+
static_cast<void>(tickForcesCount);
|
|
299
|
+
static_cast<void>(supportSpringsOffset);
|
|
300
|
+
static_cast<void>(supportSpringsCount);
|
|
301
|
+
static_cast<void>(supportForcesOffset);
|
|
302
|
+
static_cast<void>(supportForcesCount);
|
|
303
|
+
static_cast<void>(fluidsOffset);
|
|
304
|
+
static_cast<void>(fluidsCount);
|
|
305
|
+
static_cast<void>(surfaceVelocitiesOffset);
|
|
306
|
+
static_cast<void>(surfaceVelocitiesCount);
|
|
307
|
+
static_cast<void>(jointWarmStateOffset);
|
|
308
|
+
static_cast<void>(jointWarmStateCount);
|
|
309
|
+
static_cast<void>(contactEventsOffset);
|
|
310
|
+
static_cast<void>(contactEventsCount);
|
|
311
|
+
static_cast<void>(jointReactionsOffset);
|
|
312
|
+
static_cast<void>(jointReactionsCount);
|
|
313
|
+
static_cast<void>(jointBreakEventsOffset);
|
|
314
|
+
static_cast<void>(jointBreakEventsCount);
|
|
315
|
+
static_cast<void>(fluidInteractionsOffset);
|
|
316
|
+
static_cast<void>(fluidInteractionsCount);
|
|
317
|
+
static_cast<void>(topologyBodyIdsOffset);
|
|
318
|
+
static_cast<void>(topologyBodyIdsCount);
|
|
319
|
+
static_cast<void>(topologyJointsOffset);
|
|
320
|
+
static_cast<void>(topologyJointsCount);
|
|
321
|
+
static_cast<void>(topologyFluidIdsOffset);
|
|
322
|
+
static_cast<void>(topologyFluidIdsCount);
|
|
323
|
+
static_cast<void>(bodyDefinitionSignaturesOffset);
|
|
324
|
+
static_cast<void>(bodyDefinitionSignaturesCount);
|
|
325
|
+
static_cast<void>(jointDefinitionSignaturesOffset);
|
|
326
|
+
static_cast<void>(jointDefinitionSignaturesCount);
|
|
327
|
+
static_cast<void>(geometryForm);
|
|
328
|
+
static_cast<void>(strongMemoState);
|
|
329
|
+
static_cast<void>(strongMemoLimits);
|
|
330
|
+
static_cast<void>(strongMemo);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
inline constexpr std::uint32_t checkpointTileValues(std::size_t bodyValues) noexcept {
|
|
334
|
+
const std::size_t stride =
|
|
335
|
+
(bodyValues % kBodyStrideWide == 0 && (bodyValues % kBodyStride != 0 || bodyValues == 0))
|
|
336
|
+
? kBodyStrideWide
|
|
337
|
+
: ((bodyValues % kBodyStride == 0) ? kBodyStride
|
|
338
|
+
: (bodyValues % kBodyStrideWide == 0 ? kBodyStrideWide : kBodyStride));
|
|
339
|
+
return static_cast<std::uint32_t>(kCheckpointBodyTileRows * stride);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
inline constexpr std::size_t checkpointTileLogicalLength(
|
|
343
|
+
std::uint64_t valueCount, std::uint32_t tileValues, std::size_t index) noexcept {
|
|
344
|
+
if (tileValues == 0) return 0;
|
|
345
|
+
const std::uint64_t offset = static_cast<std::uint64_t>(index) * tileValues;
|
|
346
|
+
if (valueCount <= offset) return 0;
|
|
347
|
+
const std::uint64_t remain = valueCount - offset;
|
|
348
|
+
return remain < tileValues ? static_cast<std::size_t>(remain) : static_cast<std::size_t>(tileValues);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
inline constexpr bool sameWorldLimits(const WorldLimits& left, const WorldLimits& right) noexcept {
|
|
352
|
+
return left.maxBodies == right.maxBodies
|
|
353
|
+
&& left.maxJoints == right.maxJoints
|
|
354
|
+
&& left.maxFluids == right.maxFluids
|
|
355
|
+
&& left.maxFluidInteractions == right.maxFluidInteractions
|
|
356
|
+
&& left.maxGeometryValues == right.maxGeometryValues
|
|
357
|
+
&& left.maxContactCacheValues == right.maxContactCacheValues
|
|
358
|
+
&& left.maxForceValues == right.maxForceValues
|
|
359
|
+
&& left.maxSupportRecords == right.maxSupportRecords;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
static_assert(sizeof(WorldLimits) == 48);
|
|
363
|
+
static_assert(offsetof(WorldLimits, maxBodies) == 0);
|
|
364
|
+
static_assert(offsetof(WorldLimits, maxGeometryValues) == 16);
|
|
365
|
+
static_assert(offsetof(WorldLimits, maxSupportRecords) == 40);
|
|
366
|
+
static_assert(sizeof(WorldSupportSpring) == 120);
|
|
367
|
+
static_assert(sizeof(WorldSupportForce) == 96);
|
|
368
|
+
static_assert(sizeof(WorldContactEvent) == 120);
|
|
369
|
+
static_assert(sizeof(WorldJointReaction) == 72);
|
|
370
|
+
static_assert(sizeof(WorldJointBreakEvent) == 16);
|
|
371
|
+
static_assert(sizeof(WorldFluidInteraction) == 128);
|
|
372
|
+
static_assert(sizeof(JointIdentity) == 24);
|
|
373
|
+
static_assert(sizeof(JointWarmState3D) == 160);
|
|
374
|
+
static_assert(sizeof(geometry_private::GeometryDescriptor) == 16);
|
|
375
|
+
static_assert(sizeof(BodyId) == 8);
|
|
376
|
+
static_assert(sizeof(JointId) == 8);
|
|
377
|
+
static_assert(sizeof(FluidId) == 8);
|
|
378
|
+
|
|
379
|
+
} // namespace rundot::kinetix::physics
|