@adobe/data-gpu 0.10.20 → 0.10.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.
Files changed (39) hide show
  1. package/dist/core/core-plugin.d.ts +1 -1
  2. package/dist/graphics/animation/animation-data-plugin.d.ts +2 -2
  3. package/dist/graphics/animation/animation-plugin.d.ts +5 -5
  4. package/dist/graphics/camera/camera-plugin.d.ts +2 -2
  5. package/dist/graphics/camera/orbit/orbit-data-plugin.d.ts +5 -5
  6. package/dist/graphics/camera/orbit/orbit-plugin.d.ts +5 -5
  7. package/dist/graphics/camera/orbit/orbit-system-plugin.d.ts +5 -5
  8. package/dist/graphics/graphics-plugin.d.ts +2 -2
  9. package/dist/graphics/picking/picking-plugin.d.ts +783 -783
  10. package/dist/graphics/rendering/bone-collider-plugin.d.ts +224 -224
  11. package/dist/graphics/rendering/ibl-render/ibl-render-plugin.d.ts +158 -158
  12. package/dist/graphics/rendering/interpolation-plugin.d.ts +23 -23
  13. package/dist/graphics/rendering/jolt-ragdoll-plugin.d.ts +225 -225
  14. package/dist/graphics/rendering/material-palette-gpu/material-palette-gpu-plugin.d.ts +12 -12
  15. package/dist/graphics/rendering/model-collider-plugin.d.ts +172 -172
  16. package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.d.ts +167 -158
  17. package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.js +61 -1
  18. package/dist/graphics/rendering/pbr-render/pbr-factor-render-plugin.js.map +1 -1
  19. package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.d.ts +15 -15
  20. package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.js +11 -14
  21. package/dist/graphics/rendering/pbr-render/physics-bridge-plugin.js.map +1 -1
  22. package/dist/graphics/rendering/ragdoll-trigger-plugin.d.ts +1 -1
  23. package/dist/graphics/rendering/skinning/skinning-plugin.d.ts +181 -181
  24. package/dist/graphics/scene/light/light-plugin.d.ts +1 -1
  25. package/dist/graphics/scene/model/mesh-plugin.d.ts +18 -18
  26. package/dist/graphics/scene/model/model-loader-plugin.d.ts +162 -162
  27. package/dist/graphics/scene/model/shape/shape-geometry-plugin.d.ts +74 -74
  28. package/dist/graphics/scene/model/world-bounds-plugin.d.ts +162 -162
  29. package/dist/graphics/scene/scene-plugin.d.ts +26 -26
  30. package/dist/graphics/scene/scene-uniforms/scene-uniforms-plugin.d.ts +14 -14
  31. package/dist/material/material-plugin.d.ts +5 -5
  32. package/dist/physics/physics-clock-plugin.d.ts +2 -2
  33. package/dist/physics/physics-data-plugin.d.ts +15 -15
  34. package/dist/physics/solvers/jolt-solver-plugin.d.ts +17 -17
  35. package/dist/physics/solvers/rapier-solver-plugin.d.ts +17 -17
  36. package/package.json +2 -2
  37. package/src/graphics/rendering/pbr-render/pbr-factor-render-plugin.ts +74 -0
  38. package/src/graphics/rendering/pbr-render/physics-bridge-plugin.ts +12 -15
  39. package/tsconfig.tsbuildinfo +1 -1
@@ -577,7 +577,7 @@ export declare const rapierSolver: {
577
577
  readonly unique: true;
578
578
  readonly archetype: "Material";
579
579
  };
580
- }, never>, row: import("../../material/public.js")) => Entity;
580
+ }, never, never>, row: import("../../material/public.js")) => Entity;
581
581
  readonly insertMaterialDefinition: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
582
582
  readonly material: {
583
583
  readonly entity: true;
@@ -756,7 +756,7 @@ export declare const rapierSolver: {
756
756
  readonly unique: true;
757
757
  readonly archetype: "Material";
758
758
  };
759
- }, never>, args: {
759
+ }, never, never>, args: {
760
760
  name: string;
761
761
  definition: import("../../material/material-definition.js").MaterialDefinition;
762
762
  }) => Entity;
@@ -938,7 +938,7 @@ export declare const rapierSolver: {
938
938
  readonly unique: true;
939
939
  readonly archetype: "Material";
940
940
  };
941
- }, never>, defs: Readonly<Record<string, import("../../material/material-definition.js").MaterialDefinition>>) => void;
941
+ }, never, never>, defs: Readonly<Record<string, import("../../material/material-definition.js").MaterialDefinition>>) => void;
942
942
  readonly seedStandardMaterials: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
