@luma.gl/engine 10.0.0-beta.4 → 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 (48) 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 +35 -6
  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/index.cjs.map +1 -1
  39. package/dist/lighting/index.cjs.map +1 -1
  40. package/package.json +8 -8
  41. package/src/audio/audio-controller.ts +4 -1
  42. package/src/audio/audio-graph.ts +46 -25
  43. package/src/effects/passes/screen-space/ssao.ts +3 -1
  44. package/src/experimental-controls.ts +13 -1
  45. package/src/experimental-materials.ts +37 -1
  46. package/src/experimental-textures.ts +9 -1
  47. package/src/experimental-webxr.ts +18 -1
  48. package/src/splats/README.md +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/engine",
3
- "version": "10.0.0-beta.4",
3
+ "version": "10.0.0-rc.1",
4
4
  "description": "3D Engine Components for luma.gl",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -128,20 +128,20 @@
128
128
  "prepublishOnly": "npm run build-minified-bundle && npm run build-dev-bundle"
129
129
  },
130
130
  "peerDependencies": {
131
- "@luma.gl/core": "~10.0.0-beta.4",
132
- "@luma.gl/shaders": "~10.0.0-beta.4",
131
+ "@luma.gl/core": "~10.0.0-rc.1",
132
+ "@luma.gl/shaders": "~10.0.0-rc.1",
133
133
  "apache-arrow": ">=17.0.0"
134
134
  },
135
135
  "dependencies": {
136
- "@luma.gl/graph": "10.0.0-beta.4",
136
+ "@luma.gl/graph": "10.0.0-rc.1",
137
137
  "@mapbox/tiny-sdf": "^2.0.7",
138
- "@math.gl/core": "^5.0.3",
139
- "@math.gl/geometry": "^5.0.3",
138
+ "@math.gl/core": "^5.0.4",
139
+ "@math.gl/geometry": "^5.0.4",
140
140
  "probe.gl": "^5.0.0"
141
141
  },
142
- "gitHead": "1b38b0a1eff208ee761dd6b201274b726288f3a8",
142
+ "gitHead": "6bde4071c03ea0620291fc63df76401a054535b0",
143
143
  "devDependencies": {
144
- "@luma.gl/anari": "10.0.0-beta.4"
144
+ "@luma.gl/anari": "10.0.0-rc.1"
145
145
  },
