@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,405 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <algorithm>
|
|
4
|
+
#include <array>
|
|
5
|
+
#include <cmath>
|
|
6
|
+
#include <cstdint>
|
|
7
|
+
#include <span>
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
#include "physics.hpp"
|
|
11
|
+
|
|
12
|
+
namespace rundot::kinetix::physics {
|
|
13
|
+
|
|
14
|
+
constexpr std::uint32_t kLagCompensationAbiVersion = 1;
|
|
15
|
+
constexpr std::uint32_t kLagCompensationBodyStride = 48;
|
|
16
|
+
constexpr std::uint32_t kLagCompensationHeaderStride = 8;
|
|
17
|
+
constexpr std::uint32_t kLagCompensationQueryStride = 24;
|
|
18
|
+
constexpr std::uint32_t kLagCompensationResultStride = 12;
|
|
19
|
+
constexpr std::uint32_t kLagCompensationMaxFrames = 128;
|
|
20
|
+
constexpr std::uint32_t kLagCompensationMaxBodies = 256;
|
|
21
|
+
constexpr std::uint32_t kLagCompensationMaxResults = 64;
|
|
22
|
+
|
|
23
|
+
enum class LagCompStatus : std::int32_t {
|
|
24
|
+
Success = 0,
|
|
25
|
+
InvalidTick = -1,
|
|
26
|
+
TickOutOfRange = -2,
|
|
27
|
+
BodyNotFound = -3,
|
|
28
|
+
BufferOverflow = -4,
|
|
29
|
+
InvalidInput = -5,
|
|
30
|
+
NoHit = -6,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
struct LagCompVec3 {
|
|
34
|
+
double x = 0.0;
|
|
35
|
+
double y = 0.0;
|
|
36
|
+
double z = 0.0;
|
|
37
|
+
constexpr bool operator==(const LagCompVec3& o) const = default;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
struct LagCompQuat {
|
|
41
|
+
double x = 0.0;
|
|
42
|
+
double y = 0.0;
|
|
43
|
+
double z = 0.0;
|
|
44
|
+
double w = 1.0;
|
|
45
|
+
constexpr bool operator==(const LagCompQuat& o) const = default;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
struct LagCompAABB {
|
|
49
|
+
double minX = 0.0;
|
|
50
|
+
double minY = 0.0;
|
|
51
|
+
double minZ = 0.0;
|
|
52
|
+
double maxX = 0.0;
|
|
53
|
+
double maxY = 0.0;
|
|
54
|
+
double maxZ = 0.0;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
struct LagCompBodySnapshot {
|
|
58
|
+
std::uint64_t bodyId = 0;
|
|
59
|
+
bool active = false;
|
|
60
|
+
std::uint32_t layer = 1;
|
|
61
|
+
std::uint32_t mask = 1;
|
|
62
|
+
std::uint32_t motionType = 1;
|
|
63
|
+
ShapeKind shape = ShapeKind::Box;
|
|
64
|
+
LagCompVec3 position{};
|
|
65
|
+
LagCompQuat orientation{};
|
|
66
|
+
LagCompVec3 linearVelocity{};
|
|
67
|
+
LagCompVec3 angularVelocity{};
|
|
68
|
+
LagCompVec3 shapeDimensions{}; // shape0, shape1, shape2
|
|
69
|
+
LagCompVec3 shapeOffset{}; // shapeOffsetX, shapeOffsetY, shapeOffsetZ
|
|
70
|
+
std::uint32_t geometryOffset = 0;
|
|
71
|
+
std::uint32_t geometryCount = 0;
|
|
72
|
+
std::uint32_t geometryGeneration = 0;
|
|
73
|
+
LagCompAABB aabb{};
|
|
74
|
+
std::array<double, kLagCompensationBodyStride> rawData{};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
struct LagCompFrameSnapshot {
|
|
78
|
+
std::uint64_t tick = 0;
|
|
79
|
+
double timestamp = 0.0;
|
|
80
|
+
std::uint32_t bodyCount = 0;
|
|
81
|
+
std::uint32_t geometryGeneration = 0;
|
|
82
|
+
std::uint32_t topologyGeneration = 0;
|
|
83
|
+
bool valid = false;
|
|
84
|
+
std::array<LagCompBodySnapshot, kLagCompensationMaxBodies> bodies{};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
struct LagCompRaycastQuery {
|
|
88
|
+
LagCompVec3 origin{};
|
|
89
|
+
LagCompVec3 direction{};
|
|
90
|
+
double maxDistance = 1000.0;
|
|
91
|
+
std::uint32_t layerMask = 0xffffffff;
|
|
92
|
+
std::uint32_t flags = 0b1000u;
|
|
93
|
+
std::uint64_t excludedBodyId = 0;
|
|
94
|
+
std::int32_t excludedBodyIndex = -1;
|
|
95
|
+
std::uint64_t historicalTick = 0;
|
|
96
|
+
double subTickAlpha = 0.0;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
struct LagCompQueryResult {
|
|
100
|
+
bool hit = false;
|
|
101
|
+
double distance = 0.0;
|
|
102
|
+
LagCompVec3 point{};
|
|
103
|
+
LagCompVec3 normal{};
|
|
104
|
+
std::uint32_t bodyIndex = 0;
|
|
105
|
+
std::uint64_t bodyId = 0;
|
|
106
|
+
std::uint32_t geometryGeneration = 0;
|
|
107
|
+
ShapeKind shapeKind = ShapeKind::Box;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
struct LagCompOverlapQuery {
|
|
111
|
+
ShapeKind shape = ShapeKind::Sphere;
|
|
112
|
+
LagCompVec3 shapeDims{1.0, 1.0, 1.0};
|
|
113
|
+
LagCompVec3 origin{};
|
|
114
|
+
LagCompQuat orientation{};
|
|
115
|
+
std::uint32_t layerMask = 0xffffffff;
|
|
116
|
+
std::uint32_t flags = 0b1000u;
|
|
117
|
+
std::uint64_t excludedBodyId = 0;
|
|
118
|
+
std::uint64_t historicalTick = 0;
|
|
119
|
+
double subTickAlpha = 0.0;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
struct LagCompShapecastQuery {
|
|
123
|
+
ShapeKind shape = ShapeKind::Sphere;
|
|
124
|
+
LagCompVec3 shapeDims{0.5, 0.5, 0.5};
|
|
125
|
+
LagCompVec3 origin{};
|
|
126
|
+
LagCompVec3 direction{};
|
|
127
|
+
double maxDistance = 1000.0;
|
|
128
|
+
LagCompQuat orientation{};
|
|
129
|
+
std::uint32_t layerMask = 0xffffffff;
|
|
130
|
+
std::uint32_t flags = 0b1000u;
|
|
131
|
+
std::uint64_t excludedBodyId = 0;
|
|
132
|
+
std::uint64_t historicalTick = 0;
|
|
133
|
+
double subTickAlpha = 0.0;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Pure deterministic math utilities (double only)
|
|
137
|
+
double detSqrt(double v) noexcept;
|
|
138
|
+
LagCompVec3 vec3Add(const LagCompVec3& a, const LagCompVec3& b) noexcept;
|
|
139
|
+
LagCompVec3 vec3Sub(const LagCompVec3& a, const LagCompVec3& b) noexcept;
|
|
140
|
+
LagCompVec3 vec3Scale(const LagCompVec3& v, double s) noexcept;
|
|
141
|
+
double vec3Dot(const LagCompVec3& a, const LagCompVec3& b) noexcept;
|
|
142
|
+
LagCompVec3 vec3Cross(const LagCompVec3& a, const LagCompVec3& b) noexcept;
|
|
143
|
+
double vec3LengthSq(const LagCompVec3& v) noexcept;
|
|
144
|
+
double vec3Length(const LagCompVec3& v) noexcept;
|
|
145
|
+
LagCompVec3 vec3Normalize(const LagCompVec3& v) noexcept;
|
|
146
|
+
|
|
147
|
+
LagCompQuat quatIdentity() noexcept;
|
|
148
|
+
LagCompQuat quatConjugate(const LagCompQuat& q) noexcept;
|
|
149
|
+
double quatDot(const LagCompQuat& a, const LagCompQuat& b) noexcept;
|
|
150
|
+
LagCompQuat quatNormalize(const LagCompQuat& q) noexcept;
|
|
151
|
+
LagCompQuat quatMultiply(const LagCompQuat& a, const LagCompQuat& b) noexcept;
|
|
152
|
+
LagCompVec3 rotateVec3(const LagCompQuat& q, const LagCompVec3& v) noexcept;
|
|
153
|
+
LagCompVec3 invRotateVec3(const LagCompQuat& q, const LagCompVec3& v) noexcept;
|
|
154
|
+
LagCompQuat quatSlerp(const LagCompQuat& q1, const LagCompQuat& q2In, double t) noexcept;
|
|
155
|
+
|
|
156
|
+
LagCompAABB computeBodyAABB(
|
|
157
|
+
const LagCompVec3& pos,
|
|
158
|
+
const LagCompQuat& rot,
|
|
159
|
+
ShapeKind shape,
|
|
160
|
+
const LagCompVec3& dims,
|
|
161
|
+
const LagCompVec3& offset) noexcept;
|
|
162
|
+
|
|
163
|
+
class LagCompensationBuffer {
|
|
164
|
+
public:
|
|
165
|
+
explicit LagCompensationBuffer(
|
|
166
|
+
std::uint32_t maxFrames = kLagCompensationMaxFrames,
|
|
167
|
+
std::uint32_t maxBodies = kLagCompensationMaxBodies);
|
|
168
|
+
~LagCompensationBuffer() = default;
|
|
169
|
+
|
|
170
|
+
LagCompensationBuffer(const LagCompensationBuffer&) = delete;
|
|
171
|
+
LagCompensationBuffer& operator=(const LagCompensationBuffer&) = delete;
|
|
172
|
+
LagCompensationBuffer(LagCompensationBuffer&&) noexcept = default;
|
|
173
|
+
LagCompensationBuffer& operator=(LagCompensationBuffer&&) noexcept = default;
|
|
174
|
+
|
|
175
|
+
void clear() noexcept;
|
|
176
|
+
|
|
177
|
+
LagCompStatus recordSnapshot(
|
|
178
|
+
std::uint64_t tick,
|
|
179
|
+
double timestamp,
|
|
180
|
+
const double* bodyData,
|
|
181
|
+
std::uint32_t bodyCount,
|
|
182
|
+
const std::uint64_t* bodyIds = nullptr,
|
|
183
|
+
std::uint32_t globalGeometryGen = 0,
|
|
184
|
+
const std::uint32_t* perBodyGeometryGen = nullptr) noexcept;
|
|
185
|
+
|
|
186
|
+
bool hasTick(std::uint64_t tick) const noexcept;
|
|
187
|
+
std::uint64_t oldestTick() const noexcept;
|
|
188
|
+
std::uint64_t newestTick() const noexcept;
|
|
189
|
+
std::uint32_t frameCount() const noexcept;
|
|
190
|
+
std::uint32_t maxFrames() const noexcept { return maxFrames_; }
|
|
191
|
+
std::uint32_t maxBodies() const noexcept { return maxBodies_; }
|
|
192
|
+
|
|
193
|
+
LagCompStatus findTicksForTime(
|
|
194
|
+
double timestamp,
|
|
195
|
+
std::uint64_t& outTickA,
|
|
196
|
+
std::uint64_t& outTickB,
|
|
197
|
+
double& outAlpha) const noexcept;
|
|
198
|
+
|
|
199
|
+
LagCompStatus queryHistoricalTopology(
|
|
200
|
+
std::uint64_t tick,
|
|
201
|
+
std::uint32_t& outBodyCount,
|
|
202
|
+
std::span<std::uint64_t> outBodyIds) const noexcept;
|
|
203
|
+
|
|
204
|
+
LagCompStatus queryHistoricalBody(
|
|
205
|
+
std::uint64_t tick,
|
|
206
|
+
std::uint64_t bodyId,
|
|
207
|
+
LagCompBodySnapshot& outBody) const noexcept;
|
|
208
|
+
|
|
209
|
+
LagCompStatus queryHistoricalBodyByIndex(
|
|
210
|
+
std::uint64_t tick,
|
|
211
|
+
std::uint32_t bodyIndex,
|
|
212
|
+
LagCompBodySnapshot& outBody) const noexcept;
|
|
213
|
+
|
|
214
|
+
LagCompStatus queryHistoricalColliderFilter(
|
|
215
|
+
std::uint64_t tick,
|
|
216
|
+
std::uint64_t bodyId,
|
|
217
|
+
std::uint32_t& outLayer,
|
|
218
|
+
std::uint32_t& outMask,
|
|
219
|
+
std::uint32_t& outMotionType) const noexcept;
|
|
220
|
+
|
|
221
|
+
LagCompStatus queryHistoricalGeometry(
|
|
222
|
+
std::uint64_t tick,
|
|
223
|
+
std::uint64_t bodyId,
|
|
224
|
+
ShapeKind& outShapeKind,
|
|
225
|
+
LagCompVec3& outShapeDims,
|
|
226
|
+
LagCompVec3& outShapeOffset,
|
|
227
|
+
std::uint32_t& outGeometryOffset,
|
|
228
|
+
std::uint32_t& outGeometryCount,
|
|
229
|
+
std::uint32_t& outGeometryGeneration) const noexcept;
|
|
230
|
+
|
|
231
|
+
LagCompStatus queryHistoricalPose(
|
|
232
|
+
std::uint64_t tick,
|
|
233
|
+
std::uint64_t bodyId,
|
|
234
|
+
LagCompVec3& outPosition,
|
|
235
|
+
LagCompQuat& outOrientation,
|
|
236
|
+
LagCompVec3& outLinearVel,
|
|
237
|
+
LagCompVec3& outAngularVel) const noexcept;
|
|
238
|
+
|
|
239
|
+
LagCompStatus queryInterpolatedPose(
|
|
240
|
+
std::uint64_t tickA,
|
|
241
|
+
std::uint64_t tickB,
|
|
242
|
+
double alpha,
|
|
243
|
+
std::uint64_t bodyId,
|
|
244
|
+
LagCompVec3& outPosition,
|
|
245
|
+
LagCompQuat& outOrientation) const noexcept;
|
|
246
|
+
|
|
247
|
+
LagCompStatus rewindScene(
|
|
248
|
+
std::uint64_t tick,
|
|
249
|
+
double* outBodyDataSoA,
|
|
250
|
+
std::uint32_t maxBodies,
|
|
251
|
+
std::uint32_t& outBodyCount) const noexcept;
|
|
252
|
+
|
|
253
|
+
LagCompStatus rewindSceneInterpolated(
|
|
254
|
+
std::uint64_t tickA,
|
|
255
|
+
std::uint64_t tickB,
|
|
256
|
+
double alpha,
|
|
257
|
+
double* outBodyDataSoA,
|
|
258
|
+
std::uint32_t maxBodies,
|
|
259
|
+
std::uint32_t& outBodyCount) const noexcept;
|
|
260
|
+
|
|
261
|
+
LagCompStatus raycast(
|
|
262
|
+
const LagCompRaycastQuery& query,
|
|
263
|
+
std::span<LagCompQueryResult> outResults,
|
|
264
|
+
std::uint32_t& outResultCount) const noexcept;
|
|
265
|
+
|
|
266
|
+
LagCompStatus overlap(
|
|
267
|
+
const LagCompOverlapQuery& query,
|
|
268
|
+
std::span<LagCompQueryResult> outResults,
|
|
269
|
+
std::uint32_t& outResultCount) const noexcept;
|
|
270
|
+
|
|
271
|
+
LagCompStatus shapecast(
|
|
272
|
+
const LagCompShapecastQuery& query,
|
|
273
|
+
std::span<LagCompQueryResult> outResults,
|
|
274
|
+
std::uint32_t& outResultCount) const noexcept;
|
|
275
|
+
|
|
276
|
+
private:
|
|
277
|
+
const LagCompFrameSnapshot* findFrame(std::uint64_t tick) const noexcept;
|
|
278
|
+
LagCompFrameSnapshot* findFrameMut(std::uint64_t tick) noexcept;
|
|
279
|
+
void interpolateBody(
|
|
280
|
+
const LagCompBodySnapshot& bodyA,
|
|
281
|
+
const LagCompBodySnapshot& bodyB,
|
|
282
|
+
double alpha,
|
|
283
|
+
LagCompBodySnapshot& outBody) const noexcept;
|
|
284
|
+
|
|
285
|
+
std::uint32_t maxFrames_ = kLagCompensationMaxFrames;
|
|
286
|
+
std::uint32_t maxBodies_ = kLagCompensationMaxBodies;
|
|
287
|
+
std::vector<LagCompFrameSnapshot> frames_;
|
|
288
|
+
std::uint32_t frameCount_ = 0;
|
|
289
|
+
std::uint32_t headIndex_ = 0;
|
|
290
|
+
std::uint64_t oldestTick_ = 0;
|
|
291
|
+
std::uint64_t newestTick_ = 0;
|
|
292
|
+
std::uint32_t globalTopologyGen_ = 0;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// C-compatible ABI exports for WASM / extended ABI integration
|
|
296
|
+
extern "C" {
|
|
297
|
+
std::uint32_t rundot_kinetix_ext_k09_abi_version();
|
|
298
|
+
std::uint32_t rundot_kinetix_ext_k09_body_stride();
|
|
299
|
+
std::uint32_t rundot_kinetix_ext_k09_header_stride();
|
|
300
|
+
std::uint32_t rundot_kinetix_ext_k09_query_stride();
|
|
301
|
+
std::uint32_t rundot_kinetix_ext_k09_result_stride();
|
|
302
|
+
std::uint32_t rundot_kinetix_ext_k09_max_frames();
|
|
303
|
+
std::uint32_t rundot_kinetix_ext_k09_max_bodies();
|
|
304
|
+
std::uint32_t rundot_kinetix_ext_k09_max_results();
|
|
305
|
+
std::uint32_t rundot_kinetix_ext_lag_compensation_stride();
|
|
306
|
+
std::uint32_t rundot_kinetix_ext_lag_compensation_size();
|
|
307
|
+
|
|
308
|
+
std::int32_t rundot_kinetix_ext_k09_reset();
|
|
309
|
+
|
|
310
|
+
std::int32_t rundot_kinetix_ext_k09_record_frame(
|
|
311
|
+
std::uint64_t tick,
|
|
312
|
+
double timestamp,
|
|
313
|
+
const double* bodyData,
|
|
314
|
+
std::uint32_t bodyCount,
|
|
315
|
+
const std::uint64_t* bodyIds,
|
|
316
|
+
std::uint32_t globalGeomGen);
|
|
317
|
+
|
|
318
|
+
std::int32_t rundot_kinetix_ext_k09_has_tick(std::uint64_t tick);
|
|
319
|
+
std::uint64_t rundot_kinetix_ext_k09_oldest_tick();
|
|
320
|
+
std::uint64_t rundot_kinetix_ext_k09_newest_tick();
|
|
321
|
+
std::uint32_t rundot_kinetix_ext_k09_frame_count();
|
|
322
|
+
|
|
323
|
+
std::int32_t rundot_kinetix_ext_k09_query_topology(
|
|
324
|
+
std::uint64_t tick,
|
|
325
|
+
std::uint32_t* outBodyCount,
|
|
326
|
+
std::uint64_t* outBodyIds,
|
|
327
|
+
std::uint32_t maxIds);
|
|
328
|
+
|
|
329
|
+
std::int32_t rundot_kinetix_ext_k09_query_body(
|
|
330
|
+
std::uint64_t tick,
|
|
331
|
+
std::uint64_t bodyId,
|
|
332
|
+
double* outBodyRecord48);
|
|
333
|
+
|
|
334
|
+
std::int32_t rundot_kinetix_ext_k09_query_body_by_index(
|
|
335
|
+
std::uint64_t tick,
|
|
336
|
+
std::uint32_t bodyIndex,
|
|
337
|
+
double* outBodyRecord48);
|
|
338
|
+
|
|
339
|
+
std::int32_t rundot_kinetix_ext_k09_query_filter(
|
|
340
|
+
std::uint64_t tick,
|
|
341
|
+
std::uint64_t bodyId,
|
|
342
|
+
std::uint32_t* outLayer,
|
|
343
|
+
std::uint32_t* outMask,
|
|
344
|
+
std::uint32_t* outMotionType);
|
|
345
|
+
|
|
346
|
+
std::int32_t rundot_kinetix_ext_k09_query_geometry(
|
|
347
|
+
std::uint64_t tick,
|
|
348
|
+
std::uint64_t bodyId,
|
|
349
|
+
std::uint32_t* outShapeKind,
|
|
350
|
+
double* outShapeDims3,
|
|
351
|
+
double* outShapeOffset3,
|
|
352
|
+
std::uint32_t* outGeomOffset,
|
|
353
|
+
std::uint32_t* outGeomCount,
|
|
354
|
+
std::uint32_t* outGeomGen);
|
|
355
|
+
|
|
356
|
+
std::int32_t rundot_kinetix_ext_k09_query_pose(
|
|
357
|
+
std::uint64_t tick,
|
|
358
|
+
std::uint64_t bodyId,
|
|
359
|
+
double* outPosition3,
|
|
360
|
+
double* outOrientation4,
|
|
361
|
+
double* outLinearVel3,
|
|
362
|
+
double* outAngularVel3);
|
|
363
|
+
|
|
364
|
+
std::int32_t rundot_kinetix_ext_k09_query_interpolated_pose(
|
|
365
|
+
std::uint64_t tickA,
|
|
366
|
+
std::uint64_t tickB,
|
|
367
|
+
double alpha,
|
|
368
|
+
std::uint64_t bodyId,
|
|
369
|
+
double* outPosition3,
|
|
370
|
+
double* outOrientation4);
|
|
371
|
+
|
|
372
|
+
std::int32_t rundot_kinetix_ext_k09_rewind_scene(
|
|
373
|
+
std::uint64_t tick,
|
|
374
|
+
double* outBodyData44,
|
|
375
|
+
std::uint32_t maxBodies,
|
|
376
|
+
std::uint32_t* outBodyCount);
|
|
377
|
+
|
|
378
|
+
std::int32_t rundot_kinetix_ext_k09_rewind_scene_interpolated(
|
|
379
|
+
std::uint64_t tickA,
|
|
380
|
+
std::uint64_t tickB,
|
|
381
|
+
double alpha,
|
|
382
|
+
double* outBodyData44,
|
|
383
|
+
std::uint32_t maxBodies,
|
|
384
|
+
std::uint32_t* outBodyCount);
|
|
385
|
+
|
|
386
|
+
std::int32_t rundot_kinetix_ext_k09_raycast(
|
|
387
|
+
const double* queryData24,
|
|
388
|
+
double* outResultData12,
|
|
389
|
+
std::uint32_t maxResults,
|
|
390
|
+
std::uint32_t* outResultCount);
|
|
391
|
+
|
|
392
|
+
std::int32_t rundot_kinetix_ext_k09_overlap(
|
|
393
|
+
const double* queryData24,
|
|
394
|
+
double* outResultData12,
|
|
395
|
+
std::uint32_t maxResults,
|
|
396
|
+
std::uint32_t* outResultCount);
|
|
397
|
+
|
|
398
|
+
std::int32_t rundot_kinetix_ext_k09_shapecast(
|
|
399
|
+
const double* queryData24,
|
|
400
|
+
double* outResultData12,
|
|
401
|
+
std::uint32_t maxResults,
|
|
402
|
+
std::uint32_t* outResultCount);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
} // namespace rundot::kinetix::physics
|