943
943
  readonly material: {
944
944
  readonly entity: true;
@@ -1117,7 +1117,7 @@ export declare const rapierSolver: {
1117
1117
  readonly unique: true;
1118
1118
  readonly archetype: "Material";
1119
1119
  };
1120
- }, never>) => void;
1120
+ }, never, never>) => void;
1121
1121
  readonly seedDefinitionMaterials: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
1122
1122
  readonly material: {
1123
1123
  readonly entity: true;
@@ -1296,7 +1296,7 @@ export declare const rapierSolver: {
1296
1296
  readonly unique: true;
1297
1297
  readonly archetype: "Material";
1298
1298
  };
1299
- }, never>) => void;
1299
+ }, never, never>) => void;
1300
1300
  } & {} & {} & {} & {
1301
1301
  readonly setFixedTimestep: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{}>, import("@adobe/data/schema").FromSchemas<{
1302
1302
  readonly physicsClock: {
@@ -1321,9 +1321,9 @@ export declare const rapierSolver: {
1321
1321
  readonly default: GPUCommandEncoder | null;
1322
1322
  readonly nonPersistent: true;
1323
1323
  };
1324
- }>, {}, {}, never>, hz: number) => void;
1324
+ }>, {}, {}, never, never>, hz: number) => void;
1325
1325
  } & {} & {};
1326
- readonly systems: import("@adobe/data/ecs").SystemDeclarations<"_frameTime" | "update" | "schedulerSystem" | "input" | "preUpdate" | "postUpdate" | "physics" | "preRender" | "render" | "postRender" | "advancePhysicsClock" | "rapierStep">;
1326
+ readonly systems: import("@adobe/data/ecs").SystemDeclarations<"update" | "_frameTime" | "schedulerSystem" | "input" | "preUpdate" | "postUpdate" | "physics" | "preRender" | "render" | "postRender" | "advancePhysicsClock" | "rapierStep">;
1327
1327
  readonly actions: {
1328
1328
  readonly pickRay: (db: Database<import("@adobe/data/schema").FromSchemas<{
1329
1329
  readonly bodyType: {
@@ -1791,7 +1791,7 @@ export declare const rapierSolver: {
1791
1791
  readonly unique: true;
1792
1792
  readonly archetype: "Material";
1793
1793
  };
1794
- }, never>, row: import("../../material/public.js")) => Entity;
1794
+ }, never, never>, row: import("../../material/public.js")) => Entity;
1795
1795
  readonly insertMaterialDefinition: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
1796
1796
  readonly material: {
1797
1797
  readonly entity: true;
@@ -1970,7 +1970,7 @@ export declare const rapierSolver: {
1970
1970
  readonly unique: true;
1971
1971
  readonly archetype: "Material";
1972
1972
  };
1973
- }, never>, args: {
1973
+ }, never, never>, args: {
1974
1974
  name: string;
1975
1975
  definition: import("../../material/material-definition.js").MaterialDefinition;
1976
1976
  }) => Entity;
@@ -2152,7 +2152,7 @@ export declare const rapierSolver: {
2152
2152
  readonly unique: true;
2153
2153
  readonly archetype: "Material";
2154
2154
  };
2155
- }, never>, defs: Readonly<Record<string, import("../../material/material-definition.js").MaterialDefinition>>) => void;
2155
+ }, never, never>, defs: Readonly<Record<string, import("../../material/material-definition.js").MaterialDefinition>>) => void;
2156
2156
  readonly seedStandardMaterials: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
2157
2157
  readonly material: {
2158
2158
  readonly entity: true;
@@ -2331,7 +2331,7 @@ export declare const rapierSolver: {
2331
2331
  readonly unique: true;
2332
2332
  readonly archetype: "Material";
2333
2333
  };
2334
- }, never>) => void;
2334
+ }, never, never>) => void;
2335
2335
  readonly seedDefinitionMaterials: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