146
146
  "peerDependenciesMeta": {
147
147
  "apache-arrow": {
@@ -305,6 +305,10 @@ export class AudioController {
305
305
  gain.disconnect();
306
306
  }
307
307
  this.playing.clear();
308
+ for (const graph of this.graphs.values()) {
309
+ if (this.destroyed) graph.destroy();
310
+ else graph.reset();
311
+ }
308
312
  for (const bus of this.reverbBuses.values()) bus.reset();
309
313
  }
310
314
 
@@ -415,7 +419,6 @@ export class AudioController {
415
419
  emitter.airFilter?.disconnect();
416
420
  emitter.gain.disconnect();
417
421
  }
418
- for (const graph of this.graphs.values()) graph.destroy();
419
422
  for (const bus of this.reverbBuses.values()) bus.destroy();
420
423
  this.reverbBuses.clear();
421
424
  for (const direct of this.directGains) direct.disconnect();
@@ -46,11 +46,14 @@ export type AudioGraphDefinition = {
46
46
  /** Owns only processing nodes. Scheduled sources and destination nodes remain caller-owned. */
47
47
  export class AudioGraph {
48
48
  readonly nodes: AudioNode[] = [];
49
+ /** Tracks whether a source has fed these processors since they were connected. */
50
+ private hasConnectedSource = false;
51
+
49
52
  constructor(
50
53
  readonly definition: AudioGraphDefinition,
51
- context: BaseAudioContext,
52
- destination: AudioNode,
53
- getEmitterInputs: (index: number) => readonly AudioNode[]
54
+ private readonly context: BaseAudioContext,
55
+ private readonly destination: AudioNode,
56
+ private readonly getEmitterInputs: (index: number) => readonly AudioNode[]
54
57
  ) {
55
58
  // Multi-port routing processors cannot be replaced by a one-port bypass gain.
56
59
  for (const node of definition.nodes)
@@ -85,31 +88,46 @@ export class AudioGraph {
85
88
  visited.add(index);
86
89
  };
87
90
  definition.nodes.forEach((_, index) => visit(index));
91
+ this.connectProcessors();
92
+ }
93
+
94
+ /** Flush buffered samples while retaining gain automation. */
95
+ reset(): void {
96
+ if (!this.hasConnectedSource) return;
97
+ const previousNodes = this.nodes.slice();
98
+ this.destroy();
99
+ this.connectProcessors(previousNodes);
100
+ }
101
+
102
+ /** Wire graph processors, reusing gain nodes to preserve their AudioParam automation. */
103
+ private connectProcessors(previousNodes: readonly AudioNode[] = []): void {
104
+ const {definition, context, destination, getEmitterInputs} = this;
88
105
  try {
89
106
  definition.nodes.forEach((node, index) =>
90
107
  this.nodes.push(
91
- createProcessor(
92
- context,
93
- node,
94
- Math.max(
95
- 1,
96
- ...definition.connections
97
- .filter(edge => edge.from.node === index)
98
- .map(edge => (edge.from.output ?? 0) + 1),
99
- ...(definition.outputs || [])
100
- .filter(output => output.node === index)
101
- .map(output => (output.output ?? 0) + 1)
102
- ),
103
- Math.max(
104
- 1,
105
- ...definition.connections
106
- .filter(edge => edge.to.node === index)
107
- .map(edge => (edge.to.input ?? 0) + 1),
108
- ...(definition.inputs || [])
109
- .filter(input => input.node === index)
110
- .map(input => (input.input ?? 0) + 1)
108
+ (node.kind === 'gain' ? previousNodes[index] : undefined) ??
109
+ createProcessor(
110
+ context,
111
+ node,
112
+ Math.max(
113
+ 1,
114
+ ...definition.connections
115
+ .filter(edge => edge.from.node === index)
116
+ .map(edge => (edge.from.output ?? 0) + 1),
117
+ ...(definition.outputs || [])
118
+ .filter(output => output.node === index)
119
+ .map(output => (output.output ?? 0) + 1)
120
+ ),
121
+ Math.max(
122
+ 1,
123
+ ...definition.connections
124
+ .filter(edge => edge.to.node === index)
125
+ .map(edge => (edge.to.input ?? 0) + 1),
126
+ ...(definition.inputs || [])
127
+ .filter(input => input.node === index)
128
+ .map(input => (input.input ?? 0) + 1)
129
+ )
111
130
  )
112
- )
113
131
  )
114
132
  );
115
133
  for (const edge of definition.connections) {
@@ -138,8 +156,10 @@ export class AudioGraph {
138
156
 
139
157
  connectSource(index: number, source: AudioNode): void {
140
158
  for (const input of this.definition.inputs || []) {
141
- if (input.source === index)
159
+ if (input.source === index) {
142
160
  source.connect(this.nodes[input.node], 0, this.getInputPort(input.node, input.input ?? 0));
161
+ this.hasConnectedSource = true;
162
+ }
143
163
  }
144
164
  }
145
165
 
@@ -172,6 +192,7 @@ export class AudioGraph {
172
192
  destroy(): void {
173
193
  for (const node of this.nodes) node.disconnect();
174
194
  this.nodes.length = 0;
195
+ this.hasConnectedSource = false;
175
196
  }
176
197
 
177
198
  private getInputPort(index: number, port: number): number {
@@ -48,7 +48,9 @@ fn ssaoEvaluate_sampleColor(
48
48
  let dimensions = vec2f(textureDimensions(depthTexture));
49
49
  let linearDepth = advancedLinearDepth(depth, ssaoEvaluate.nearPlane, ssaoEvaluate.farPlane);
50
50
  let reconstructedNormal = advancedDepthNormal(depthTexture, depthTextureSampler, sceneCoord);
51
- let textureNormal = normalize(textureSample(normalTexture, normalTextureSampler, sceneCoord).xyz * 2.0 - 1.0);
51
+ let viewNormal = textureSample(normalTexture, normalTextureSampler, sceneCoord).xyz * 2.0 - 1.0;
52
+ // G-buffer normals use +Y up, while WebGPU texture sample offsets use +Y down.
53
+ let textureNormal = normalize(viewNormal * vec3f(1.0, -1.0, 1.0));
52
54
  let normal = normalize(mix(reconstructedNormal, textureNormal, ssaoEvaluate.useNormalTexture));
53
55
  let angle = fract(sin(dot(texCoord * dimensions, vec2f(12.9898, 78.233))) * 43758.5453) * 6.2831853;
54
56
  var occlusion = 0.0;
@@ -2,4 +2,16 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- export * from './experimental/controls/index';
5
+ export {
6
+ ComparisonSplitter,
7
+ FlatController,
8
+ RectangleSelectController
9
+ } from './experimental/controls/index';
10
+ export type {
11
+ ComparisonSplitterProps,
12
+ FlatControllerPick,
13
+ FlatControllerProps,
14
+ FlatViewState,
15
+ RectangleSelection,
16
+ RectangleSelectControllerProps
17
+ } from './experimental/controls/index';
@@ -2,4 +2,40 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- export * from './experimental/materials/index';
5
+ export {
6
+ opticalLighting,
7
+ MAX_OPTICAL_CAUSTIC_LENSES,
8
+ opticalCaustics,
9
+ opticalCausticsPlugin,
10
+ MAX_OPTICAL_POINT_LIGHTS,
11
+ opticalPointLights,
12
+ opticalPointLightsPlugin,
13
+ emissiveMaterial,
14
+ emissiveMaterialPlugin,
15
+ glassMaterial,
16
+ glassMaterialPlugin,
17
+ glassTransmission,
18
+ glassTransmissionPlugin,
19
+ reflectiveMaterial,
20
+ reflectiveMaterialPlugin
21
+ } from './experimental/materials/index';
22
+ export type {
23
+ OpticalCausticLens,
24
+ OpticalCausticLensUniform,
25
+ OpticalCausticsProps,
26
+ OpticalCausticsUniforms,
27
+ OpticalPointLight,
28
+ OpticalPointLightUniform,
29
+ OpticalPointLightsProps,
30
+ OpticalPointLightsUniforms,
31
+ EmissiveMaterialProps,
32
+ EmissiveMaterialUniforms,
33
+ GlassMaterialBindings,
34
+ GlassMaterialProps,
35
+ GlassMaterialUniforms,
36
+ GlassTransmissionBindings,
37
+ GlassTransmissionProps,
38
+ GlassTransmissionUniforms,
39
+ ReflectiveMaterialProps,
40
+ ReflectiveMaterialUniforms
41
+ } from './experimental/materials/index';
@@ -2,4 +2,12 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- export * from './experimental/textures/index';
5
+ export {
6
+ RGBADecoder,
7
+ TEXTURE_FORMAT_PIXEL_DECODERS,
8
+ HTMLTexture
9
+ } from './experimental/textures/index';
10
+ export type {
11
+ TextureFormatPacked,
12
+ HTMLTextureProps
13
+ } from './experimental/textures/index';
@@ -2,4 +2,21 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
4
4
 
5
- export * from './experimental/webxr/index';
5
+ export {
6
+ WebXRAnimationFrameProvider,
7
+ WebXRCameraTexture,
8
+ getWebXRInputRay,
9
+ getWebXRInputRayPlaneIntersection,
10
+ WebXRManager
11
+ } from './experimental/webxr/index';
12
+ export type {
13
+ WebXRRawCameraBinding,
14
+ WebXRCameraTextureProps,
15
+ WebXRInputRay,
16
+ WebXRInputRayPlaneIntersection,
17
+ WebXRInputRayPlaneIntersectionProps,
18
+ WebXRFrameState,
19
+ WebXRInputState,
20
+ WebXRManagerProps,
21
+ WebXRViewState
22
+ } from './experimental/webxr/index';
@@ -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';