@adobe/data-gpu 0.9.87 → 0.9.88
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/dist/graphics/rendering/bone-collider-plugin.d.ts +2724 -331
- package/dist/graphics/rendering/interpolation-plugin.d.ts +2532 -138
- package/dist/graphics/rendering/jolt-ragdoll-plugin.d.ts +2398 -5
- package/dist/graphics/rendering/model-collider-plugin.d.ts +2675 -282
- package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.d.ts +2396 -3
- package/dist/physics/physics-data-plugin.d.ts +2398 -2
- package/dist/physics/physics-data-plugin.js +26 -0
- package/dist/physics/physics-data-plugin.js.map +1 -1
- package/dist/physics/physics-hit.d.ts +18 -0
- package/dist/physics/physics-hit.js +3 -0
- package/dist/physics/physics-hit.js.map +1 -0
- package/dist/physics/physics-query.d.ts +43 -0
- package/dist/physics/physics-query.js +3 -0
- package/dist/physics/physics-query.js.map +1 -0
- package/dist/physics/public.d.ts +2 -0
- package/dist/physics/public.js +2 -0
- package/dist/physics/public.js.map +1 -1
- package/dist/physics/solvers/jolt-solver-plugin.d.ts +2394 -4
- package/dist/physics/solvers/jolt-solver-plugin.js +149 -0
- package/dist/physics/solvers/jolt-solver-plugin.js.map +1 -1
- package/dist/physics/solvers/mutable-hit.d.ts +14 -0
- package/dist/physics/solvers/mutable-hit.js +3 -0
- package/dist/physics/solvers/mutable-hit.js.map +1 -0
- package/dist/physics/solvers/orient-normal-against-ray.d.ts +11 -0
- package/dist/physics/solvers/orient-normal-against-ray.js +25 -0
- package/dist/physics/solvers/orient-normal-against-ray.js.map +1 -0
- package/dist/physics/solvers/orient-normal-against-ray.test.d.ts +1 -0
- package/dist/physics/solvers/orient-normal-against-ray.test.js +27 -0
- package/dist/physics/solvers/orient-normal-against-ray.test.js.map +1 -0
- package/dist/physics/solvers/pick-ray-conformance.test.d.ts +1 -0
- package/dist/physics/solvers/pick-ray-conformance.test.js +159 -0
- package/dist/physics/solvers/pick-ray-conformance.test.js.map +1 -0
- package/dist/physics/solvers/rapier-solver-plugin.d.ts +2394 -4
- package/dist/physics/solvers/rapier-solver-plugin.js +110 -1
- package/dist/physics/solvers/rapier-solver-plugin.js.map +1 -1
- package/package.json +2 -2
- package/src/physics/README.md +15 -2
- package/src/physics/physics-data-plugin.ts +29 -1
- package/src/physics/physics-hit.ts +21 -0
- package/src/physics/physics-query.ts +42 -0
- package/src/physics/public.ts +2 -0
- package/src/physics/solvers/jolt-solver-plugin.ts +119 -0
- package/src/physics/solvers/mutable-hit.ts +18 -0
- package/src/physics/solvers/orient-normal-against-ray.test.ts +31 -0
- package/src/physics/solvers/orient-normal-against-ray.ts +18 -0
- package/src/physics/solvers/pick-ray-conformance.test.ts +200 -0
- package/src/physics/solvers/rapier-solver-plugin.ts +92 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -36,6 +36,11 @@ import { STATIC_COLLIDER_COMPONENTS } from "./static-collider-components.js";
|
|
|
36
36
|
* body the first time it mirrors it, so authors never supply derived state.
|
|
37
37
|
*
|
|
38
38
|
* Mass + inertia are derived per solver from shape + material (not stored here).
|
|
39
|
+
*
|
|
40
|
+
* Besides the authored model, this seam declares the pluggable spatial-query
|
|
41
|
+
* contract every solver fulfils: a `physicsQuery` resource (the active solver
|
|
42
|
+
* publishes its engine-backed implementation once its world is live) and a
|
|
43
|
+
* `pickRay` action that delegates to it — so ray/line picking is solver-agnostic.
|
|
39
44
|
*/
|
|
40
45
|
export const physicsData = Database.Plugin.create({
|
|
41
46
|
extends: Material.plugin, // brings the `material` reference component
|
|
@@ -61,6 +66,13 @@ export const physicsData = Database.Plugin.create({
|
|
|
61
66
|
convexPoints: { default: null }, // colliderShape "hull": point cloud → convex hull
|
|
62
67
|
colliderMesh: { default: null }, // colliderShape "mesh": static triangle soup
|
|
63
68
|
},
|
|
69
|
+
resources: {
|
|
70
|
+
// The pluggable spatial-query seam: the active solver publishes its
|
|
71
|
+
// engine-backed implementation here once its world is live, so picking
|
|
72
|
+
// is solver-agnostic. Null before then (lazy WASM init) and when no
|
|
73
|
+
// solver is combined in. Runtime object → nonPersistent.
|
|
74
|
+
physicsQuery: { default: null, nonPersistent: true },
|
|
75
|
+
},
|
|
64
76
|
archetypes: {
|
|
65
77
|
RigidBody: [...RIGID_BODY_COMPONENTS],
|
|
66
78
|
StaticCollider: [...STATIC_COLLIDER_COMPONENTS],
|
|
@@ -69,5 +81,19 @@ export const physicsData = Database.Plugin.create({
|
|
|
69
81
|
// A static triangle-mesh collider (terrain / level geometry).
|
|
70
82
|
MeshCollider: [...STATIC_COLLIDER_COMPONENTS, "colliderMesh"],
|
|
71
83
|
},
|
|
84
|
+
actions: {
|
|
85
|
+
// Consumer surface for engine-backed picking. An action (not a
|
|
86
|
+
// transaction) because it returns a value; a pure delegate to whatever
|
|
87
|
+
// solver filled `physicsQuery` — `physicsData` itself holds no engine
|
|
88
|
+
// knowledge. Returns null until a solver's world is live.
|
|
89
|
+
pickRay(db, args) {
|
|
90
|
+
return db.resources.physicsQuery?.castRay(args.ray, { radius: args.radius }) ?? null;
|
|
91
|
+
},
|
|
92
|
+
// Visit every collider along the ray, nearest first (see PhysicsQuery.castRayEach).
|
|
93
|
+
// Returns void; no-op until a solver's world is live.
|
|
94
|
+
pickRayEach(db, args) {
|
|
95
|
+
db.resources.physicsQuery?.castRayEach(args.ray, args.visit, { radius: args.radius });
|
|
96
|
+
},
|
|
97
|
+
},
|
|
72
98
|
});
|
|
73
99
|
//# sourceMappingURL=physics-data-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physics-data-plugin.js","sourceRoot":"","sources":["../../src/physics/physics-data-plugin.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,IAAI,
|
|
1
|
+
{"version":3,"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obe/data/ecs";
|
|
2
|
+
import type { Vec3 } from "@adobe/data/math";
|
|
3
|
+
/**
|
|
4
|
+
* One physics ray-pick result — the body/collider the ray hit plus the
|
|
5
|
+
* geometry of the hit the engine's broadphase can give that an AABB scan
|
|
6
|
+
* cannot.
|
|
7
|
+
*
|
|
8
|
+
* `distance` uses the same parametric convention as the graphics `PickHit`
|
|
9
|
+
* (α ∈ [0,1] along the `Line3` segment, 0 = near point `a`, 1 = far point
|
|
10
|
+
* `b`), so `PhysicsHit` is a structural superset of `PickHit` and `distance`
|
|
11
|
+
* reads the same in both picking systems. The absolute hit location is `point`.
|
|
12
|
+
*/
|
|
13
|
+
export interface PhysicsHit {
|
|
14
|
+
readonly entity: Entity;
|
|
15
|
+
readonly distance: number;
|
|
16
|
+
readonly point: Vec3;
|
|
17
|
+
readonly normal: Vec3;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physics-hit.js","sourceRoot":"","sources":["../../src/physics/physics-hit.ts"],"names":[],"mappings":"AAAA,uDAAuD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Line3 } from "@adobe/data/math";
|
|
2
|
+
import type { PhysicsHit } from "./physics-hit.js";
|
|
3
|
+
/**
|
|
4
|
+
* The solver-agnostic spatial-query capability — the pluggable seam for
|
|
5
|
+
* engine-backed picking. Whichever solver is active (`rapierSolver`,
|
|
6
|
+
* `joltSolver`, …) publishes an implementation of this interface into the
|
|
7
|
+
* `physicsQuery` resource once its world is live; consumers reach it through
|
|
8
|
+
* the `pickRay` action (or read the resource directly for advanced use).
|
|
9
|
+
*
|
|
10
|
+
* `castRay` returns the nearest collider along the `Line3` segment, or `null`
|
|
11
|
+
* for a miss. `castRayEach` visits *every* collider along the segment, nearest
|
|
12
|
+
* first. `radius` (omitted / 0 → an infinitely-thin ray; > 0 → a sphere of that
|
|
13
|
+
* radius swept along the segment) covers "pick along a line with or without
|
|
14
|
+
* radius" behind one call. Both reference solvers back these with their native
|
|
15
|
+
* ray / shape cast (Rapier `castRayAndGetNormal` / `castShape` /
|
|
16
|
+
* `intersectionsWithRay`; Jolt `NarrowPhaseQuery.CastRay` / `CastShape` with
|
|
17
|
+
* all-hit collectors).
|
|
18
|
+
*/
|
|
19
|
+
export interface PhysicsQuery {
|
|
20
|
+
castRay(ray: Line3, options?: {
|
|
21
|
+
radius?: number;
|
|
22
|
+
}): PhysicsHit | null;
|
|
23
|
+
/**
|
|
24
|
+
* Visit each collider crossed by the segment, **nearest first**, calling
|
|
25
|
+
* `visit` once per crossing. Return `false` from `visit` to stop early (any
|
|
26
|
+
* other return continues).
|
|
27
|
+
*
|
|
28
|
+
* Zero-allocation: `visit` receives a **single reused hit** that is valid
|
|
29
|
+
* only for the duration of that call — read what you need (or copy fields
|
|
30
|
+
* out); do not retain the object or its `point` / `normal` arrays past the
|
|
31
|
+
* callback. (`castRay` returns a fresh, retainable hit; use it when you need
|
|
32
|
+
* to keep one.)
|
|
33
|
+
*
|
|
34
|
+
* `radius > 0` sweeps a sphere: fully supported on solvers with a native
|
|
35
|
+
* swept-shape all-hits query (Jolt); where the engine binding lacks one
|
|
36
|
+
* (the Rapier compat binding), a radius query degrades to visiting only the
|
|
37
|
+
* nearest hit. A thin ray (`radius` omitted / 0) visits all crossings on
|
|
38
|
+
* every solver.
|
|
39
|
+
*/
|
|
40
|
+
castRayEach(ray: Line3, visit: (hit: PhysicsHit) => boolean | void, options?: {
|
|
41
|
+
radius?: number;
|
|
42
|
+
}): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physics-query.js","sourceRoot":"","sources":["../../src/physics/physics-query.ts"],"names":[],"mappings":"AAAA,uDAAuD"}
|
package/dist/physics/public.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from "./physics-data-plugin.js";
|
|
2
|
+
export * from "./physics-hit.js";
|
|
3
|
+
export * from "./physics-query.js";
|
|
2
4
|
export * from "./rigid-body-components.js";
|
|
3
5
|
export * from "./static-collider-components.js";
|
|
4
6
|
export * from "./collider-primitive-render-archetypes.js";
|
package/dist/physics/public.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
2
|
export * from "./physics-data-plugin.js";
|
|
3
|
+
export * from "./physics-hit.js";
|
|
4
|
+
export * from "./physics-query.js";
|
|
3
5
|
export * from "./rigid-body-components.js";
|
|
4
6
|
export * from "./static-collider-components.js";
|
|
5
7
|
export * from "./collider-primitive-render-archetypes.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../src/physics/public.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../src/physics/public.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAA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