2336
2336
  readonly material: {
2337
2337
  readonly entity: true;
@@ -2510,7 +2510,7 @@ export declare const rapierSolver: {
2510
2510
  readonly unique: true;
2511
2511
  readonly archetype: "Material";
2512
2512
  };
2513
- }, never>) => void;
2513
+ }, never, never>) => void;
2514
2514
  }>, never, import("@adobe/data/ecs").ToActionFunctions<{}>, import("@adobe/data/ecs").FromServiceFactories<{}>, import("@adobe/data/ecs").FromComputedFactories<{}>, {} & {
2515
2515
  readonly materialByName: {
2516
2516
  readonly key: "name";
@@ -2987,7 +2987,7 @@ export declare const rapierSolver: {
2987
2987
  readonly unique: true;
2988
2988
  readonly archetype: "Material";
2989
2989
  };
2990
- }, never>, row: import("../../material/public.js")) => Entity;
2990
+ }, never, never>, row: import("../../material/public.js")) => Entity;
2991
2991
  readonly insertMaterialDefinition: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
2992
2992
  readonly material: {
2993
2993
  readonly entity: true;
@@ -3166,7 +3166,7 @@ export declare const rapierSolver: {
3166
3166
  readonly unique: true;
3167
3167
  readonly archetype: "Material";
3168
3168
  };
3169
- }, never>, args: {
3169
+ }, never, never>, args: {
3170
3170
  name: string;
3171
3171
  definition: import("../../material/material-definition.js").MaterialDefinition;
3172
3172
  }) => Entity;
@@ -3348,7 +3348,7 @@ export declare const rapierSolver: {
3348
3348
  readonly unique: true;
3349
3349
  readonly archetype: "Material";
3350
3350
  };
3351
- }, never>, defs: Readonly<Record<string, import("../../material/material-definition.js").MaterialDefinition>>) => void;
3351
+ }, never, never>, defs: Readonly<Record<string, import("../../material/material-definition.js").MaterialDefinition>>) => void;
3352
3352
  readonly seedStandardMaterials: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
