@luma.gl/engine 9.2.0-alpha.1 → 9.2.0-alpha.3

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 (59) hide show
  1. package/dist/animation-loop/animation-loop.d.ts +1 -1
  2. package/dist/animation-loop/animation-loop.d.ts.map +1 -1
  3. package/dist/animation-loop/animation-loop.js +2 -14
  4. package/dist/animation-loop/animation-loop.js.map +1 -1
  5. package/dist/animation-loop/make-animation-loop.d.ts +4 -1
  6. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
  7. package/dist/animation-loop/make-animation-loop.js +39 -7
  8. package/dist/animation-loop/make-animation-loop.js.map +1 -1
  9. package/dist/async-texture/async-texture.js.map +1 -1
  10. package/dist/compute/computation.js +2 -2
  11. package/dist/compute/computation.js.map +1 -1
  12. package/dist/dist.dev.js +166 -86
  13. package/dist/dist.min.js +19 -19
  14. package/dist/factories/pipeline-factory.js +3 -3
  15. package/dist/factories/pipeline-factory.js.map +1 -1
  16. package/dist/factories/shader-factory.js +2 -2
  17. package/dist/factories/shader-factory.js.map +1 -1
  18. package/dist/geometries/cube-geometry.d.ts +3 -3
  19. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  20. package/dist/geometry/geometry.d.ts.map +1 -1
  21. package/dist/geometry/geometry.js +3 -2
  22. package/dist/geometry/geometry.js.map +1 -1
  23. package/dist/index.cjs +177 -101
  24. package/dist/index.cjs.map +4 -4
  25. package/dist/model/model.d.ts.map +1 -1
  26. package/dist/model/model.js +25 -13
  27. package/dist/model/model.js.map +1 -1
  28. package/dist/modules/picking/color-picking.d.ts +1 -1
  29. package/dist/modules/picking/index-picking.d.ts +1 -1
  30. package/dist/modules/picking/picking-manager.d.ts +1 -1
  31. package/dist/modules/picking/picking-manager.d.ts.map +1 -1
  32. package/dist/modules/picking/picking-manager.js +1 -1
  33. package/dist/modules/picking/picking-manager.js.map +1 -1
  34. package/dist/modules/picking/picking-uniforms.d.ts +1 -1
  35. package/dist/shader-inputs.d.ts +5 -1
  36. package/dist/shader-inputs.d.ts.map +1 -1
  37. package/dist/shader-inputs.js +13 -6
  38. package/dist/shader-inputs.js.map +1 -1
  39. package/dist/utils/buffer-layout-helper.d.ts +12 -0
  40. package/dist/utils/buffer-layout-helper.d.ts.map +1 -0
  41. package/dist/utils/buffer-layout-helper.js +41 -0
  42. package/dist/utils/buffer-layout-helper.js.map +1 -0
  43. package/dist/utils/buffer-layout-order.d.ts +3 -0
  44. package/dist/utils/buffer-layout-order.d.ts.map +1 -0
  45. package/dist/utils/buffer-layout-order.js +16 -0
  46. package/dist/utils/buffer-layout-order.js.map +1 -0
  47. package/package.json +4 -4
  48. package/src/animation-loop/animation-loop.ts +2 -14
  49. package/src/animation-loop/make-animation-loop.ts +41 -9
  50. package/src/async-texture/async-texture.ts +3 -3
  51. package/src/compute/computation.ts +2 -2
  52. package/src/factories/pipeline-factory.ts +3 -3
  53. package/src/factories/shader-factory.ts +2 -2
  54. package/src/geometry/geometry.ts +3 -2
  55. package/src/model/model.ts +33 -15
  56. package/src/modules/picking/picking-manager.ts +1 -1
  57. package/src/shader-inputs.ts +21 -6
  58. package/src/utils/buffer-layout-helper.ts +51 -0
  59. package/src/utils/buffer-layout-order.ts +26 -0
