@luma.gl/engine 10.0.0-beta.3 → 10.0.0-rc.1

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 (85) hide show
  1. package/dist/audio/audio-controller.cjs +6 -2
  2. package/dist/audio/audio-controller.d.ts.map +1 -1
  3. package/dist/audio/audio-controller.js +6 -2
  4. package/dist/audio/audio-controller.js.map +1 -1
  5. package/dist/audio/audio-graph.cjs +26 -2
  6. package/dist/audio/audio-graph.d.ts +9 -0
  7. package/dist/audio/audio-graph.d.ts.map +1 -1
  8. package/dist/audio/audio-graph.js +35 -10
  9. package/dist/audio/audio-graph.js.map +1 -1
  10. package/dist/dist.dev.js +38 -7
  11. package/dist/dist.min.js +50 -50
  12. package/dist/effects/index.cjs.map +1 -1
  13. package/dist/effects/passes/screen-space/ssao.cjs +3 -1
  14. package/dist/effects/passes/screen-space/ssao.d.ts +1 -1
  15. package/dist/effects/passes/screen-space/ssao.d.ts.map +1 -1
  16. package/dist/effects/passes/screen-space/ssao.js +3 -1
  17. package/dist/effects/passes/screen-space/ssao.js.map +1 -1
  18. package/dist/experimental-controls.cjs +13 -3
  19. package/dist/experimental-controls.d.ts +2 -1
  20. package/dist/experimental-controls.d.ts.map +1 -1
  21. package/dist/experimental-controls.js +1 -1
  22. package/dist/experimental-controls.js.map +1 -1
  23. package/dist/experimental-materials.cjs +37 -3
  24. package/dist/experimental-materials.d.ts +2 -1
  25. package/dist/experimental-materials.d.ts.map +1 -1
  26. package/dist/experimental-materials.js +1 -1
  27. package/dist/experimental-materials.js.map +1 -1
  28. package/dist/experimental-textures.cjs +13 -3
  29. package/dist/experimental-textures.d.ts +2 -1
  30. package/dist/experimental-textures.d.ts.map +1 -1
  31. package/dist/experimental-textures.js +1 -1
  32. package/dist/experimental-textures.js.map +1 -1
  33. package/dist/experimental-webxr.cjs +17 -3
  34. package/dist/experimental-webxr.d.ts +2 -1
  35. package/dist/experimental-webxr.d.ts.map +1 -1
  36. package/dist/experimental-webxr.js +1 -1
  37. package/dist/experimental-webxr.js.map +1 -1
  38. package/dist/gltf/index.cjs.map +1 -1
  39. package/dist/gltf/parsers/parse-gltf-joints.cjs +8 -1
  40. package/dist/gltf/parsers/parse-gltf-joints.d.ts +1 -0
  41. package/dist/gltf/parsers/parse-gltf-joints.d.ts.map +1 -1
  42. package/dist/gltf/parsers/parse-gltf-joints.js +8 -1
  43. package/dist/gltf/parsers/parse-gltf-joints.js.map +1 -1
  44. package/dist/gltf/physics/index.cjs.map +1 -1
  45. package/dist/graph/models/index.cjs.map +1 -1
  46. package/dist/graph/physics/index.cjs.map +1 -1
  47. package/dist/graph/physics/scenegraph-joints.cjs +1 -0
  48. package/dist/graph/physics/scenegraph-joints.d.ts.map +1 -1
  49. package/dist/graph/physics/scenegraph-joints.js +1 -0
  50. package/dist/graph/physics/scenegraph-joints.js.map +1 -1
  51. package/dist/graph/physics/scenegraph-motion.cjs +25 -3
  52. package/dist/graph/physics/scenegraph-motion.d.ts +1 -1
  53. package/dist/graph/physics/scenegraph-motion.d.ts.map +1 -1
  54. package/dist/graph/physics/scenegraph-motion.js +27 -2
  55. package/dist/graph/physics/scenegraph-motion.js.map +1 -1
  56. package/dist/graph/physics/scenegraph-session.cjs +2 -2
  57. package/dist/graph/physics/scenegraph-session.d.ts +4 -2
  58. package/dist/graph/physics/scenegraph-session.d.ts.map +1 -1
  59. package/dist/graph/physics/scenegraph-session.js +2 -2
  60. package/dist/graph/physics/scenegraph-session.js.map +1 -1
  61. package/dist/graph/tables/index.cjs.map +1 -1
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/lighting/index.cjs.map +1 -1
  64. package/dist/model/gpu-vector-model.cjs +2 -2
  65. package/dist/model/gpu-vector-model.d.ts.map +1 -1
  66. package/dist/model/gpu-vector-model.js +2 -1
  67. package/dist/model/gpu-vector-model.js.map +1 -1
  68. package/dist/scenegraph/controllers/joint-controller.d.ts +2 -0
  69. package/dist/scenegraph/controllers/joint-controller.d.ts.map +1 -1
  70. package/dist/scenegraph/controllers/joint-controller.js.map +1 -1
  71. package/package.json +8 -8
  72. package/src/audio/audio-controller.ts +4 -1
  73. package/src/audio/audio-graph.ts +46 -25
  74. package/src/effects/passes/screen-space/ssao.ts +3 -1
  75. package/src/experimental-controls.ts +13 -1
  76. package/src/experimental-materials.ts +37 -1
  77. package/src/experimental-textures.ts +9 -1
  78. package/src/experimental-webxr.ts +18 -1
  79. package/src/gltf/parsers/parse-gltf-joints.ts +9 -2
  80. package/src/graph/physics/scenegraph-joints.ts +1 -0
  81. package/src/graph/physics/scenegraph-motion.ts +29 -2
  82. package/src/graph/physics/scenegraph-session.ts +5 -2
  83. package/src/model/gpu-vector-model.ts +8 -2
  84. package/src/scenegraph/controllers/joint-controller.ts +2 -0
  85. package/src/splats/README.md +1 -1