3353
3353
  readonly material: {
3354
3354
  readonly entity: true;
@@ -3527,7 +3527,7 @@ export declare const rapierSolver: {
3527
3527
  readonly unique: true;
3528
3528
  readonly archetype: "Material";
3529
3529
  };
3530
- }, never>) => void;
3530
+ }, never, never>) => void;
3531
3531
  readonly seedDefinitionMaterials: (t: import("@adobe/data/ecs").Store<import("@adobe/data/schema").FromSchemas<{
3532
3532
  readonly material: {
3533
3533
  readonly entity: true;
@@ -3706,7 +3706,7 @@ export declare const rapierSolver: {
3706
3706
  readonly unique: true;
3707
3707
  readonly archetype: "Material";
3708
3708
  };
3709
- }, never>) => void;
3709
+ }, never, never>) => void;
3710
3710
  }>, never, import("@adobe/data/ecs").ToActionFunctions<{}>, import("@adobe/data/ecs").FromServiceFactories<{}>, import("@adobe/data/ecs").FromComputedFactories<{}>, {} & {
3711
3711
  readonly materialByName: {
3712
3712
  readonly key: "name";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data-gpu",
3
- "version": "0.10.20",
3
+ "version": "0.10.21",
4
4
  "description": "Adobe data WebGPU plugins and types for graphics and compute",
5
5
  "type": "module",
6
6
  "private": false,
@@ -12,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "@dimforge/rapier3d-compat": "^0.19.3",
14
14
  "jolt-physics": "^1.0.0",
15
- "@adobe/data": "0.10.20"
15
+ "@adobe/data": "0.10.21"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@webgpu/types": "^0.1.61",
@@ -22,15 +22,37 @@ import {
22
22
 
23
23
  interface InstCache { buffer: GPUBuffer; indexBuffer: GPUBuffer; bindGroup: GPUBindGroup; capacity: number }
24
24
 
25
+ interface StaticPrimDraw {
26
+ readonly primId: Entity;
27
+ readonly n: number;
28
+ readonly indexCount: number;
29
+ readonly indexFormat: GPUIndexFormat;
30
+ readonly vertexBuffer: GPUBuffer;
31
+ readonly indexBuffer: GPUBuffer;
32
+ readonly bindGroup: GPUBindGroup;
33
+ }
34
+
25
35
  /**
26
36
  * pbrFactorRender — instanced primitive PBR from material factors only (no map
27
37
  * sampling). Extends `pbrIblRender` for IBL + skybox + optional glTF draws.
28
38
  * Pairs with `materialPaletteGpu` (`_paletteIndex` on factor materials).
29
39
  *
30
40
  * Pairs with `materialPaletteGpu` (`_paletteIndex`). Idle when no factor materials or drawables exist.
41
+ *
42
+ * Set resource `_pbrFactorStaticInstances = true` for fully static scenes
43
+ * (e.g. terrain heightfield): after drawable count stabilizes, skip per-frame
44
+ * TRS gather + instance buffer uploads and only re-issue drawIndexed.
31
45
  */
32
46
  export const pbrFactorRender = Database.Plugin.create({
33
47
  extends: Database.Plugin.combine(pbrIblRender, materialPaletteGpu, displayTransform),
48
+ resources: {
49
+ /**
50
+ * When true, instance matrices are uploaded once the drawable set is
51
+ * stable; later frames only rebind and draw. Clear or leave false for
52
+ * scenes that move/add bodies every frame.
53
+ */
54
+ _pbrFactorStaticInstances: { default: false as boolean, nonPersistent: true },
55
+ },
34
56
  systems: {
35
57
  pbrFactorPrimitiveRenderSystem: {
36
58
  schedule: { during: ["render"], after: ["beginRenderPass", "pbrIblRenderSystem"], before: ["endRenderPass"] },
@@ -54,10 +76,15 @@ export const pbrFactorRender = Database.Plugin.create({
54
76
  let mats = new Float32Array(64 * 16);
55
77
  const batches = new Map<Entity, MeshBatch>();
56
78
 
79
+ let staticDraws: StaticPrimDraw[] | null = null;
80
+ let staticDrawCount = -1;
81
+ let staticStableFrames = 0;
82
+
57
83
  return () => {
58
84
  const {
59
85
  device, renderPassEncoder, canvasFormat, depthFormat, _sceneUniformsBuffer,
60
86
  _factorPaletteBindGroup, _iblIrradiance, _iblPrefiltered, _iblBrdfLut,
87
+ _pbrFactorStaticInstances,
61
88
  } = db.store.resources;
62
89
  if (!device || !renderPassEncoder || !_sceneUniformsBuffer || !_factorPaletteBindGroup) return;
63
90
  if (!_iblIrradiance || !_iblPrefiltered || !_iblBrdfLut) return;
@@ -104,6 +131,21 @@ export const pbrFactorRender = Database.Plugin.create({
104
131
  cachedIrradiance = _iblIrradiance;
105
132
  }
106
133
 
134
+ // Static path: re-draw without re-gather / re-upload.
135
+ if (_pbrFactorStaticInstances && staticDraws != null && staticDraws.length > 0) {
136
+ renderPassEncoder.setPipeline(pipeline);
137
+ renderPassEncoder.setBindGroup(0, sceneBindGroup);
138
+ renderPassEncoder.setBindGroup(1, _factorPaletteBindGroup);
139
+ renderPassEncoder.setBindGroup(2, iblBindGroup);
140
+ for (const d of staticDraws) {
141
+ renderPassEncoder.setBindGroup(3, d.bindGroup);
142
+ renderPassEncoder.setVertexBuffer(0, d.vertexBuffer);
143
+ renderPassEncoder.setIndexBuffer(d.indexBuffer, d.indexFormat);
144
+ renderPassEncoder.drawIndexed(d.indexCount, d.n);
145
+ }
146
+ return;
147
+ }
148
+
107
149
  let mc = 0;
108
150
  for (const arch of db.store.queryArchetypes(["_paletteIndex"])) mc += arch.rowCount;
109
151
  if (mc !== matCount) {
@@ -150,6 +192,8 @@ export const pbrFactorRender = Database.Plugin.create({
150
192
  renderPassEncoder.setBindGroup(1, _factorPaletteBindGroup);
151
193
  renderPassEncoder.setBindGroup(2, iblBindGroup);
152
194
 
195
+ const nextStatic: StaticPrimDraw[] = [];
196
+
153
197
  for (const arch of db.store.queryArchetypes(PRIMITIVE)) {
154
198
  const vbs = arch.columns._vertexBuffer, ibs = arch.columns._indexBuffer;
155
199
  const counts = arch.columns._indexCount, formats = arch.columns._indexFormat;
@@ -187,7 +231,37 @@ export const pbrFactorRender = Database.Plugin.create({
187
231
  renderPassEncoder.setVertexBuffer(0, vbs.get(i)!);
188
232
  renderPassEncoder.setIndexBuffer(ibs.get(i)!, formats.get(i));
189
233
  renderPassEncoder.drawIndexed(counts.get(i), n);
234
+
235
+ if (_pbrFactorStaticInstances) {
236
+ nextStatic.push({
237
+ primId,
238
+ n,
239
+ indexCount: counts.get(i),
240
+ indexFormat: formats.get(i),
241
+ vertexBuffer: vbs.get(i)!,
242
+ indexBuffer: ibs.get(i)!,
243
+ bindGroup: entry.bindGroup,
244
+ });
245
+ }
246
+ }
247
+ }
248
+
249
+ // Freeze only after the drawable set stops growing for one frame
250
+ // (mesh resolve / material assign finish during the first seconds).
251
+ if (_pbrFactorStaticInstances) {
252
+ if (drawCount === staticDrawCount && drawCount > 0) {
253
+ staticStableFrames++;
254
+ } else {
255
+ staticStableFrames = 0;
256
+ staticDrawCount = drawCount;
257
+ }
258
+ if (staticStableFrames >= 1 && nextStatic.length > 0) {
259
+ staticDraws = nextStatic;
190
260
  }
261
+ } else {
262
+ staticDraws = null;
263
+ staticStableFrames = 0;
264
+ staticDrawCount = -1;
191
265
  }
192
266
  };
193
267
  },
@@ -13,23 +13,22 @@ import { boundsFromShapeMesh } from "../../scene/model/shape/bounds-from-shape-m
13
13
  import type { ColliderMesh } from "../../../physics/body/collider-mesh.js";
14
14
  import { interpolation } from "../interpolation-plugin.js";
15
15
 
16
- /** Authored column sets for primitive collider rows (RigidBody, ConvexBody,
17
- * StaticCollider, MeshCollider). Query by these sets — not the named handle —
18
- * so solver-tagged variants are found after migration. Rows with
19
- * `voxelShapeName` are skipped at runtime (mechs voxel bodies). */
16
+ /**
17
+ * Authored column sets for primitive collider rows still missing a render mesh.
18
+ * - exclude `mesh` → once assigned, rows drop out of the scan (O(pending) not O(all)).
19
+ * - exclude `voxelShapeName` → mechs voxel bodies use voxelShapeVisualBridge only
20
+ * (never visit ~all static voxel colliders every frame).
21
+ */
20
22
  const PRIMITIVE_COLLIDER_QUERIES: readonly {
21
23
  include: readonly string[];
22
- exclude?: readonly string[];
24
+ exclude: readonly string[];
23
25
  }[] = [
24
- { include: RIGID_BODY_COMPONENTS, exclude: ["convexPoints"] },
25
- { include: [...RIGID_BODY_COMPONENTS, "convexPoints"] },
26
- { include: STATIC_COLLIDER_COMPONENTS, exclude: ["colliderMesh"] },
27
- { include: [...STATIC_COLLIDER_COMPONENTS, "colliderMesh"] },
26
+ { include: RIGID_BODY_COMPONENTS, exclude: ["convexPoints", "voxelShapeName", "mesh"] },
27
+ { include: [...RIGID_BODY_COMPONENTS, "convexPoints"], exclude: ["voxelShapeName", "mesh"] },
28
+ { include: STATIC_COLLIDER_COMPONENTS, exclude: ["colliderMesh", "voxelShapeName", "mesh"] },
29
+ { include: [...STATIC_COLLIDER_COMPONENTS, "colliderMesh"], exclude: ["voxelShapeName", "mesh"] },
28
30
  ];
29
31
 
30
- const hasVoxelShapeName = (store: { read(id: Entity): Record<string, unknown> | null }, id: Entity): boolean =>
31
- store.read(id)?.voxelShapeName != null;
32
-
33
32
  /**
34
33
  * physicsRenderBridge — assigns default primitive render meshes for standard
35
34
  * physics bodies whose visual is the collider primitive (RigidBody,
@@ -97,15 +96,13 @@ export const physicsRenderBridge = Database.Plugin.create({
97
96
  for (const { include, exclude } of PRIMITIVE_COLLIDER_QUERIES) {
98
97
  for (const arch of db.store.queryArchetypes(
99
98
  include as typeof RIGID_BODY_COMPONENTS,
100
- exclude ? { exclude: exclude as ["convexPoints"] | ["colliderMesh"] } : undefined,
99
+ { exclude: exclude as ["mesh"] },
101
100
  )) {
102
101
  const ids = arch.columns.id;
103
102
  const css = arch.columns.colliderShape;
104
103
  const hes = arch.columns.halfExtents;
105
104
  for (let i = arch.rowCount - 1; i >= 0; i--) {
106
105
  const id = ids.get(i);
107
- if (hasVoxelShapeName(db.store, id)) continue;
108
- if (db.store.get(id, "mesh") != null) continue;
109
106
  const shape = css.get(i);
110
107
  const he = hes.get(i);
111
108
  let meshId: Entity;