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

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/index.cjs CHANGED
@@ -301,21 +301,9 @@ var _AnimationLoop = class {
301
301
  delete() {
302
302
  this.destroy();
303
303
  }
304
- setError(error) {
305
- var _a;
304
+ reportError(error) {
306
305
  this.props.onError(error);
307
- this._error = Error();
308
- const canvas2 = (_a = this.device) == null ? void 0 : _a.getDefaultCanvasContext().canvas;
309
- if (canvas2 instanceof HTMLCanvasElement) {
310
- const errorDiv = document.createElement("h1");
311
- errorDiv.innerHTML = error.message;
312
- errorDiv.style.position = "absolute";
313
- errorDiv.style.top = "20%";
314
- errorDiv.style.left = "10px";
315
- errorDiv.style.color = "black";
316
- errorDiv.style.backgroundColor = "red";
317
- document.body.appendChild(errorDiv);
318
- }
306
+ this._error = error;
319
307
  }
320
308
  /** Flags this animation loop as needing redraw */
321
309
  setNeedsRedraw(reason) {
@@ -639,8 +627,14 @@ function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
639
627
  ...props,
640
628
  device,
641
629
  async onInitialize(animationProps) {
642
- renderLoop = new AnimationLoopTemplateCtor(animationProps);
643
- return await (renderLoop == null ? void 0 : renderLoop.onInitialize(animationProps));
630
+ clearError(animationProps.animationLoop.device);
631
+ try {
632
+ renderLoop = new AnimationLoopTemplateCtor(animationProps);
633
+ return await (renderLoop == null ? void 0 : renderLoop.onInitialize(animationProps));
634
+ } catch (error) {
635
+ setError(animationProps.animationLoop.device, error);
636
+ return null;
637
+ }
644
638
  },
645
639
  onRender: (animationProps) => renderLoop == null ? void 0 : renderLoop.onRender(animationProps),
646
640
  onFinalize: (animationProps) => renderLoop == null ? void 0 : renderLoop.onFinalize(animationProps)
@@ -650,9 +644,33 @@ function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
650
644
  };
651
645
  return animationLoop;
652
646
  }
647
+ function setError(device, error) {
648
+ var _a;
649
+ const canvas2 = device == null ? void 0 : device.getDefaultCanvasContext().canvas;
650
+ if (canvas2 instanceof HTMLCanvasElement) {
651
+ canvas2.style.overflow = "visible";
652
+ let errorDiv = document.getElementById("animation-loop-error");
653
+ errorDiv == null ? void 0 : errorDiv.remove();
654
+ errorDiv = document.createElement("h1");
655
+ errorDiv.id = "animation-loop-error";
656
+ errorDiv.innerHTML = error.message;
657
+ errorDiv.style.position = "absolute";
658
+ errorDiv.style.top = "10px";
659
+ errorDiv.style.left = "10px";
660
+ errorDiv.style.color = "black";
661
+ errorDiv.style.backgroundColor = "red";
662
+ (_a = canvas2.parentElement) == null ? void 0 : _a.appendChild(errorDiv);
663
+ }
664
+ }
665
+ function clearError(device) {
666
+ const errorDiv = document.getElementById("animation-loop-error");
667
+ if (errorDiv) {
668
+ errorDiv.remove();
669
+ }
670
+ }
653
671
 
654
672
  // dist/model/model.js
655
- var import_core8 = require("@luma.gl/core");
673
+ var import_core9 = require("@luma.gl/core");
656
674
  var import_shadertools2 = require("@luma.gl/shadertools");
657
675
 
658
676
  // dist/geometry/gpu-geometry.js
@@ -768,8 +786,8 @@ var import_core4 = require("@luma.gl/core");
768
786
  var _PipelineFactory = class {
769
787
  /** Get the singleton default pipeline factory for the specified device */
770
788
  static getDefaultPipelineFactory(device) {
771
- device._lumaData.defaultPipelineFactory = device._lumaData.defaultPipelineFactory || new _PipelineFactory(device);
772
- return device._lumaData.defaultPipelineFactory;
789
+ device._lumaData["defaultPipelineFactory"] = device._lumaData["defaultPipelineFactory"] || new _PipelineFactory(device);
790
+ return device._lumaData["defaultPipelineFactory"];
773
791
  }
774
792
  device;
775
793
  cachingEnabled;
@@ -934,8 +952,8 @@ var import_core5 = require("@luma.gl/core");
934
952
  var _ShaderFactory = class {
935
953
  /** Returns the default ShaderFactory for the given {@link Device}, creating one if necessary. */
936
954
  static getDefaultShaderFactory(device) {
937
- device._lumaData.defaultShaderFactory ||= new _ShaderFactory(device);
938
- return device._lumaData.defaultShaderFactory;
955
+ device._lumaData["defaultShaderFactory"] ||= new _ShaderFactory(device);
956
+ return device._lumaData["defaultShaderFactory"];
939
957
  }
940
958
  device;
941
959
  cachingEnabled;
@@ -1111,8 +1129,58 @@ function deepEqual(a, b, depth) {
1111
1129
  return false;
1112
1130
  }
1113
1131
 
1114
- // dist/shader-inputs.js
1132
+ // dist/utils/buffer-layout-helper.js
1115
1133
  var import_core6 = require("@luma.gl/core");
1134
+ var BufferLayoutHelper = class {
1135
+ bufferLayouts;
1136
+ constructor(bufferLayouts) {
1137
+ this.bufferLayouts = bufferLayouts;
1138
+ }
1139
+ getBufferLayout(name) {
1140
+ return this.bufferLayouts.find((layout) => layout.name === name) || null;
1141
+ }
1142
+ /** Get attribute names from a BufferLayout */
1143
+ getAttributeNamesForBuffer(bufferLayout) {
1144
+ var _a;
1145
+ return bufferLayout.attributes ? (_a = bufferLayout.attributes) == null ? void 0 : _a.map((layout) => layout.attribute) : [bufferLayout.name];
1146
+ }
1147
+ mergeBufferLayouts(bufferLayouts1, bufferLayouts2) {
1148
+ const mergedLayouts = [...bufferLayouts1];
1149
+ for (const attribute of bufferLayouts2) {
1150
+ const index = mergedLayouts.findIndex((attribute2) => attribute2.name === attribute.name);
1151
+ if (index < 0) {
1152
+ mergedLayouts.push(attribute);
1153
+ } else {
1154
+ mergedLayouts[index] = attribute;
1155
+ }
1156
+ }
1157
+ return mergedLayouts;
1158
+ }
1159
+ getBufferIndex(bufferName) {
1160
+ const bufferIndex = this.bufferLayouts.findIndex((layout) => layout.name === bufferName);
1161
+ if (bufferIndex === -1) {
1162
+ import_core6.log.warn(`BufferLayout: Missing buffer for "${bufferName}".`)();
1163
+ }
1164
+ return bufferIndex;
1165
+ }
1166
+ };
1167
+
1168
+ // dist/utils/buffer-layout-order.js
1169
+ function sortedBufferLayoutByShaderSourceLocations(shaderLayout, bufferLayout) {
1170
+ const shaderLayoutMap = Object.fromEntries(shaderLayout.attributes.map((attr) => [attr.name, attr.location]));
1171
+ const sortedLayout = bufferLayout.slice();
1172
+ sortedLayout.sort((a, b) => {
1173
+ const attributeNamesA = a.attributes ? a.attributes.map((attr) => attr.attribute) : [a.name];
1174
+ const attributeNamesB = b.attributes ? b.attributes.map((attr) => attr.attribute) : [b.name];
1175
+ const minLocationA = Math.min(...attributeNamesA.map((name) => shaderLayoutMap[name]));
1176
+ const minLocationB = Math.min(...attributeNamesB.map((name) => shaderLayoutMap[name]));
1177
+ return minLocationA - minLocationB;
1178
+ });
1179
+ return sortedLayout;
1180
+ }
1181
+
1182
+ // dist/shader-inputs.js
1183
+ var import_core7 = require("@luma.gl/core");
1116
1184
  var import_shadertools = require("@luma.gl/shadertools");
1117
1185
 
1118
1186
  // dist/model/split-uniforms-and-bindings.js
@@ -1135,11 +1203,14 @@ function splitUniformsAndBindings(uniforms) {
1135
1203
 
1136
1204
  // dist/shader-inputs.js
1137
1205
  var ShaderInputs = class {
1206
+ options = {
1207
+ disableWarnings: false
1208
+ };
1138
1209
  /**
1139
1210
  * The map of modules
1140
1211
  * @todo should should this include the resolved dependencies?
1141
1212
  */
1142
- // @ts-expect-error Fix typings
1213
+ // @ts-ignore Fix typings
1143
1214
  modules;
1144
1215
  /** Stores the uniform values for each module */
1145
1216
  moduleUniforms;
@@ -1151,20 +1222,20 @@ var ShaderInputs = class {
1151
1222
  * Create a new UniformStore instance
1152
1223
  * @param modules
1153
1224
  */
1154
- // @ts-expect-error Fix typings
1155
- constructor(modules) {
1225
+ constructor(modules, options) {
1226
+ Object.assign(this.options, options);
1156
1227
  const resolvedModules = (0, import_shadertools.getShaderModuleDependencies)(Object.values(modules).filter((module2) => module2.dependencies));
1157
1228
  for (const resolvedModule of resolvedModules) {
1158
1229
  modules[resolvedModule.name] = resolvedModule;
1159
1230
  }
1160
- import_core6.log.log(1, "Creating ShaderInputs with modules", Object.keys(modules))();
1231
+ import_core7.log.log(1, "Creating ShaderInputs with modules", Object.keys(modules))();
1161
1232
  this.modules = modules;
1162
1233
  this.moduleUniforms = {};
1163
1234
  this.moduleBindings = {};
1164
1235
  for (const [name, module2] of Object.entries(modules)) {
1165
1236
  this._addModule(module2);
1166
- if (module2.name && name !== module2.name) {
1167
- import_core6.log.warn(`Module name: ${name} vs ${module2.name}`)();
1237
+ if (module2.name && name !== module2.name && !this.options.disableWarnings) {
1238
+ import_core7.log.warn(`Module name: ${name} vs ${module2.name}`)();
1168
1239
  }
1169
1240
  }
1170
1241
  }
@@ -1181,7 +1252,9 @@ var ShaderInputs = class {
1181
1252
  const moduleProps = props[moduleName] || {};
1182
1253
  const module2 = this.modules[moduleName];
1183
1254
  if (!module2) {
1184
- import_core6.log.warn(`Module ${name} not found`)();
1255
+ if (!this.options.disableWarnings) {
1256
+ import_core7.log.warn(`Module ${name} not found`)();
1257
+ }
1185
1258
  continue;
1186
1259
  }
1187
1260
  const oldUniforms = this.moduleUniforms[moduleName];
@@ -1234,7 +1307,7 @@ var ShaderInputs = class {
1234
1307
  };
1235
1308
 
1236
1309
  // dist/async-texture/async-texture.js
1237
- var import_core7 = require("@luma.gl/core");
1310
+ var import_core8 = require("@luma.gl/core");
1238
1311
 
1239
1312
  // dist/application-utils/load-file.js
1240
1313
  var pathPrefix = "";
@@ -1354,7 +1427,7 @@ var _AsyncTexture = class {
1354
1427
  if (this.props.mipmaps) {
1355
1428
  this.generateMipmaps();
1356
1429
  }
1357
- import_core7.log.info(1, `${this} loaded`);
1430
+ import_core8.log.info(1, `${this} loaded`);
1358
1431
  }
1359
1432
  destroy() {
1360
1433
  if (this.texture) {
@@ -1368,7 +1441,7 @@ var _AsyncTexture = class {
1368
1441
  }
1369
1442
  /** Set sampler or create and set new Sampler from SamplerProps */
1370
1443
  setSampler(sampler = {}) {
1371
- this.texture.setSampler(sampler instanceof import_core7.Sampler ? sampler : this.device.createSampler(sampler));
1444
+ this.texture.setSampler(sampler instanceof import_core8.Sampler ? sampler : this.device.createSampler(sampler));
1372
1445
  }
1373
1446
  /**
1374
1447
  * Textures are immutable and cannot be resized after creation,
@@ -1450,7 +1523,7 @@ var _AsyncTexture = class {
1450
1523
  }
1451
1524
  const lodArray = this._normalizeTextureData(lodData);
1452
1525
  if (lodArray.length > 1 && this.props.mipmaps !== false) {
1453
- import_core7.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();
1526
+ import_core8.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();
1454
1527
  }
1455
1528
  for (let mipLevel = 0; mipLevel < lodArray.length; mipLevel++) {
1456
1529
  const imageData = lodArray[mipLevel];
@@ -1513,7 +1586,7 @@ var _AsyncTexture = class {
1513
1586
  /** Experimental */
1514
1587
  _setTextureCubeFaceData(texture, lodData, face, depth = 0) {
1515
1588
  if (Array.isArray(lodData) && lodData.length > 1 && this.props.mipmaps !== false) {
1516
- import_core7.log.warn(`${this.id} has mipmap and multiple LODs.`)();
1589
+ import_core8.log.warn(`${this.id} has mipmap and multiple LODs.`)();
1517
1590
  }
1518
1591
  const faceDepth = TextureCubeFaces.indexOf(face);
1519
1592
  this._setTexture2DData(lodData, faceDepth);
@@ -1547,7 +1620,7 @@ var _AsyncTexture = class {
1547
1620
  };
1548
1621
  var AsyncTexture = _AsyncTexture;
1549
1622
  __publicField(AsyncTexture, "defaultProps", {
1550
- ...import_core7.Texture.defaultProps,
1623
+ ...import_core8.Texture.defaultProps,
1551
1624
  data: null,
1552
1625
  mipmaps: false
1553
1626
  });
@@ -1643,15 +1716,15 @@ var _Model = class {
1643
1716
  this.device = device;
1644
1717
  Object.assign(this.userData, props.userData);
1645
1718
  const moduleMap = Object.fromEntries(((_a = this.props.modules) == null ? void 0 : _a.map((module2) => [module2.name, module2])) || []);
1646
- this.setShaderInputs(props.shaderInputs || new ShaderInputs(moduleMap));
1719
+ const shaderInputs = props.shaderInputs || new ShaderInputs(moduleMap, { disableWarnings: this.props.disableWarnings });
1720
+ this.setShaderInputs(shaderInputs);
1647
1721
  const platformInfo = getPlatformInfo(device);
1648
1722
  const modules = (
1649
- // @ts-expect-error shaderInputs is assigned in setShaderInputs above.
1723
+ // @ts-ignore shaderInputs is assigned in setShaderInputs above.
1650
1724
  (((_b = this.props.modules) == null ? void 0 : _b.length) > 0 ? this.props.modules : (_c = this.shaderInputs) == null ? void 0 : _c.getModules()) || []
1651
1725
  );
1652
1726
  const isWebGPU = this.device.type === "webgpu";
1653
1727
  if (isWebGPU && this.props.source) {
1654
- this.props.shaderLayout ||= (0, import_shadertools2.getShaderLayoutFromWGSL)(this.props.source);
1655
1728
  const { source: source3, getUniforms: getUniforms2 } = this.props.shaderAssembler.assembleWGSLShader({
1656
1729
  platformInfo,
1657
1730
  ...this.props,
@@ -1659,6 +1732,7 @@ var _Model = class {
1659
1732
  });
1660
1733
  this.source = source3;
1661
1734
  this._getModuleUniforms = getUniforms2;
1735
+ this.props.shaderLayout ||= (0, import_shadertools2.getShaderLayoutFromWGSL)(this.source);
1662
1736
  } else {
1663
1737
  const { vs: vs3, fs: fs3, getUniforms: getUniforms2 } = this.props.shaderAssembler.assembleGLSLShaderPair({
1664
1738
  platformInfo,
@@ -1747,7 +1821,7 @@ var _Model = class {
1747
1821
  draw(renderPass) {
1748
1822
  const loadingBinding = this._areBindingsLoading();
1749
1823
  if (loadingBinding) {
1750
- import_core8.log.info(LOG_DRAW_PRIORITY, `>>> DRAWING ABORTED ${this.id}: ${loadingBinding} not loaded`)();
1824
+ import_core9.log.info(LOG_DRAW_PRIORITY, `>>> DRAWING ABORTED ${this.id}: ${loadingBinding} not loaded`)();
1751
1825
  return false;
1752
1826
  }
1753
1827
  try {
@@ -1806,7 +1880,7 @@ var _Model = class {
1806
1880
  const gpuGeometry = geometry && makeGPUGeometry(this.device, geometry);
1807
1881
  if (gpuGeometry) {
1808
1882
  this.setTopology(gpuGeometry.topology || "triangle-list");
1809
- const bufferLayoutHelper = new import_core8._BufferLayoutHelper(this.bufferLayout);
1883
+ const bufferLayoutHelper = new BufferLayoutHelper(this.bufferLayout);
1810
1884
  this.bufferLayout = bufferLayoutHelper.mergeBufferLayouts(gpuGeometry.bufferLayout, this.bufferLayout);
1811
1885
  if (this.vertexArray) {
1812
1886
  this._setGeometryAttributes(gpuGeometry);
@@ -1829,7 +1903,7 @@ var _Model = class {
1829
1903
  * @note Triggers a pipeline rebuild / pipeline cache fetch
1830
1904
  */
1831
1905
  setBufferLayout(bufferLayout) {
1832
- const bufferLayoutHelper = new import_core8._BufferLayoutHelper(this.bufferLayout);
1906
+ const bufferLayoutHelper = new BufferLayoutHelper(this.bufferLayout);
1833
1907
  this.bufferLayout = this._gpuGeometry ? bufferLayoutHelper.mergeBufferLayouts(bufferLayout, this._gpuGeometry.bufferLayout) : bufferLayout;
1834
1908
  this._setPipelineNeedsUpdate("bufferLayout");
1835
1909
  this.pipeline = this._updatePipeline();
@@ -1875,7 +1949,7 @@ var _Model = class {
1875
1949
  /** Set the shader inputs */
1876
1950
  setShaderInputs(shaderInputs) {
1877
1951
  this.shaderInputs = shaderInputs;
1878
- this._uniformStore = new import_core8.UniformStore(this.shaderInputs.modules);
1952
+ this._uniformStore = new import_core9.UniformStore(this.shaderInputs.modules);
1879
1953
  for (const [moduleName, module2] of Object.entries(this.shaderInputs.modules)) {
1880
1954
  if (shaderModuleHasUniforms(module2)) {
1881
1955
  const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
@@ -1918,15 +1992,16 @@ var _Model = class {
1918
1992
  */
1919
1993
  setAttributes(buffers, options) {
1920
1994
  const disableWarnings = (options == null ? void 0 : options.disableWarnings) ?? this.props.disableWarnings;
1921
- if (buffers.indices) {
1922
- import_core8.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();
1995
+ if (buffers["indices"]) {
1996
+ import_core9.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();
1923
1997
  }
1924
- const bufferLayoutHelper = new import_core8._BufferLayoutHelper(this.bufferLayout);
1998
+ this.bufferLayout = sortedBufferLayoutByShaderSourceLocations(this.pipeline.shaderLayout, this.bufferLayout);
1999
+ const bufferLayoutHelper = new BufferLayoutHelper(this.bufferLayout);
1925
2000
  for (const [bufferName, buffer] of Object.entries(buffers)) {
1926
2001
  const bufferLayout = bufferLayoutHelper.getBufferLayout(bufferName);
1927
2002
  if (!bufferLayout) {
1928
2003
  if (!disableWarnings) {
1929
- import_core8.log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
2004
+ import_core9.log.warn(`Model(${this.id}): Missing layout for buffer "${bufferName}".`)();
1930
2005
  }
1931
2006
  continue;
1932
2007
  }
@@ -1935,12 +2010,13 @@ var _Model = class {
1935
2010
  for (const attributeName of attributeNames) {
1936
2011
  const attributeInfo = this._attributeInfos[attributeName];
1937
2012
  if (attributeInfo) {
1938
- this.vertexArray.setBuffer(attributeInfo.location, buffer);
2013
+ const location = this.device.type === "webgpu" ? bufferLayoutHelper.getBufferIndex(attributeInfo.bufferName) : attributeInfo.location;
2014
+ this.vertexArray.setBuffer(location, buffer);
1939
2015
  set = true;
1940
2016
  }
1941
2017
  }
1942
2018
  if (!set && !disableWarnings) {
1943
- import_core8.log.warn(`Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`)();
2019
+ import_core9.log.warn(`Model(${this.id}): Ignoring buffer "${buffer.id}" for unknown attribute "${bufferName}"`)();
1944
2020
  }
1945
2021
  }
1946
2022
  this.setNeedsRedraw("attributes");
@@ -1959,7 +2035,7 @@ var _Model = class {
1959
2035
  if (attributeInfo) {
1960
2036
  this.vertexArray.setConstantWebGL(attributeInfo.location, value);
1961
2037
  } else if (!((options == null ? void 0 : options.disableWarnings) ?? this.props.disableWarnings)) {
1962
- import_core8.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`)();
2038
+ import_core9.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${attributeName}"`)();
1963
2039
  }
1964
2040
  }
1965
2041
  this.setNeedsRedraw("constants");
@@ -1992,16 +2068,16 @@ var _Model = class {
1992
2068
  _getBindingsUpdateTimestamp() {
1993
2069
  let timestamp = 0;
1994
2070
  for (const binding of Object.values(this.bindings)) {
1995
- if (binding instanceof import_core8.TextureView) {
2071
+ if (binding instanceof import_core9.TextureView) {
1996
2072
  timestamp = Math.max(timestamp, binding.texture.updateTimestamp);
1997
- } else if (binding instanceof import_core8.Buffer || binding instanceof import_core8.Texture) {
2073
+ } else if (binding instanceof import_core9.Buffer || binding instanceof import_core9.Texture) {
1998
2074
  timestamp = Math.max(timestamp, binding.updateTimestamp);
1999
2075
  } else if (binding instanceof AsyncTexture) {
2000
2076
  timestamp = binding.texture ? Math.max(timestamp, binding.texture.updateTimestamp) : (
2001
2077
  // The texture will become available in the future
2002
2078
  Infinity
2003
2079
  );
2004
- } else if (!(binding instanceof import_core8.Sampler)) {
2080
+ } else if (!(binding instanceof import_core9.Sampler)) {
2005
2081
  timestamp = Math.max(timestamp, binding.buffer.updateTimestamp);
2006
2082
  }
2007
2083
  }
@@ -2036,7 +2112,7 @@ var _Model = class {
2036
2112
  let prevShaderVs = null;
2037
2113
  let prevShaderFs = null;
2038
2114
  if (this.pipeline) {
2039
- import_core8.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
2115
+ import_core9.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
2040
2116
  prevShaderVs = this.pipeline.vs;
2041
2117
  prevShaderFs = this.pipeline.fs;
2042
2118
  }
@@ -2069,7 +2145,7 @@ var _Model = class {
2069
2145
  vs: vs3,
2070
2146
  fs: fs3
2071
2147
  });
2072
- this._attributeInfos = (0, import_core8.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout, this.bufferLayout);
2148
+ this._attributeInfos = (0, import_core9.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout, this.bufferLayout);
2073
2149
  if (prevShaderVs)
2074
2150
  this.shaderFactory.release(prevShaderVs);
2075
2151
  if (prevShaderFs)
@@ -2081,24 +2157,24 @@ var _Model = class {
2081
2157
  _lastLogTime = 0;
2082
2158
  _logOpen = false;
2083
2159
  _logDrawCallStart() {
2084
- const logDrawTimeout = import_core8.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT;
2085
- if (import_core8.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
2160
+ const logDrawTimeout = import_core9.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT;
2161
+ if (import_core9.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
2086
2162
  return;
2087
2163
  }
2088
2164
  this._lastLogTime = Date.now();
2089
2165
  this._logOpen = true;
2090
- import_core8.log.group(LOG_DRAW_PRIORITY, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core8.log.level <= 2 })();
2166
+ import_core9.log.group(LOG_DRAW_PRIORITY, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core9.log.level <= 2 })();
2091
2167
  }
2092
2168
  _logDrawCallEnd() {
2093
2169
  if (this._logOpen) {
2094
2170
  const shaderLayoutTable = getDebugTableForShaderLayout(this.pipeline.shaderLayout, this.id);
2095
- import_core8.log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
2171
+ import_core9.log.table(LOG_DRAW_PRIORITY, shaderLayoutTable)();
2096
2172
  const uniformTable = this.shaderInputs.getDebugTable();
2097
- import_core8.log.table(LOG_DRAW_PRIORITY, uniformTable)();
2173
+ import_core9.log.table(LOG_DRAW_PRIORITY, uniformTable)();
2098
2174
  const attributeTable = this._getAttributeDebugTable();
2099
- import_core8.log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();
2100
- import_core8.log.table(LOG_DRAW_PRIORITY, attributeTable)();
2101
- import_core8.log.groupEnd(LOG_DRAW_PRIORITY)();
2175
+ import_core9.log.table(LOG_DRAW_PRIORITY, this._attributeInfos)();
2176
+ import_core9.log.table(LOG_DRAW_PRIORITY, attributeTable)();
2177
+ import_core9.log.groupEnd(LOG_DRAW_PRIORITY)();
2102
2178
  this._logOpen = false;
2103
2179
  }
2104
2180
  }
@@ -2127,7 +2203,7 @@ var _Model = class {
2127
2203
  if (this.vertexArray.indexBuffer) {
2128
2204
  const { indexBuffer } = this.vertexArray;
2129
2205
  const values = indexBuffer.indexType === "uint32" ? new Uint32Array(indexBuffer.debugData) : new Uint16Array(indexBuffer.debugData);
2130
- table.indices = {
2206
+ table["indices"] = {
2131
2207
  name: "indices",
2132
2208
  type: indexBuffer.indexType,
2133
2209
  values: values.toString()
@@ -2137,14 +2213,14 @@ var _Model = class {
2137
2213
  }
2138
2214
  // TODO - fix typing of luma data types
2139
2215
  _getBufferOrConstantValues(attribute, dataType) {
2140
- const TypedArrayConstructor = (0, import_core8.getTypedArrayFromDataType)(dataType);
2141
- const typedArray = attribute instanceof import_core8.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
2216
+ const TypedArrayConstructor = (0, import_core9.getTypedArrayConstructor)(dataType);
2217
+ const typedArray = attribute instanceof import_core9.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
2142
2218
  return typedArray.toString();
2143
2219
  }
2144
2220
  };
2145
2221
  var Model = _Model;
2146
2222
  __publicField(Model, "defaultProps", {
2147
- ...import_core8.RenderPipeline.defaultProps,
2223
+ ...import_core9.RenderPipeline.defaultProps,
2148
2224
  source: void 0,
2149
2225
  vs: null,
2150
2226
  fs: null,
@@ -2190,7 +2266,7 @@ function isObjectEmpty(obj) {
2190
2266
  }
2191
2267
 
2192
2268
  // dist/compute/buffer-transform.js
2193
- var import_core9 = require("@luma.gl/core");
2269
+ var import_core10 = require("@luma.gl/core");
2194
2270
  var import_shadertools3 = require("@luma.gl/shadertools");
2195
2271
  var _BufferTransform = class {
2196
2272
  device;
@@ -2253,7 +2329,7 @@ var _BufferTransform = class {
2253
2329
  if (!result) {
2254
2330
  throw new Error("BufferTransform#getBuffer");
2255
2331
  }
2256
- if (result instanceof import_core9.Buffer) {
2332
+ if (result instanceof import_core10.Buffer) {
2257
2333
  return result.readAsync();
2258
2334
  }
2259
2335
  const { buffer, byteOffset = 0, byteLength = buffer.byteLength } = result;
@@ -2408,9 +2484,9 @@ var Geometry = class {
2408
2484
  this.attributes[attributeName] = attribute;
2409
2485
  }
2410
2486
  }
2411
- if (this.indices && this.indices.isIndexed !== void 0) {
2487
+ if (this.indices && this.indices["isIndexed"] !== void 0) {
2412
2488
  this.indices = Object.assign({}, this.indices);
2413
- delete this.indices.isIndexed;
2489
+ delete this.indices["isIndexed"];
2414
2490
  }
2415
2491
  this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);
2416
2492
  }
@@ -2606,14 +2682,14 @@ var BackgroundTextureModel = class extends ClipSpace {
2606
2682
  };
2607
2683
 
2608
2684
  // dist/scenegraph/scenegraph-node.js
2609
- var import_core10 = require("@math.gl/core");
2685
+ var import_core11 = require("@math.gl/core");
2610
2686
  var ScenegraphNode = class {
2611
2687
  id;
2612
- matrix = new import_core10.Matrix4();
2688
+ matrix = new import_core11.Matrix4();
2613
2689
  display = true;
2614
- position = new import_core10.Vector3();
2615
- rotation = new import_core10.Vector3();
2616
- scale = new import_core10.Vector3(1, 1, 1);
2690
+ position = new import_core11.Vector3();
2691
+ rotation = new import_core11.Vector3();
2692
+ scale = new import_core11.Vector3(1, 1, 1);
2617
2693
  userData = {};
2618
2694
  props = {};
2619
2695
  constructor(props = {}) {
@@ -2698,7 +2774,7 @@ var ScenegraphNode = class {
2698
2774
  }
2699
2775
  getCoordinateUniforms(viewMatrix, modelMatrix) {
2700
2776
  modelMatrix = modelMatrix || this.matrix;
2701
- const worldMatrix = new import_core10.Matrix4(viewMatrix).multiplyRight(modelMatrix);
2777
+ const worldMatrix = new import_core11.Matrix4(viewMatrix).multiplyRight(modelMatrix);
2702
2778
  const worldInverse = worldMatrix.invert();
2703
2779
  const worldInverseTranspose = worldInverse.transpose();
2704
2780
  return {
@@ -2750,14 +2826,14 @@ var ScenegraphNode = class {
2750
2826
  };
2751
2827
 
2752
2828
  // dist/scenegraph/group-node.js
2753
- var import_core11 = require("@math.gl/core");
2754
- var import_core12 = require("@luma.gl/core");
2829
+ var import_core12 = require("@math.gl/core");
2830
+ var import_core13 = require("@luma.gl/core");
2755
2831
  var GroupNode = class extends ScenegraphNode {
2756
2832
  children;
2757
2833
  constructor(props = {}) {
2758
2834
  props = Array.isArray(props) ? { children: props } : props;
2759
2835
  const { children = [] } = props;
2760
- import_core12.log.assert(children.every((child) => child instanceof ScenegraphNode), "every child must an instance of ScenegraphNode");
2836
+ import_core13.log.assert(children.every((child) => child instanceof ScenegraphNode), "every child must an instance of ScenegraphNode");
2761
2837
  super(props);
2762
2838
  this.children = children;
2763
2839
  }
@@ -2772,12 +2848,12 @@ var GroupNode = class extends ScenegraphNode {
2772
2848
  return;
2773
2849
  }
2774
2850
  const [min, max] = bounds;
2775
- const center = new import_core11.Vector3(min).add(max).divide([2, 2, 2]);
2851
+ const center = new import_core12.Vector3(min).add(max).divide([2, 2, 2]);
2776
2852
  worldMatrix.transformAsPoint(center, center);
2777
- const halfSize = new import_core11.Vector3(max).subtract(min).divide([2, 2, 2]);
2853
+ const halfSize = new import_core12.Vector3(max).subtract(min).divide([2, 2, 2]);
2778
2854
  worldMatrix.transformAsVector(halfSize, halfSize);
2779
2855
  for (let v = 0; v < 8; v++) {
2780
- const position = new import_core11.Vector3(v & 1 ? -1 : 1, v & 2 ? -1 : 1, v & 4 ? -1 : 1).multiply(halfSize).add(center);
2856
+ const position = new import_core12.Vector3(v & 1 ? -1 : 1, v & 2 ? -1 : 1, v & 4 ? -1 : 1).multiply(halfSize).add(center);
2781
2857
  for (let i = 0; i < 3; i++) {
2782
2858
  result[0][i] = Math.min(result[0][i], position[i]);
2783
2859
  result[1][i] = Math.max(result[1][i], position[i]);
@@ -2817,8 +2893,8 @@ var GroupNode = class extends ScenegraphNode {
2817
2893
  this.children = [];
2818
2894
  return this;
2819
2895
  }
2820
- traverse(visitor, { worldMatrix = new import_core11.Matrix4() } = {}) {
2821
- const modelMatrix = new import_core11.Matrix4(worldMatrix).multiplyRight(this.matrix);
2896
+ traverse(visitor, { worldMatrix = new import_core12.Matrix4() } = {}) {
2897
+ const modelMatrix = new import_core12.Matrix4(worldMatrix).multiplyRight(this.matrix);
2822
2898
  for (const child of this.children) {
2823
2899
  if (child instanceof GroupNode) {
2824
2900
  child.traverse(visitor, { worldMatrix: modelMatrix });
@@ -3600,7 +3676,7 @@ var CylinderGeometry = class extends TruncatedConeGeometry {
3600
3676
  };
3601
3677
 
3602
3678
  // dist/geometries/ico-sphere-geometry.js
3603
- var import_core13 = require("@math.gl/core");
3679
+ var import_core14 = require("@math.gl/core");
3604
3680
  var ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
3605
3681
  var ICO_INDICES = [3, 4, 5, 3, 5, 1, 3, 1, 0, 3, 0, 4, 4, 0, 2, 4, 2, 5, 2, 0, 1, 5, 2, 1];
3606
3682
  var IcoSphereGeometry = class extends Geometry {
@@ -3698,7 +3774,7 @@ function tesselateIcosaHedron(props) {
3698
3774
  const u3 = 1 - phi3 / PI2;
3699
3775
  const vec1 = [x3 - x2, y3 - y2, z3 - z2];
3700
3776
  const vec2 = [x1 - x2, y1 - y2, z1 - z2];
3701
- const normal = new import_core13.Vector3(vec1).cross(vec2).normalize();
3777
+ const normal = new import_core14.Vector3(vec1).cross(vec2).normalize();
3702
3778
  let newIndex;
3703
3779
  if ((u1 === 0 || u2 === 0 || u3 === 0) && (u1 === 0 || u1 > 0.5) && (u2 === 0 || u2 > 0.5) && (u3 === 0 || u3 > 0.5)) {
3704
3780
  positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);
@@ -3962,7 +4038,7 @@ function fract(n) {
3962
4038
  var import_shadertools5 = require("@luma.gl/shadertools");
3963
4039
 
3964
4040
  // dist/compute/swap.js
3965
- var import_core14 = require("@luma.gl/core");
4041
+ var import_core15 = require("@luma.gl/core");
3966
4042
  var Swap = class {
3967
4043
  /** The current resource - usually the source for renders or computations */
3968
4044
  current;
@@ -3991,14 +4067,14 @@ var SwapFramebuffers = class extends Swap {
3991
4067
  props = { ...props };
3992
4068
  let colorAttachments = (_a = props.colorAttachments) == null ? void 0 : _a.map((colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
3993
4069
  format: colorAttachment,
3994
- usage: import_core14.Texture.SAMPLE | import_core14.Texture.RENDER | import_core14.Texture.COPY_SRC | import_core14.Texture.COPY_DST,
4070
+ usage: import_core15.Texture.SAMPLE | import_core15.Texture.RENDER | import_core15.Texture.COPY_SRC | import_core15.Texture.COPY_DST,
3995
4071
  width: 1,
3996
4072
  height: 1
3997
4073
  }));
3998
4074
  const current = device.createFramebuffer({ ...props, colorAttachments });
3999
4075
  colorAttachments = (_b = props.colorAttachments) == null ? void 0 : _b.map((colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
4000
4076
  format: colorAttachment,
4001
- usage: import_core14.Texture.TEXTURE | import_core14.Texture.COPY_SRC | import_core14.Texture.COPY_DST | import_core14.Texture.RENDER_ATTACHMENT,
4077
+ usage: import_core15.Texture.TEXTURE | import_core15.Texture.COPY_SRC | import_core15.Texture.COPY_DST | import_core15.Texture.RENDER_ATTACHMENT,
4002
4078
  width: 1,
4003
4079
  height: 1
4004
4080
  }));
@@ -4338,7 +4414,7 @@ var SubPassRenderer = class {
4338
4414
  };
4339
4415
 
4340
4416
  // dist/compute/computation.js
4341
- var import_core15 = require("@luma.gl/core");
4417
+ var import_core16 = require("@luma.gl/core");
4342
4418
  var import_shadertools6 = require("@luma.gl/shadertools");
4343
4419
  var import_types2 = require("@math.gl/types");
4344
4420
  var LOG_DRAW_PRIORITY2 = 2;
@@ -4437,7 +4513,7 @@ var _Computation = class {
4437
4513
  }
4438
4514
  setShaderInputs(shaderInputs) {
4439
4515
  this.shaderInputs = shaderInputs;
4440
- this._uniformStore = new import_core15.UniformStore(this.shaderInputs.modules);
4516
+ this._uniformStore = new import_core16.UniformStore(this.shaderInputs.modules);
4441
4517
  for (const moduleName of Object.keys(this.shaderInputs.modules)) {
4442
4518
  const uniformBuffer = this._uniformStore.getManagedUniformBuffer(this.device, moduleName);
4443
4519
  this.bindings[`${moduleName}Uniforms`] = uniformBuffer;
@@ -4474,7 +4550,7 @@ var _Computation = class {
4474
4550
  if (this._pipelineNeedsUpdate) {
4475
4551
  let prevShader = null;
4476
4552
  if (this.pipeline) {
4477
- import_core15.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
4553
+ import_core16.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
4478
4554
  prevShader = this.shader;
4479
4555
  }
4480
4556
  this._pipelineNeedsUpdate = false;
@@ -4498,33 +4574,33 @@ var _Computation = class {
4498
4574
  _lastLogTime = 0;
4499
4575
  _logOpen = false;
4500
4576
  _logDrawCallStart() {
4501
- const logDrawTimeout = import_core15.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT2;
4502
- if (import_core15.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
4577
+ const logDrawTimeout = import_core16.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT2;
4578
+ if (import_core16.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
4503
4579
  return;
4504
4580
  }
4505
4581
  this._lastLogTime = Date.now();
4506
4582
  this._logOpen = true;
4507
- import_core15.log.group(LOG_DRAW_PRIORITY2, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core15.log.level <= 2 })();
4583
+ import_core16.log.group(LOG_DRAW_PRIORITY2, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core16.log.level <= 2 })();
4508
4584
  }
4509
4585
  _logDrawCallEnd() {
4510
4586
  if (this._logOpen) {
4511
4587
  const uniformTable = this.shaderInputs.getDebugTable();
4512
- import_core15.log.table(LOG_DRAW_PRIORITY2, uniformTable)();
4513
- import_core15.log.groupEnd(LOG_DRAW_PRIORITY2)();
4588
+ import_core16.log.table(LOG_DRAW_PRIORITY2, uniformTable)();
4589
+ import_core16.log.groupEnd(LOG_DRAW_PRIORITY2)();
4514
4590
  this._logOpen = false;
4515
4591
  }
4516
4592
  }
4517
4593
  _drawCount = 0;
4518
4594
  // TODO - fix typing of luma data types
4519
4595
  _getBufferOrConstantValues(attribute, dataType) {
4520
- const TypedArrayConstructor = (0, import_core15.getTypedArrayFromDataType)(dataType);
4521
- const typedArray = attribute instanceof import_core15.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
4596
+ const TypedArrayConstructor = (0, import_core16.getTypedArrayConstructor)(dataType);
4597
+ const typedArray = attribute instanceof import_core16.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
4522
4598
  return typedArray.toString();
4523
4599
  }
4524
4600
  };
4525
4601
  var Computation = _Computation;
4526
4602
  __publicField(Computation, "defaultProps", {
4527
- ...import_core15.ComputePipeline.defaultProps,
4603
+ ...import_core16.ComputePipeline.defaultProps,
4528
4604
  id: "unnamed",
4529
4605
  handle: void 0,
4530
4606
  userData: {},
@@ -4686,7 +4762,7 @@ var _PickingManager = class {
4686
4762
  });
4687
4763
  return pickingPass;
4688
4764
  }
4689
- getPickInfo(mousePosition) {
4765
+ async updatePickInfo(mousePosition) {
4690
4766
  var _a;
4691
4767
  const framebuffer = this.getFramebuffer();
4692
4768
  const [pickX, pickY] = this.getPickPosition(mousePosition);