@@ -34,7 +34,7 @@ function list(value: unknown): unknown[] {
34
34
 
35
35
  export function parseGLTFJointDeclarations(
36
36
  document: {
37
- nodes?: readonly {extensions?: Record<string, unknown>}[];
37
+ nodes?: readonly {name?: string; extensions?: Record<string, unknown>}[];
38
38
  extensions?: Record<string, unknown>;
39
39
  },
40
40
  sceneNodes: ReadonlyMap<number, ScenegraphNode>
@@ -131,7 +131,14 @@ export function parseGLTFJointDeclarations(
131
131
  nodeIndex,
132
132
  connectedNodeIndex: connectedNode,
133
133
  jointIndex: definitionIndex,
134
- joint: {first, second, limits, drives, collideConnected: source['enableCollision'] === true}
134
+ joint: {
135
+ id: nodes[nodeIndex].name ?? `node-${nodeIndex}`,
136
+ first,
137
+ second,
138
+ limits,
139
+ drives,
140
+ collideConnected: source['enableCollision'] === true
141
+ }
135
142
  });
136
143
  } catch (error) {
137
144
  issues.push({
@@ -18,6 +18,7 @@ export function makeRigidBodyJointsFromScenegraph(
18
18
  };
19
19
  const base = {
20
20
  type: 'general' as const,
21
+ id: resolved.joint.id ?? resolved.joint.first.id,
21
22
  first: bodyIndex(resolved.first.body),
22
23
  second: bodyIndex(resolved.second.body),
23
24
  firstFrame: {position: resolved.first.position, orientation: resolved.first.orientation},
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- import {Matrix4} from '@math.gl/core/matrix';
5
+ import {Matrix4, Quaternion} from '@math.gl/core/matrix';
6
6
  import {GroupNode, decomposePhysicsTransform, type ScenegraphNode} from '../../index';
7
7
  import {scaleRigidBodyShape} from '@luma.gl/graph/gpu-physics';
8
8
  import type {GPURigidBodyWorld} from '@luma.gl/graph/gpu-physics';
@@ -111,8 +111,35 @@ export class ScenegraphPhysicsMotion {
111
111
  }
112
112
 
113
113
  /** Call after sampling animation, before submitting the corresponding fixed physics step. */
114
- update(): void {
114
+ update(angularDriveRows: readonly number[] = []): void {
115
115
  const currentMatrices = this.collectWorldMatrices();
116
+ if (angularDriveRows.length) {
117
+ /** Sample the authored orientations in the same body and attachment frames as the solver. */
118
+ const rotations = new Map<number, Quaternion>();
119
+ for (const [node, body] of this.targets) {
120
+ rotations.set(
121
+ body,
122
+ new Quaternion(decomposePhysicsTransform(currentMatrices.get(node)!).rotation)
123
+ );
124
+ }
125
+ const targets = new Map<number, number>();
126
+ for (const index of angularDriveRows) {
127
+ const joint = this.world.getJointParameters(index);
128
+ if (joint.type !== 'general' || !joint.angular || !joint.drive)
129
+ throw new Error('Expected angular drive');
130
+ const attachment = (body: number, frame?: readonly [number, number, number, number]) => {
131
+ const rotation = rotations.get(body);
132
+ if (!rotation) throw new Error('Missing angular drive body node');
133
+ return rotation.clone().multiplyRight(new Quaternion(frame ?? [0, 0, 0, 1]));
134
+ };
135
+ const relative = attachment(joint.first, joint.firstFrame?.orientation)
136
+ .invert()
137
+ .multiplyRight(attachment(joint.second, joint.secondFrame?.orientation));
138
+ const sign = relative[3] < 0 ? -1 : 1;
139
+ targets.set(index, 2 * Math.atan2(sign * relative[joint.axes[0]], sign * relative[3]));
140
+ }
141
+ this.world.setAngularDriveTargets(targets);
142
+ }
116
143
  const scaleChanges = this.colliders.flatMap(collider => {
117
144
  const matrix = currentMatrices.get(collider.node);
118
145
  if (!matrix) throw new Error('Detached collider animation target');
@@ -141,8 +141,11 @@ export class ScenegraphPhysicsSession {
141
141
  steps = 1,
142
142
  animatedNodes = new Set<ScenegraphNode>(),
143
143
  excludedNodes,
144
- targetNodes
144
+ targetNodes,
145
+ angularDriveRows
145
146
  }: {
147
+ /** Angular joint drive rows that follow the current scene pose while their bodies remain dynamic. */
148
+ angularDriveRows?: readonly number[];
146
149
  steps?: number;
147
150
  animatedNodes?: ReadonlySet<ScenegraphNode>;
148
151
  excludedNodes?: ReadonlySet<ScenegraphNode>;
@@ -154,7 +157,7 @@ export class ScenegraphPhysicsSession {
154
157
  // Validate the batch before mutating animation ownership or targets.
155
158
  assert(Number.isSafeInteger(steps) && steps > 0);
156
159
  this.motion.setAnimatedNodes(animatedNodes, {excludedNodes, targetNodes});
157
- this.motion.update();
160
+ this.motion.update(angularDriveRows);
158
161
  this.publication.update();
159
162
  this.instance.encode(encoder, steps);
160
163
  }
@@ -1836,7 +1836,10 @@ export class GPUVectorModel {
1836
1836
  renderPass as RenderPass & {
1837
1837
  framebuffer?: {
1838
1838
  colorAttachments?: Array<{texture?: {format?: TextureFormatColor}} | null>;
1839
- depthStencilAttachment?: {texture?: {format?: TextureFormatDepthStencil}} | null;
1839
+ depthStencilAttachment?: {
1840
+ props?: {format?: TextureFormatDepthStencil};
1841
+ texture?: {format?: TextureFormatDepthStencil};
1842
+ } | null;
1840
1843
  };
1841
1844
  }
1842
1845
  ).framebuffer || renderPass.props.framebuffer;
@@ -1854,7 +1857,10 @@ export class GPUVectorModel {
1854
1857
  renderBundleProps.depthStencilAttachmentFormat === false
1855
1858
  ? undefined
1856
1859
  : (renderBundleProps.depthStencilAttachmentFormat ??
1857
- asDepthStencilAttachmentFormat(framebuffer?.depthStencilAttachment?.texture?.format));
1860
+ asDepthStencilAttachmentFormat(
1861
+ framebuffer?.depthStencilAttachment?.props?.format ??
1862
+ framebuffer?.depthStencilAttachment?.texture?.format
1863
+ ));
1858
1864
 
1859
1865
  if (
1860
1866
  !deepEqual(this._colorAttachmentFormats, nextColorAttachmentFormats, 1) ||
@@ -18,6 +18,8 @@ export type {
18
18
  } from '@luma.gl/graph/gpu-physics';
19
19
 
20
20
  export type ScenegraphJoint = {
21
+ /** Instance-local actuator identifier shared by this attachment’s drive axes. */
22
+ id?: string;
21
23
  first: ScenegraphNode;
22
24
  second: ScenegraphNode;
23
25
  limits?: readonly ScenegraphJointLimit[];
@@ -61,7 +61,7 @@ and uncompressed Gaussian primitives:
61
61
  ```typescript
62
62
  import {load} from '@loaders.gl/core';
63
63
  import {GLTFLoader} from '@loaders.gl/scene/gltf';
64
- import {SPZLoader} from '@loaders.gl/splats';
64
+ import {SPZLoader} from '@loaders.gl/splats/spz/bundled';
65
65
  import {createScenegraphsFromGLTF, postProcessGLTF} from '@luma.gl/engine/gltf';
66
66
  import type {GLTFWithBuffers} from '@luma.gl/engine/gltf';
67
67
  import {getGLTFSplatSceneInstances, makeGPUSplatDataFromGLTFScene} from '@luma.gl/engine/arrow';