package/dist/dist.dev.js CHANGED
@@ -528,20 +528,9 @@ var __exports__ = (() => {
528
528
  delete() {
529
529
  this.destroy();
530
530
  }
531
- setError(error) {
531
+ reportError(error) {
532
532
  this.props.onError(error);
533
- this._error = Error();
534
- const canvas2 = this.device?.getDefaultCanvasContext().canvas;
535
- if (canvas2 instanceof HTMLCanvasElement) {
536
- const errorDiv = document.createElement("h1");
537
- errorDiv.innerHTML = error.message;
538
- errorDiv.style.position = "absolute";
539
- errorDiv.style.top = "20%";
540
- errorDiv.style.left = "10px";
541
- errorDiv.style.color = "black";
542
- errorDiv.style.backgroundColor = "red";
543
- document.body.appendChild(errorDiv);
544
- }
533
+ this._error = error;
545
534
  }
546
535
  /** Flags this animation loop as needing redraw */
547
536
  setNeedsRedraw(reason) {
@@ -861,8 +850,14 @@ var __exports__ = (() => {
861
850
  ...props,
862
851
  device,
863
852
  async onInitialize(animationProps) {
864
- renderLoop = new AnimationLoopTemplateCtor(animationProps);
865
- return await renderLoop?.onInitialize(animationProps);
853
+ clearError(animationProps.animationLoop.device);
854
+ try {
855
+ renderLoop = new AnimationLoopTemplateCtor(animationProps);
856
+ return await renderLoop?.onInitialize(animationProps);
857
+ } catch (error) {
858
+ setError(animationProps.animationLoop.device, error);
859
+ return null;
860
+ }
866
861
  },
867
862
  onRender: (animationProps) => renderLoop?.onRender(animationProps),
868
863
  onFinalize: (animationProps) => renderLoop?.onFinalize(animationProps)
@@ -872,9 +867,32 @@ var __exports__ = (() => {
872
867
  };
873
868
  return animationLoop;
874
869
  }
870
+ function setError(device, error) {
871
+ const canvas2 = device?.getDefaultCanvasContext().canvas;
872
+ if (canvas2 instanceof HTMLCanvasElement) {
873
+ canvas2.style.overflow = "visible";
874
+ let errorDiv = document.getElementById("animation-loop-error");
875
+ errorDiv?.remove();
876
+ errorDiv = document.createElement("h1");
877
+ errorDiv.id = "animation-loop-error";
878
+ errorDiv.innerHTML = error.message;
879
+ errorDiv.style.position = "absolute";
880
+ errorDiv.style.top = "10px";
881
+ errorDiv.style.left = "10px";
882
+ errorDiv.style.color = "black";
883
+ errorDiv.style.backgroundColor = "red";
884
+ canvas2.parentElement?.appendChild(errorDiv);
885
+ }
886
+ }
887
+ function clearError(device) {
888
+ const errorDiv = document.getElementById("animation-loop-error");
889
+ if (errorDiv) {
890
+ errorDiv.remove();
891
+ }
892
+ }
875
893
 
876
894
  // src/model/model.ts
877
- var import_core8 = __toESM(require_core(), 1);
895
+ var import_core9 = __toESM(require_core(), 1);
878
896
  var import_shadertools2 = __toESM(require_shadertools(), 1);
879
897
 
880
898
  // src/geometry/gpu-geometry.ts
@@ -989,8 +1007,8 @@ var __exports__ = (() => {
989
1007
  var _PipelineFactory = class {
990
1008
  /** Get the singleton default pipeline factory for the specified device */
991
1009
  static getDefaultPipelineFactory(device) {
992
- device._lumaData.defaultPipelineFactory = device._lumaData.defaultPipelineFactory || new _PipelineFactory(device);
993
- return device._lumaData.defaultPipelineFactory;
1010
+ device._lumaData["defaultPipelineFactory"] = device._lumaData["defaultPipelineFactory"] || new _PipelineFactory(device);
1011
+ return device._lumaData["defaultPipelineFactory"];
994
1012
  }
995
1013
  device;
996
1014
  cachingEnabled;
@@ -1157,8 +1175,8 @@ var __exports__ = (() => {
1157
1175
  var _ShaderFactory = class {
1158
1176
  /** Returns the default ShaderFactory for the given {@link Device}, creating one if necessary. */
1159
1177
  static getDefaultShaderFactory(device) {
1160
- device._lumaData.defaultShaderFactory ||= new _ShaderFactory(device);
1161
- return device._lumaData.defaultShaderFactory;
1178
+ device._lumaData["defaultShaderFactory"] ||= new _ShaderFactory(device);
1179
+ return device._lumaData["defaultShaderFactory"];
1162
1180
  }
1163
1181
  device;
1164
1182
  cachingEnabled;
@@ -1340,8 +1358,59 @@ var __exports__ = (() => {
1340
1358
  return false;
1341
1359
  }
1342
1360
 
1343
- // src/shader-inputs.ts
1361
+ // src/utils/buffer-layout-helper.ts
1344
1362
  var import_core6 = __toESM(require_core(), 1);
1363
+ var BufferLayoutHelper = class {
1364
+ bufferLayouts;
1365
+ constructor(bufferLayouts) {
1366
+ this.bufferLayouts = bufferLayouts;
1367
+ }
1368
+ getBufferLayout(name) {
1369
+ return this.bufferLayouts.find((layout) => layout.name === name) || null;
1370
+ }
1371
+ /** Get attribute names from a BufferLayout */
1372
+ getAttributeNamesForBuffer(bufferLayout) {
1373
+ return bufferLayout.attributes ? bufferLayout.attributes?.map((layout) => layout.attribute) : [bufferLayout.name];
1374
+ }
1375
+ mergeBufferLayouts(bufferLayouts1, bufferLayouts2) {
1376
+ const mergedLayouts = [...bufferLayouts1];
1377
+ for (const attribute of bufferLayouts2) {
1378
+ const index = mergedLayouts.findIndex((attribute2) => attribute2.name === attribute.name);
1379
+ if (index < 0) {
1380
+ mergedLayouts.push(attribute);
1381
+ } else {
1382
+ mergedLayouts[index] = attribute;
1383
+ }
1384
+ }
1385
+ return mergedLayouts;
1386
+ }
1387
+ getBufferIndex(bufferName) {
1388
+ const bufferIndex = this.bufferLayouts.findIndex((layout) => layout.name === bufferName);
1389
+ if (bufferIndex === -1) {
1390
+ import_core6.log.warn(`BufferLayout: Missing buffer for "${bufferName}".`)();
1391
+ }
1392
+ return bufferIndex;
1393
+ }
1394
+ };
1395
+
1396
+ // src/utils/buffer-layout-order.ts
1397
+ function sortedBufferLayoutByShaderSourceLocations(shaderLayout, bufferLayout) {
1398
+ const shaderLayoutMap = Object.fromEntries(
1399
+ shaderLayout.attributes.map((attr) => [attr.name, attr.location])
1400
+ );
1401
+ const sortedLayout = bufferLayout.slice();
1402
+ sortedLayout.sort((a, b) => {
1403
+ const attributeNamesA = a.attributes ? a.attributes.map((attr) => attr.attribute) : [a.name];
1404
+ const attributeNamesB = b.attributes ? b.attributes.map((attr) => attr.attribute) : [b.name];
1405
+ const minLocationA = Math.min(...attributeNamesA.map((name) => shaderLayoutMap[name]));
1406
+ const minLocationB = Math.min(...attributeNamesB.map((name) => shaderLayoutMap[name]));
1407
+ return minLocationA - minLocationB;
1408
+ });
1409
+ return sortedLayout;
1410
+ }
1411
+
1412
+ // src/shader-inputs.ts
1413
+ var import_core7 = __toESM(require_core(), 1);
1345
1414
  var import_shadertools = __toESM(require_shadertools(), 1);
1346
1415
 
1347
1416
  // ../../node_modules/@math.gl/types/dist/is-array.js
@@ -1377,11 +1446,14 @@ var __exports__ = (() => {
1377
1446
 
1378
1447
  // src/shader-inputs.ts
1379
1448
  var ShaderInputs = class {
1449
+ options = {
1450
+ disableWarnings: false
1451
+ };
1380
1452
  /**
1381
1453
  * The map of modules
1382
1454
  * @todo should should this include the resolved dependencies?
1383
1455
  */
1384
- // @ts-expect-error Fix typings
1456
+ // @ts-ignore Fix typings
1385
1457
  modules;
1386
1458
  /** Stores the uniform values for each module */
1387
1459
  moduleUniforms;
@@ -1393,22 +1465,22 @@ var __exports__ = (() => {
1393
1465
  * Create a new UniformStore instance
1394
1466
  * @param modules
1395
1467
  */
1396
- // @ts-expect-error Fix typings
1397
- constructor(modules) {
1468
+ constructor(modules, options) {
1469
+ Object.assign(this.options, options);
1398
1470
  const resolvedModules = (0, import_shadertools.getShaderModuleDependencies)(
1399
1471
  Object.values(modules).filter((module) => module.dependencies)
1400
1472
  );
1401
1473
  for (const resolvedModule of resolvedModules) {
1402
1474
  modules[resolvedModule.name] = resolvedModule;
1403
1475
  }
1404
- import_core6.log.log(1, "Creating ShaderInputs with modules", Object.keys(modules))();
1476
+ import_core7.log.log(1, "Creating ShaderInputs with modules", Object.keys(modules))();
1405
1477
  this.modules = modules;
1406
1478
  this.moduleUniforms = {};
1407
1479
  this.moduleBindings = {};
1408
1480
  for (const [name, module] of Object.entries(modules)) {
1409
1481
  this._addModule(module);
1410
- if (module.name && name !== module.name) {
1411
- import_core6.log.warn(`Module name: ${name} vs ${module.name}`)();
1482
+ if (module.name && name !== module.name && !this.options.disableWarnings) {
1483
+ import_core7.log.warn(`Module name: ${name} vs ${module.name}`)();
1412
1484
  }
1413
1485
  }
1414
1486
  }
@@ -1424,7 +1496,9 @@ var __exports__ = (() => {
1424
1496
  const moduleProps = props[moduleName] || {};
1425
1497
  const module = this.modules[moduleName];
1426
1498
  if (!module) {
1427
- import_core6.log.warn(`Module ${name} not found`)();
1499
+ if (!this.options.disableWarnings) {
1500
+ import_core7.log.warn(`Module ${name} not found`)();
1501
+ }
1428
1502
  continue;
1429
1503
  }
1430
1504
  const oldUniforms = this.moduleUniforms[moduleName];
@@ -1476,7 +1550,7 @@ var __exports__ = (() => {
1476
1550
  };
1477
1551
 
1478
1552
  // src/async-texture/async-texture.ts
1479
- var import_core7 = __toESM(require_core(), 1);
1553
+ var import_core8 = __toESM(require_core(), 1);
1480
1554
 
1481
1555
  // src/application-utils/load-file.ts
1482
1556
  var pathPrefix = "";
@@ -1596,7 +1670,7 @@ var __exports__ = (() => {
1596
1670
  if (this.props.mipmaps) {
1597
1671
  this.generateMipmaps();
1598
1672
  }
1599
- import_core7.log.info(1, `${this} loaded`);
1673
+ import_core8.log.info(1, `${this} loaded`);
1600
1674
  }
1601
1675
  destroy() {
1602
1676
  if (this.texture) {
@@ -1611,7 +1685,7 @@ var __exports__ = (() => {
1611
1685
  /** Set sampler or create and set new Sampler from SamplerProps */
1612
1686
  setSampler(sampler = {}) {
1613
1687
  this.texture.setSampler(
1614
- sampler instanceof import_core7.Sampler ? sampler : this.device.createSampler(sampler)
1688
+ sampler instanceof import_core8.Sampler ? sampler : this.device.createSampler(sampler)
1615
1689
  );
1616
1690
  }
1617
1691
  /**
@@ -1694,7 +1768,7 @@ var __exports__ = (() => {
1694
1768
  }
1695
1769
  const lodArray = this._normalizeTextureData(lodData);
1696
1770
  if (lodArray.length > 1 && this.props.mipmaps !== false) {
1697
- import_core7.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();
1771
+ import_core8.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();
1698
1772
  }
1699
1773
  for (let mipLevel = 0; mipLevel < lodArray.length; mipLevel++) {
1700
1774
  const imageData = lodArray[mipLevel];
@@ -1754,7 +1828,7 @@ var __exports__ = (() => {
1754
1828
  /** Experimental */
1755
1829
  _setTextureCubeFaceData(texture, lodData, face, depth = 0) {
1756
1830
  if (Array.isArray(lodData) && lodData.length > 1 && this.props.mipmaps !== false) {
1757
- import_core7.log.warn(`${this.id} has mipmap and multiple LODs.`)();
1831
+ import_core8.log.warn(`${this.id} has mipmap and multiple LODs.`)();
1758
1832
  }
1759
1833
  const faceDepth = TextureCubeFaces.indexOf(face);
1760
1834
  this._setTexture2DData(lodData, faceDepth);
@@ -1788,7 +1862,7 @@ var __exports__ = (() => {
1788
1862
  };
1789
1863
  var AsyncTexture = _AsyncTexture;
1790
1864
  __publicField(AsyncTexture, "defaultProps", {
1791
- ...import_core7.Texture.defaultProps,
1865
+ ...import_core8.Texture.defaultProps,
1792
1866
  data: null,
1793
1867
  mipmaps: false
1794
1868
  });
@@ -1885,15 +1959,15 @@ var __exports__ = (() => {
1885
1959
  const moduleMap = Object.fromEntries(
1886
1960
  this.props.modules?.map((module) => [module.name, module]) || []
1887
1961
  );
1888
- this.setShaderInputs(props.shaderInputs || new ShaderInputs(moduleMap));
1962
+ const shaderInputs = props.shaderInputs || new ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
1963
+ this.setShaderInputs(shaderInputs);
1889
1964
  const platformInfo = getPlatformInfo(device);
1890
1965
  const modules = (
1891
- // @ts-expect-error shaderInputs is assigned in setShaderInputs above.
1966
+ // @ts-ignore shaderInputs is assigned in setShaderInputs above.
1892
1967
  (this.props.modules?.length > 0 ? this.props.modules : this.shaderInputs?.getModules()) || []
1893
1968
  );
1894
1969
  const isWebGPU = this.device.type === "webgpu";
1895
1970
  if (isWebGPU && this.props.source) {
1896
- this.props.shaderLayout ||= (0, import_shadertools2.getShaderLayoutFromWGSL)(this.props.source);
1897
1971
  const { source: source3, getUniforms: getUniforms2 } = this.props.shaderAssembler.assembleWGSLShader({
1898
1972
  platformInfo,
1899
1973
  ...this.props,
@@ -1901,6 +1975,7 @@ var __exports__ = (() => {
1901
1975
  });
1902
1976
  this.source = source3;
1903
1977
  this._getModuleUniforms = getUniforms2;
1978
+ this.props.shaderLayout ||= (0, import_shadertools2.getShaderLayoutFromWGSL)(this.source);
1904
1979
  } else {
1905
1980
  const { vs: vs3, fs: fs3, getUniforms: getUniforms2 } = this.props.shaderAssembler.assembleGLSLShaderPair({
1906
1981
  platformInfo,
@@ -1988,7 +2063,7 @@ var __exports__ = (() => {
1988
2063
  draw(renderPass) {
1989
2064
  const loadingBinding = this._areBindingsLoading();
1990
2065
  if (loadingBinding) {
1991
- import_core8.log.info(LOG_DRAW_PRIORITY, `>>> DRAWING ABORTED ${this.id}: ${loadingBinding} not loaded`)();
2066
+ import_core9.log.info(LOG_DRAW_PRIORITY, `>>> DRAWING ABORTED ${this.id}: ${loadingBinding} not loaded`)();
1992
2067
  return false;
1993
2068
  }
1994
2069
  try {
@@ -2046,7 +2121,7 @@ var __exports__ = (() => {
2046
2121
  const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);
2047
2122
  if (gpuGeometry) {
2048
2123
  this.setTopology(gpuGeometry.topology || "triangle-list");
2049
- const bufferLayoutHelper = new import_core8._BufferLayoutHelper(this.bufferLayout);
2124
+ const bufferLayoutHelper = new BufferLayoutHelper(this.bufferLayout);
2050
2125
  this.bufferLayout = bufferLayoutHelper.mergeBufferLayouts(
2051
2126
  gpuGeometry.bufferLayout,
2052
2127
  this.bufferLayout
@@ -2072,7 +2147,7 @@ var __exports__ = (() => {
2072
2147
  * @note Triggers a pipeline rebuild / pipeline cache fetch
2073
2148
  */
2074
2149
  setBufferLayout(bufferLayout) {
2075
- const bufferLayoutHelper = new import_core8._BufferLayoutHelper(this.bufferLayout);
2150
+ const bufferLayoutHelper = new BufferLayoutHelper(this.bufferLayout);
2076
2151
  this.bufferLayout = this._gpuGeometry ? bufferLayoutHelper.mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout) : bufferLayout;
2077
2152
  this._setPipelineNeedsUpdate("bufferLayout");
2078
2153
  this.pipeline = this._updatePipeline();
@@ -2118,7 +2193,7 @@ var __exports__ = (() => {
2118
2193
  /** Set the shader inputs */
2119
2194
  setShaderInputs(shaderInputs) {
2120
2195
  this.shaderInputs = shaderInputs;
2121
- this._uniformStore = new import_core8.UniformStore(this.shaderInputs.modules);
2196
+ this._uniformStore = new import_core9.UniformStore(this.shaderInputs.modules);
2122
2197
  for (const [moduleName, module] of Object.entries(this.shaderInputs.modules)) {
2123
2198
  if (shaderModuleHasUniforms(module)) {
2124
2199
  const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
@@ -2161,17 +2236,21 @@ var __exports__ = (() => {
2161
2236
  */
2162
2237
  setAttributes(buffers, options) {
2163
2238
  const disableWarnings = options?.disableWarnings ?? this.props.disableWarnings;
2164
- if (buffers.indices) {
2165
- import_core8.log.warn(
2239
+ if (buffers["indices"]) {
2240
+ import_core9.log.warn(
2166
2241
  `Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`
2167
2242
  )();
2168
2243
  }
2169
- const bufferLayoutHelper = new import_core8._BufferLayoutHelper(this.bufferLayout);
2244
+ this.bufferLayout = sortedBufferLayoutByShaderSourceLocations(
2245
+ this.pipeline.shaderLayout,
2246
+ this.bufferLayout
2247
+ );
2248
+ const bufferLayoutHelper = new BufferLayoutHelper(this.bufferLayout);
2170
2249
  for (const [bufferName, buffer] of Object.entries(buffers)) {
2171
2250
  const bufferLayout = bufferLayoutHelper.getBufferLayout(bufferName);
2172
2251
  if (!bufferLayout) {
2173
2252
  if (!disableWarnings) {
2174
- import_core8.log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
2253
+ import_core9.log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
2175
2254
  }
2176
2255
  continue;
2177
2256
  }
@@ -2180,12 +2259,13 @@ var __exports__ = (() => {
2180
2259
  for (const attributeName of attributeNames) {
2181
2260
  const attributeInfo = this._attributeInfos[attributeName];
2182
2261
  if (attributeInfo) {
2183
- this.vertexArray.setBuffer(attributeInfo.location, buffer);
2262
+ const location = this.device.type === "webgpu" ? bufferLayoutHelper.getBufferIndex(attributeInfo.bufferName) : attributeInfo.location;
2263
+ this.vertexArray.setBuffer(location, buffer);
2184
2264
  set = true;
2185
2265
  }
2186
2266
  }
2187
2267
  if (!set && !disableWarnings) {
2188
- import_core8.log.warn(
2268
+ import_core9.log.warn(
2189
2269
  `Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`
2190
2270
  )();
2191
2271
  }
@@ -2206,7 +2286,7 @@ var __exports__ = (() => {
2206
2286
  if (attributeInfo) {
2207
2287
  this.vertexArray.setConstantWebGL(attributeInfo.location, value);
2208
2288
  } else if (!(options?.disableWarnings ?? this.props.disableWarnings)) {
2209
- import_core8.log.warn(
2289
+ import_core9.log.warn(
2210
2290
  `Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`
2211
2291
  )();
2212
2292
  }
@@ -2241,16 +2321,16 @@ var __exports__ = (() => {
2241
2321
  _getBindingsUpdateTimestamp() {
2242
2322
  let timestamp = 0;
2243
2323
  for (const binding of Object.values(this.bindings)) {
2244
- if (binding instanceof import_core8.TextureView) {
2324
+ if (binding instanceof import_core9.TextureView) {
2245
2325
  timestamp = Math.max(timestamp, binding.texture.updateTimestamp);
2246
- } else if (binding instanceof import_core8.Buffer || binding instanceof import_core8.Texture) {
2326
+ } else if (binding instanceof import_core9.Buffer || binding instanceof import_core9.Texture) {
2247
2327
  timestamp = Math.max(timestamp, binding.updateTimestamp);
2248
2328
  } else if (binding instanceof AsyncTexture) {
2249
2329
  timestamp = binding.texture ? Math.max(timestamp, binding.texture.updateTimestamp) : (
2250
2330
  // The texture will become available in the future
2251
2331
  Infinity
2252
2332
  );
2253
- } else if (!(binding instanceof import_core8.Sampler)) {
2333
+ } else if (!(binding instanceof import_core9.Sampler)) {
2254
2334
  timestamp = Math.max(timestamp, binding.buffer.updateTimestamp);
2255
2335
  }
2256
2336
  }
@@ -2285,7 +2365,7 @@ var __exports__ = (() => {
2285
2365
  let prevShaderVs = null;
2286
2366
  let prevShaderFs = null;
2287
2367
  if (this.pipeline) {
2288
- import_core8.log.log(
2368
+ import_core9.log.log(
2289
2369
  1,
2290
2370
  `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`
2291
2371
  )();
@@ -2321,7 +2401,7 @@ var __exports__ = (() => {
2321
2401
  vs: vs3,
2322
2402
  fs: fs3
2323
2403
  });
2324
- this._attributeInfos = (0, import_core8.getAttributeInfosFromLayouts)(
2404
+ this._attributeInfos = (0, import_core9.getAttributeInfosFromLayouts)(
2325
2405
  this.pipeline.shaderLayout,
2326
2406
  this.bufferLayout
2327
2407
  );
@@ -2336,24 +2416,24 @@ var __exports__ = (() => {
2336
2416
  _lastLogTime = 0;
2337
2417
  _logOpen = false;
2338
2418
  _logDrawCallStart() {
2339
- const logDrawTimeout = import_core8.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT;
2340
- if (import_core8.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
2419
+ const logDrawTimeout = import_core9.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT;
2420
+ if (import_core9.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
2341
2421
  return;
2342
2422
  }
2343
2423
  this._lastLogTime = Date.now();
2344
2424
  this._logOpen = true;
2345
- import_core8.log.group(LOG_DRAW_PRIORITY, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core8.log.level <= 2 })();
2425
+ import_core9.log.group(LOG_DRAW_PRIORITY, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core9.log.level <= 2 })();
2346
2426
  }
2347
2427
  _logDrawCallEnd() {
2348
2428
  if (this._logOpen) {
2349
2429
  const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout, this.id);
2350
- import_core8.log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
2430
+ import_core9.log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
2351
2431
  const uniformTable = this.shaderInputs.getDebugTable();
2352
- import_core8.log.table(LOG_DRAW_PRIORITY, uniformTable)();
2432
+ import_core9.log.table(LOG_DRAW_PRIORITY, uniformTable)();
2353
2433
  const attributeTable = this._getAttributeDebugTable();
2354
- import_core8.log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();
2355
- import_core8.log.table(LOG_DRAW_PRIORITY, attributeTable)();
2356
- import_core8.log.groupEnd(LOG_DRAW_PRIORITY)();
2434
+ import_core9.log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();
2435
+ import_core9.log.table(LOG_DRAW_PRIORITY, attributeTable)();
2436
+ import_core9.log.groupEnd(LOG_DRAW_PRIORITY)();
2357
2437
  this._logOpen = false;
2358
2438
  }
2359
2439
  }
@@ -2382,7 +2462,7 @@ var __exports__ = (() => {
2382
2462
  if (this.vertexArray.indexBuffer) {
2383
2463
  const { indexBuffer } = this.vertexArray;
2384
2464
  const values = indexBuffer.indexType === "uint32" ? new Uint32Array(indexBuffer.debugData) : new Uint16Array(indexBuffer.debugData);
2385
- table.indices = {
2465
+ table["indices"] = {
2386
2466
  name: "indices",
2387
2467
  type: indexBuffer.indexType,
2388
2468
  values: values.toString()
@@ -2392,14 +2472,14 @@ var __exports__ = (() => {
2392
2472
  }
2393
2473
  // TODO - fix typing of luma data types
2394
2474
  _getBufferOrConstantValues(attribute, dataType) {
2395
- const TypedArrayConstructor = (0, import_core8.getTypedArrayFromDataType)(dataType);
2396
- const typedArray = attribute instanceof import_core8.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
2475
+ const TypedArrayConstructor = (0, import_core9.getTypedArrayConstructor)(dataType);
2476
+ const typedArray = attribute instanceof import_core9.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
2397
2477
  return typedArray.toString();
2398
2478
  }
2399
2479
  };
2400
2480
  var Model = _Model;
2401
2481
  __publicField(Model, "defaultProps", {
2402
- ...import_core8.RenderPipeline.defaultProps,
2482
+ ...import_core9.RenderPipeline.defaultProps,
2403
2483
  source: void 0,
2404
2484
  vs: null,
2405
2485
  fs: null,
@@ -2445,7 +2525,7 @@ var __exports__ = (() => {
2445
2525
  }
2446
2526
 
2447
2527
  // src/compute/buffer-transform.ts
2448
- var import_core9 = __toESM(require_core(), 1);
2528
+ var import_core10 = __toESM(require_core(), 1);
2449
2529
  var import_shadertools3 = __toESM(require_shadertools(), 1);
2450
2530
  var _BufferTransform = class {
2451
2531
  device;
@@ -2507,7 +2587,7 @@ var __exports__ = (() => {
2507
2587
  if (!result) {
2508
2588
  throw new Error("BufferTransform#getBuffer");
2509
2589
  }
2510
- if (result instanceof import_core9.Buffer) {
2590
+ if (result instanceof import_core10.Buffer) {
2511
2591
  return result.readAsync();
2512
2592
  }
2513
2593
  const { buffer, byteOffset = 0, byteLength = buffer.byteLength } = result;
@@ -2663,9 +2743,9 @@ var __exports__ = (() => {
2663
2743
  this.attributes[attributeName] = attribute;
2664
2744
  }
2665
2745
  }
2666
- if (this.indices && this.indices.isIndexed !== void 0) {
2746
+ if (this.indices && this.indices["isIndexed"] !== void 0) {
2667
2747
  this.indices = Object.assign({}, this.indices);
2668
- delete this.indices.isIndexed;
2748
+ delete this.indices["isIndexed"];
2669
2749
  }
2670
2750
  this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);
2671
2751
  }
@@ -5039,13 +5119,13 @@ void main(void) {
5039
5119
  };
5040
5120
 
5041
5121
  // src/scenegraph/group-node.ts
5042
- var import_core12 = __toESM(require_core(), 1);
5122
+ var import_core13 = __toESM(require_core(), 1);
5043
5123
  var GroupNode = class extends ScenegraphNode {
5044
5124
  children;
5045
5125
  constructor(props = {}) {
5046
5126
  props = Array.isArray(props) ? { children: props } : props;
5047
5127
  const { children = [] } = props;
5048
- import_core12.log.assert(
5128
+ import_core13.log.assert(
5049
5129
  children.every((child) => child instanceof ScenegraphNode),
5050
5130
  "every child must an instance of ScenegraphNode"
5051
5131
  );
@@ -6263,7 +6343,7 @@ void main(void) {
6263
6343
  var import_shadertools5 = __toESM(require_shadertools(), 1);
6264
6344
 
6265
6345
  // src/compute/swap.ts
6266
- var import_core14 = __toESM(require_core(), 1);
6346
+ var import_core15 = __toESM(require_core(), 1);
6267
6347
  var Swap = class {
6268
6348
  /** The current resource - usually the source for renders or computations */
6269
6349
  current;
@@ -6291,7 +6371,7 @@ void main(void) {
6291
6371
  let colorAttachments = props.colorAttachments?.map(
6292
6372
  (colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
6293
6373
  format: colorAttachment,
6294
- usage: import_core14.Texture.SAMPLE | import_core14.Texture.RENDER | import_core14.Texture.COPY_SRC | import_core14.Texture.COPY_DST,
6374
+ usage: import_core15.Texture.SAMPLE | import_core15.Texture.RENDER | import_core15.Texture.COPY_SRC | import_core15.Texture.COPY_DST,
6295
6375
  width: 1,
6296
6376
  height: 1
6297
6377
  })
@@ -6300,7 +6380,7 @@ void main(void) {
6300
6380
  colorAttachments = props.colorAttachments?.map(
6301
6381
  (colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
6302
6382
  format: colorAttachment,
6303
- usage: import_core14.Texture.TEXTURE | import_core14.Texture.COPY_SRC | import_core14.Texture.COPY_DST | import_core14.Texture.RENDER_ATTACHMENT,
6383
+ usage: import_core15.Texture.TEXTURE | import_core15.Texture.COPY_SRC | import_core15.Texture.COPY_DST | import_core15.Texture.RENDER_ATTACHMENT,
6304
6384
  width: 1,
6305
6385
  height: 1
6306
6386
  })
@@ -6644,7 +6724,7 @@ void main() {
6644
6724
  };
6645
6725
 
6646
6726
  // src/compute/computation.ts
6647
- var import_core15 = __toESM(require_core(), 1);
6727
+ var import_core16 = __toESM(require_core(), 1);
6648
6728
  var import_shadertools6 = __toESM(require_shadertools(), 1);
6649
6729
  var LOG_DRAW_PRIORITY2 = 2;
6650
6730
  var LOG_DRAW_TIMEOUT2 = 1e4;
@@ -6743,7 +6823,7 @@ void main() {
6743
6823
  }
6744
6824
  setShaderInputs(shaderInputs) {
6745
6825
  this.shaderInputs = shaderInputs;
6746
- this._uniformStore = new import_core15.UniformStore(this.shaderInputs.modules);
6826
+ this._uniformStore = new import_core16.UniformStore(this.shaderInputs.modules);
6747
6827
  for (const moduleName of Object.keys(this.shaderInputs.modules)) {
6748
6828
  const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
6749
6829
  this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
@@ -6780,7 +6860,7 @@ void main() {
6780
6860
  if (this._pipelineNeedsUpdate) {
6781
6861
  let prevShader = null;
6782
6862
  if (this.pipeline) {
6783
- import_core15.log.log(
6863
+ import_core16.log.log(
6784
6864
  1,
6785
6865
  `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`
6786
6866
  )();
@@ -6807,33 +6887,33 @@ void main() {
6807
6887
  _lastLogTime = 0;
6808
6888
  _logOpen = false;
6809
6889
  _logDrawCallStart() {
6810
- const logDrawTimeout = import_core15.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT2;
6811
- if (import_core15.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
6890
+ const logDrawTimeout = import_core16.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT2;
6891
+ if (import_core16.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
6812
6892
  return;
6813
6893
  }
6814
6894
  this._lastLogTime = Date.now();
6815
6895
  this._logOpen = true;
6816
- import_core15.log.group(LOG_DRAW_PRIORITY2, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core15.log.level <= 2 })();
6896
+ import_core16.log.group(LOG_DRAW_PRIORITY2, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core16.log.level <= 2 })();
6817
6897
  }
6818
6898
  _logDrawCallEnd() {
6819
6899
  if (this._logOpen) {
6820
6900
  const uniformTable = this.shaderInputs.getDebugTable();
6821
- import_core15.log.table(LOG_DRAW_PRIORITY2, uniformTable)();
6822
- import_core15.log.groupEnd(LOG_DRAW_PRIORITY2)();
6901
+ import_core16.log.table(LOG_DRAW_PRIORITY2, uniformTable)();
6902
+ import_core16.log.groupEnd(LOG_DRAW_PRIORITY2)();
6823
6903
  this._logOpen = false;
6824
6904
  }
6825
6905
  }
6826
6906
  _drawCount = 0;
6827
6907
  // TODO - fix typing of luma data types
6828
6908
  _getBufferOrConstantValues(attribute, dataType) {
6829
- const TypedArrayConstructor = (0, import_core15.getTypedArrayFromDataType)(dataType);
6830
- const typedArray = attribute instanceof import_core15.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
6909
+ const TypedArrayConstructor = (0, import_core16.getTypedArrayConstructor)(dataType);
6910
+ const typedArray = attribute instanceof import_core16.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
6831
6911
  return typedArray.toString();
6832
6912
  }
6833
6913
  };
6834
6914
  var Computation = _Computation;
6835
6915
  __publicField(Computation, "defaultProps", {
6836
- ...import_core15.ComputePipeline.defaultProps,
6916
+ ...import_core16.ComputePipeline.defaultProps,
6837
6917
  id: "unnamed",
6838
6918
  handle: void 0,
6839
6919
  userData: {},
@@ -6993,7 +7073,7 @@ uniform pickingUniforms {
6993
7073
  });
6994
7074
  return pickingPass;
6995
7075
  }
6996
- getPickInfo(mousePosition) {
7076
+ async updatePickInfo(mousePosition) {
6997
7077
  const framebuffer = this.getFramebuffer();
6998
7078
  const [pickX, pickY] = this.getPickPosition(mousePosition);
6999
7079
  const pixelData = this.device.readPixelsToArrayWebGL(framebuffer, {