@luma.gl/engine 10.0.0-alpha.3 → 10.0.0-alpha.4

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 (86) hide show
  1. package/dist/dist.dev.js +695 -1317
  2. package/dist/dist.min.js +31 -31
  3. package/dist/geometry/edge-geometry.d.ts +3 -2
  4. package/dist/geometry/edge-geometry.d.ts.map +1 -1
  5. package/dist/geometry/edge-geometry.js.map +1 -1
  6. package/dist/geometry/geometry-primitives.d.ts +54 -0
  7. package/dist/geometry/geometry-primitives.d.ts.map +1 -0
  8. package/dist/geometry/geometry-primitives.js +153 -0
  9. package/dist/geometry/geometry-primitives.js.map +1 -0
  10. package/dist/geometry/geometry-utils.d.ts +7 -15
  11. package/dist/geometry/geometry-utils.d.ts.map +1 -1
  12. package/dist/geometry/geometry-utils.js +9 -55
  13. package/dist/geometry/geometry-utils.js.map +1 -1
  14. package/dist/geometry/geometry.d.ts +9 -69
  15. package/dist/geometry/geometry.d.ts.map +1 -1
  16. package/dist/geometry/geometry.js +27 -93
  17. package/dist/geometry/geometry.js.map +1 -1
  18. package/dist/geometry/gpu-geometry.d.ts +4 -2
  19. package/dist/geometry/gpu-geometry.d.ts.map +1 -1
  20. package/dist/geometry/gpu-geometry.js +3 -3
  21. package/dist/geometry/gpu-geometry.js.map +1 -1
  22. package/dist/index.cjs +241 -1301
  23. package/dist/index.cjs.map +3 -3
  24. package/dist/index.d.ts +14 -14
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +7 -7
  27. package/dist/index.js.map +1 -1
  28. package/dist/model/model.d.ts +1 -1
  29. package/dist/model/model.d.ts.map +1 -1
  30. package/dist/models/clip-space.d.ts +4 -1
  31. package/dist/models/clip-space.d.ts.map +1 -1
  32. package/dist/models/clip-space.js +16 -13
  33. package/dist/models/clip-space.js.map +1 -1
  34. package/dist/models/directional-light-model.js +1 -1
  35. package/dist/models/directional-light-model.js.map +1 -1
  36. package/dist/models/point-light-model.js +1 -1
  37. package/dist/models/point-light-model.js.map +1 -1
  38. package/dist/models/spot-light-model.js +1 -1
  39. package/dist/models/spot-light-model.js.map +1 -1
  40. package/package.json +7 -6
  41. package/src/geometry/edge-geometry.ts +7 -3
  42. package/src/geometry/geometry-primitives.ts +215 -0
  43. package/src/geometry/geometry-utils.ts +16 -71
  44. package/src/geometry/geometry.ts +36 -163
  45. package/src/geometry/gpu-geometry.ts +9 -4
  46. package/src/index.ts +14 -14
  47. package/src/model/model.ts +1 -1
  48. package/src/models/clip-space.ts +21 -14
  49. package/src/models/directional-light-model.ts +1 -1
  50. package/src/models/point-light-model.ts +1 -1
  51. package/src/models/spot-light-model.ts +1 -1
  52. package/dist/geometries/cone-geometry.d.ts +0 -12
  53. package/dist/geometries/cone-geometry.d.ts.map +0 -1
  54. package/dist/geometries/cone-geometry.js +0 -19
  55. package/dist/geometries/cone-geometry.js.map +0 -1
  56. package/dist/geometries/cube-geometry.d.ts +0 -14
  57. package/dist/geometries/cube-geometry.d.ts.map +0 -1
  58. package/dist/geometries/cube-geometry.js +0 -222
  59. package/dist/geometries/cube-geometry.js.map +0 -1
  60. package/dist/geometries/cylinder-geometry.d.ts +0 -11
  61. package/dist/geometries/cylinder-geometry.d.ts.map +0 -1
  62. package/dist/geometries/cylinder-geometry.js +0 -17
  63. package/dist/geometries/cylinder-geometry.js.map +0 -1
  64. package/dist/geometries/ico-sphere-geometry.d.ts +0 -11
  65. package/dist/geometries/ico-sphere-geometry.d.ts.map +0 -1
  66. package/dist/geometries/ico-sphere-geometry.js +0 -158
  67. package/dist/geometries/ico-sphere-geometry.js.map +0 -1
  68. package/dist/geometries/plane-geometry.d.ts +0 -20
  69. package/dist/geometries/plane-geometry.d.ts.map +0 -1
  70. package/dist/geometries/plane-geometry.js +0 -106
  71. package/dist/geometries/plane-geometry.js.map +0 -1
  72. package/dist/geometries/sphere-geometry.d.ts +0 -12
  73. package/dist/geometries/sphere-geometry.d.ts.map +0 -1
  74. package/dist/geometries/sphere-geometry.js +0 -88
  75. package/dist/geometries/sphere-geometry.js.map +0 -1
  76. package/dist/geometries/truncated-cone-geometry.d.ts +0 -23
  77. package/dist/geometries/truncated-cone-geometry.d.ts.map +0 -1
  78. package/dist/geometries/truncated-cone-geometry.js +0 -112
  79. package/dist/geometries/truncated-cone-geometry.js.map +0 -1
  80. package/src/geometries/cone-geometry.ts +0 -31
  81. package/src/geometries/cube-geometry.ts +0 -258
  82. package/src/geometries/cylinder-geometry.ts +0 -28
  83. package/src/geometries/ico-sphere-geometry.ts +0 -193
  84. package/src/geometries/plane-geometry.ts +0 -142
  85. package/src/geometries/sphere-geometry.ts +0 -113
  86. package/src/geometries/truncated-cone-geometry.ts +0 -145
package/dist/index.cjs CHANGED
@@ -552,101 +552,32 @@ var AnimationMixer = class {
552
552
  };
553
553
 
554
554
  // dist/geometry/geometry.js
555
+ var import_geometry = require("@math.gl/geometry");
555
556
  var import_core2 = require("@luma.gl/core");
556
-
557
- // dist/utils/uid.js
558
- var uidCounters = {};
559
- function uid(id = "id") {
560
- uidCounters[id] = uidCounters[id] || 1;
561
- const count = uidCounters[id]++;
562
- return `${id}-${count}`;
563
- }
564
-
565
- // dist/geometry/geometry.js
566
- var Geometry = class {
567
- /** Application-provided or generated identifier. */
568
- id;
569
- /** Determines how vertices are assembled into primitives. */
570
- topology;
571
- /** Resolved draw vertex count. */
572
- vertexCount;
573
- /** Optional index attribute. */
574
- indices;
575
- /** CPU attributes, keyed by caller-provided source attribute name. */
576
- attributes;
577
- /** Buffer layout matching the geometry attributes. Always populated. */
557
+ var Geometry = class extends import_geometry.Geometry {
578
558
  bufferLayout;
579
- /** Application-owned metadata. */
580
- userData = {};
581
- /** Creates a CPU geometry and wraps raw typed arrays into attribute records. */
582
559
  constructor(props) {
583
- const { attributes = {}, indices = null, vertexCount = null } = props;
584
- this.id = props.id || uid("geometry");
585
- this.topology = props.topology;
586
- if (indices) {
587
- this.indices = ArrayBuffer.isView(indices) ? { value: indices, size: 1 } : indices;
588
- }
589
- this.attributes = {};
590
- for (const [attributeName, attributeValue] of Object.entries(attributes)) {
591
- const attribute = ArrayBuffer.isView(attributeValue) ? { value: attributeValue } : attributeValue;
592
- if (!ArrayBuffer.isView(attribute.value)) {
593
- throw new Error(`${this._print(attributeName)}: must be typed array or object with value as typed array`);
594
- }
595
- if ((attributeName === "POSITION" || attributeName === "positions") && !attribute.size) {
596
- attribute.size = 3;
560
+ const attributes = {};
561
+ const sourceNames = /* @__PURE__ */ new Map();
562
+ for (const [name, attribute] of Object.entries(props.attributes)) {
563
+ const shaderName = getGeometryShaderAttributeName(name);
564
+ const previousName = sourceNames.get(shaderName);
565
+ if (previousName)
566
+ delete attributes[previousName];
567
+ sourceNames.set(shaderName, name);
568
+ attributes[name] = attribute;
569
+ }
570
+ const sourceIndices = props.indices;
571
+ const indices = sourceIndices instanceof Uint8Array ? new Uint16Array(sourceIndices) : sourceIndices && !ArrayBuffer.isView(sourceIndices) && sourceIndices.value instanceof Uint8Array ? { ...sourceIndices, value: new Uint16Array(sourceIndices.value) } : sourceIndices;
572
+ super({ ...props, attributes, indices });
573
+ for (const [name, input] of Object.entries(attributes)) {
574
+ if (!ArrayBuffer.isView(input) && Object.isExtensible(input) && name !== "indices") {
575
+ Object.assign(input, this.attributes[name]);
576
+ this.attributes[name] = input;
597
577
  }
598
- if (attributeName === "indices") {
599
- if (this.indices) {
600
- throw new Error("Multiple indices detected");
601
- }
602
- this.indices = attribute;
603
- } else {
604
- const shaderAttributeName = getGeometryShaderAttributeName(attributeName);
605
- const storedAttributeName = Object.keys(this.attributes).find((name) => getGeometryShaderAttributeName(name) === shaderAttributeName);
606
- if (storedAttributeName) {
607
- delete this.attributes[storedAttributeName];
608
- }
609
- this.attributes[attributeName] = attribute;
610
- }
611
- }
612
- if (this.indices && this.indices["isIndexed"] !== void 0) {
613
- this.indices = Object.assign({}, this.indices);
614
- delete this.indices["isIndexed"];
615
578
  }
616
- this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);
617
579
  this.bufferLayout = props.bufferLayout || getBufferLayoutFromGeometryAttributes(this.attributes);
618
580
  }
619
- /** Returns the resolved draw vertex count. */
620
- getVertexCount() {
621
- return this.vertexCount;
622
- }
623
- /** Returns all attributes, including `indices` when index data is present. */
624
- getAttributes() {
625
- return this.indices ? { indices: this.indices, ...this.attributes } : this.attributes;
626
- }
627
- // PRIVATE
628
- _print(attributeName) {
629
- return `Geometry ${this.id} attribute ${attributeName}`;
630
- }
631
- _setAttributes(attributes, indices) {
632
- return this;
633
- }
634
- _calculateVertexCount(attributes, indices) {
635
- if (indices) {
636
- return indices.value.length;
637
- }
638
- let vertexCount = Infinity;
639
- for (const attribute of Object.values(attributes)) {
640
- if (!attribute) {
641
- continue;
642
- }
643
- const { value, size, constant } = attribute;
644
- if (!constant && value && size !== void 0 && size >= 1) {
645
- vertexCount = Math.min(vertexCount, value.length / size);
646
- }
647
- }
648
- return vertexCount;
649
- }
650
581
  };
651
582
  function getGeometryShaderAttributeName(attributeName) {
652
583
  switch (attributeName) {
@@ -684,37 +615,7 @@ function getBufferLayoutFromGeometryAttributes(attributes) {
684
615
 
685
616
  // dist/geometry/geometry-utils.js
686
617
  var import_core3 = require("@luma.gl/core");
687
- function unpackIndexedGeometry(geometry) {
688
- const { indices, attributes } = geometry;
689
- if (!indices) {
690
- return geometry;
691
- }
692
- const vertexCount = indices.value.length;
693
- const unpackedAttributes = {};
694
- for (const attributeName in attributes) {
695
- const attribute = attributes[attributeName];
696
- if (!attribute) {
697
- continue;
698
- }
699
- const { value, size } = attribute;
700
- const constant = attribute["constant"];
701
- if (constant || !size) {
702
- continue;
703
- }
704
- const ArrayType = value.constructor;
705
- const unpackedValue = new ArrayType(vertexCount * size);
706
- for (let x = 0; x < vertexCount; ++x) {
707
- const index = indices.value[x];
708
- for (let i = 0; i < size; i++) {
709
- unpackedValue[x * size + i] = value[index * size + i];
710
- }
711
- }
712
- unpackedAttributes[attributeName] = { size, value: unpackedValue };
713
- }
714
- return {
715
- attributes: Object.assign({}, attributes, unpackedAttributes)
716
- };
717
- }
618
+ var import_geometry2 = require("@math.gl/geometry");
718
619
  function makeInterleavedGeometry(geometry, options = {}) {
719
620
  const bufferName = options.bufferName || "geometry";
720
621
  if (isInterleavedGeometry(geometry, bufferName)) {
@@ -793,18 +694,22 @@ function makeInterleavedGeometry(geometry, options = {}) {
793
694
  });
794
695
  }
795
696
  function isInterleavedGeometry(geometry, bufferName) {
796
- var _a;
797
- if (geometry.bufferLayout.length !== 1) {
697
+ var _a, _b;
698
+ if (((_a = geometry.bufferLayout) == null ? void 0 : _a.length) !== 1) {
798
699
  return false;
799
700
  }
800
701
  const bufferLayout = geometry.bufferLayout[0];
801
- return bufferLayout.name === bufferName && Boolean((_a = bufferLayout.attributes) == null ? void 0 : _a.length) && Boolean(geometry.attributes[bufferName]);
702
+ return bufferLayout.name === bufferName && Boolean((_b = bufferLayout.attributes) == null ? void 0 : _b.length) && Boolean(geometry.attributes[bufferName]);
802
703
  }
803
704
  function getInterleavedSourceAttributes(geometry, attributeNames) {
804
- if (attributeNames) {
805
- return attributeNames.map((attributeName) => [attributeName, geometry.attributes[attributeName]]);
705
+ const attributes = /* @__PURE__ */ new Map();
706
+ const sourceNames = attributeNames || Object.keys(geometry.attributes);
707
+ for (const name of sourceNames) {
708
+ const attribute = geometry.attributes[name];
709
+ if (attribute)
710
+ attributes.set(getGeometryShaderAttributeName(name), [name, attribute]);
806
711
  }
807
- return Object.entries(geometry.attributes);
712
+ return Array.from(attributes.values());
808
713
  }
809
714
  function writeInterleavedAttribute(arrayBuffer, vertexCount, byteStride, attribute) {
810
715
  const ArrayType = attribute.value.constructor;
@@ -1985,6 +1890,16 @@ var import_shadertools3 = require("@luma.gl/shadertools");
1985
1890
 
1986
1891
  // dist/geometry/gpu-geometry.js
1987
1892
  var import_core7 = require("@luma.gl/core");
1893
+
1894
+ // dist/utils/uid.js
1895
+ var uidCounters = {};
1896
+ function uid(id = "id") {
1897
+ uidCounters[id] = uidCounters[id] || 1;
1898
+ const count = uidCounters[id]++;
1899
+ return `${id}-${count}`;
1900
+ }
1901
+
1902
+ // dist/geometry/gpu-geometry.js
1988
1903
  var GPUGeometry = class {
1989
1904
  /** Application-provided or generated identifier. */
1990
1905
  id;
@@ -2062,10 +1977,10 @@ function getIndexBufferFromGeometry(device, geometry) {
2062
1977
  return device.createBuffer({ usage: import_core7.Buffer.INDEX, data });
2063
1978
  }
2064
1979
  function getAttributeBuffersFromGeometry(device, geometry) {
2065
- var _a;
1980
+ var _a, _b;
2066
1981
  const attributes = {};
2067
1982
  for (const [attributeName, attribute] of Object.entries(geometry.attributes)) {
2068
- const name = ((_a = geometry.bufferLayout.find((bufferLayout) => bufferLayout.name === attributeName)) == null ? void 0 : _a.name) || getGeometryShaderAttributeName(attributeName);
1983
+ const name = ((_b = (_a = geometry.bufferLayout) == null ? void 0 : _a.find((bufferLayout) => bufferLayout.name === attributeName)) == null ? void 0 : _b.name) || getGeometryShaderAttributeName(attributeName);
2069
1984
  if (attribute) {
2070
1985
  attributes[name] = device.createBuffer({
2071
1986
  data: attribute.value,
@@ -2075,7 +1990,7 @@ function getAttributeBuffersFromGeometry(device, geometry) {
2075
1990
  }
2076
1991
  return {
2077
1992
  attributes,
2078
- bufferLayout: geometry.bufferLayout,
1993
+ bufferLayout: geometry.bufferLayout || getBufferLayoutFromGeometryAttributes(geometry.attributes),
2079
1994
  vertexCount: geometry.vertexCount
2080
1995
  };
2081
1996
  }
@@ -4429,26 +4344,30 @@ void main(void) {
4429
4344
  }
4430
4345
  `
4431
4346
  );
4432
- var POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];
4347
+ var QUAD_POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1];
4348
+ var TRIANGLE_POSITIONS = [-1, -1, 3, -1, -1, 3];
4433
4349
  var ClipSpace = class extends Model {
4434
4350
  constructor(device, props) {
4435
- const TEX_COORDS = POSITIONS.map((coord) => coord === -1 ? 0 : coord);
4436
- if (props.source) {
4437
- props = { ...props, source: `${CLIPSPACE_VERTEX_SHADER_WGSL}
4438
- ${props.source}` };
4351
+ const { geometryType = "quad", ...modelProps } = props;
4352
+ const positions = geometryType === "triangle" ? TRIANGLE_POSITIONS : QUAD_POSITIONS;
4353
+ const textureCoordinates = positions.map((position) => (position + 1) / 2);
4354
+ const vertexCount = positions.length / 2;
4355
+ if (modelProps.source) {
4356
+ modelProps.source = `${CLIPSPACE_VERTEX_SHADER_WGSL}
4357
+ ${modelProps.source}`;
4439
4358
  }
4440
4359
  super(device, {
4441
- id: props.id || uid("clip-space"),
4442
- ...props,
4360
+ id: modelProps.id || uid("clip-space"),
4361
+ ...modelProps,
4443
4362
  vs: CLIPSPACE_VERTEX_SHADER,
4444
- vertexCount: 4,
4363
+ vertexCount,
4445
4364
  geometry: new Geometry({
4446
- topology: "triangle-strip",
4447
- vertexCount: 4,
4365
+ topology: geometryType === "triangle" ? "triangle-list" : "triangle-strip",
4366
+ vertexCount,
4448
4367
  attributes: {
4449
- clipSpacePositions: { size: 2, value: new Float32Array(POSITIONS) },
4450
- texCoords: { size: 2, value: new Float32Array(TEX_COORDS) },
4451
- coordinates: { size: 2, value: new Float32Array(TEX_COORDS) }
4368
+ clipSpacePositions: { size: 2, value: new Float32Array(positions) },
4369
+ texCoords: { size: 2, value: new Float32Array(textureCoordinates) },
4370
+ coordinates: { size: 2, value: new Float32Array(textureCoordinates) }
4452
4371
  }
4453
4372
  })
4454
4373
  });
@@ -5263,82 +5182,147 @@ var BackgroundTextureModel = class extends ClipSpace {
5263
5182
  }
5264
5183
  };
5265
5184
 
5266
- // dist/geometries/sphere-geometry.js
5267
- var SphereGeometry = class extends Geometry {
5185
+ // dist/geometry/geometry-primitives.js
5186
+ var import_geometry7 = require("@math.gl/geometry");
5187
+ var CubeGeometry = class extends Geometry {
5268
5188
  constructor(props = {}) {
5269
- const { id = uid("sphere-geometry") } = props;
5270
- const { indices, attributes } = tesselateSphere(props);
5189
+ const source4 = new import_geometry7.CubeGeometry({ size: 2 });
5190
+ const faceIndices = new Uint32Array(24);
5191
+ const faceOrder = [4, 5, 2, 3, 0, 1];
5192
+ for (let vertexIndex = 0; vertexIndex < faceIndices.length; vertexIndex++) {
5193
+ faceIndices[vertexIndex] = faceOrder[Math.floor(vertexIndex / 4)];
5194
+ }
5195
+ source4.attributes["faceIndex"] = { size: 1, value: faceIndices };
5196
+ if (props.indices === false) {
5197
+ source4.attributes["COLOR_0"] = {
5198
+ size: 3,
5199
+ value: new Float32Array(Array.from(source4.attributes["POSITION"].value, (value) => (value + 1) / 2))
5200
+ };
5201
+ }
5202
+ const data = props.indices === false ? (0, import_geometry7.unpackIndexedGeometry)(source4) : source4;
5271
5203
  super({
5204
+ id: props.id,
5205
+ topology: source4.topology,
5206
+ indices: props.indices === false ? void 0 : source4.indices,
5207
+ attributes: mergeAttributes(data.attributes, props.attributes)
5208
+ });
5209
+ }
5210
+ };
5211
+ var SphereGeometry = class extends Geometry {
5212
+ constructor(props = {}) {
5213
+ var _a;
5214
+ const source4 = new import_geometry7.SphereGeometry({
5272
5215
  ...props,
5273
- id,
5274
- topology: "triangle-list",
5275
- indices,
5276
- attributes: { ...attributes, ...props.attributes }
5216
+ attributes: void 0,
5217
+ radius: props.radius ?? 1
5277
5218
  });
5219
+ for (const name of ["POSITION", "NORMAL"]) {
5220
+ const values = source4.attributes[name].value;
5221
+ for (let index = 0; index < values.length; index += 3) {
5222
+ const horizontal = values[index];
5223
+ values[index] = values[index + 2];
5224
+ values[index + 2] = horizontal;
5225
+ }
5226
+ }
5227
+ const indices = (_a = source4.indices) == null ? void 0 : _a.value;
5228
+ if (indices) {
5229
+ for (let index = 0; index < indices.length; index += 3) {
5230
+ const second = indices[index + 1];
5231
+ indices[index + 1] = indices[index + 2];
5232
+ indices[index + 2] = second;
5233
+ }
5234
+ }
5235
+ super({ ...source4, attributes: { ...source4.attributes, ...props.attributes } });
5236
+ }
5237
+ };
5238
+ var IcoSphereGeometry = class extends Geometry {
5239
+ constructor(props = {}) {
5240
+ const source4 = new import_geometry7.IcoSphereGeometry({ ...props, radius: props.radius ?? 1 });
5241
+ super({ ...source4, attributes: source4.attributes });
5278
5242
  }
5279
5243
  };
5280
- function tesselateSphere(props) {
5281
- const { nlat = 10, nlong = 10 } = props;
5282
- const startLat = 0;
5283
- const endLat = Math.PI;
5284
- const latRange = endLat - startLat;
5285
- const startLong = 0;
5286
- const endLong = 2 * Math.PI;
5287
- const longRange = endLong - startLong;
5288
- const numVertices = (nlat + 1) * (nlong + 1);
5289
- const radius = (n1, n2, n3, u, v) => props.radius || 1;
5290
- const positions = new Float32Array(numVertices * 3);
5291
- const normals = new Float32Array(numVertices * 3);
5292
- const texCoords = new Float32Array(numVertices * 2);
5293
- const IndexType = numVertices > 65535 ? Uint32Array : Uint16Array;
5294
- const indices = new IndexType(nlat * nlong * 6);
5295
- for (let y = 0; y <= nlat; y++) {
5296
- for (let x = 0; x <= nlong; x++) {
5297
- const u = x / nlong;
5298
- const v = y / nlat;
5299
- const index = x + y * (nlong + 1);
5300
- const i2 = index * 2;
5301
- const i3 = index * 3;
5302
- const theta = longRange * u;
5303
- const phi = latRange * v;
5304
- const sinTheta = Math.sin(theta);
5305
- const cosTheta = Math.cos(theta);
5306
- const sinPhi = Math.sin(phi);
5307
- const cosPhi = Math.cos(phi);
5308
- const ux = cosTheta * sinPhi;
5309
- const uy = cosPhi;
5310
- const uz = sinTheta * sinPhi;
5311
- const r = radius(ux, uy, uz, u, v);
5312
- positions[i3 + 0] = r * ux;
5313
- positions[i3 + 1] = r * uy;
5314
- positions[i3 + 2] = r * uz;
5315
- normals[i3 + 0] = ux;
5316
- normals[i3 + 1] = uy;
5317
- normals[i3 + 2] = uz;
5318
- texCoords[i2 + 0] = u;
5319
- texCoords[i2 + 1] = 1 - v;
5320
- }
5321
- }
5322
- const numVertsAround = nlong + 1;
5323
- for (let x = 0; x < nlong; x++) {
5324
- for (let y = 0; y < nlat; y++) {
5325
- const index = (x * nlat + y) * 6;
5326
- indices[index + 0] = y * numVertsAround + x;
5327
- indices[index + 1] = y * numVertsAround + x + 1;
5328
- indices[index + 2] = (y + 1) * numVertsAround + x;
5329
- indices[index + 3] = (y + 1) * numVertsAround + x;
5330
- indices[index + 4] = y * numVertsAround + x + 1;
5331
- indices[index + 5] = (y + 1) * numVertsAround + x + 1;
5244
+ var TruncatedConeGeometry = class extends Geometry {
5245
+ constructor(props = {}) {
5246
+ const source4 = new import_geometry7.TruncatedConeGeometry({ ...props, bottomRadius: props.bottomRadius ?? 1 });
5247
+ super({ ...source4, attributes: source4.attributes });
5248
+ }
5249
+ };
5250
+ var CylinderGeometry = class extends TruncatedConeGeometry {
5251
+ constructor(props = {}) {
5252
+ const radius = props.radius ?? 1;
5253
+ super({ ...props, topRadius: radius, bottomRadius: radius });
5254
+ }
5255
+ };
5256
+ var ConeGeometry = class extends TruncatedConeGeometry {
5257
+ constructor(props = {}) {
5258
+ const cap = props.cap ?? true;
5259
+ super({ ...props, topRadius: 0, bottomRadius: props.radius ?? 1, topCap: cap, bottomCap: cap });
5260
+ }
5261
+ };
5262
+ var PlaneGeometry = class extends Geometry {
5263
+ constructor(props = {}) {
5264
+ const { type = "x,y", offset = 0, flipCull = false } = props;
5265
+ const planeAxes = {
5266
+ "x,y": { sizeX: props.xlen, sizeZ: props.ylen, nx: props.nx, nz: props.ny },
5267
+ "x,z": { sizeX: props.xlen, sizeZ: props.zlen, nx: props.nx, nz: props.nz },
5268
+ "y,z": { sizeX: props.ylen, sizeZ: props.zlen, nx: props.ny, nz: props.nz }
5269
+ }[type];
5270
+ if (!planeAxes)
5271
+ throw new Error("Invalid plane axes");
5272
+ const source4 = new import_geometry7.PlaneGeometry({
5273
+ sizeX: planeAxes.sizeX || 1,
5274
+ sizeZ: planeAxes.sizeZ || 1,
5275
+ nx: planeAxes.nx || 1,
5276
+ nz: planeAxes.nz || 1
5277
+ });
5278
+ orientPlane(source4, type, offset, flipCull);
5279
+ const data = props.unpack ? (0, import_geometry7.unpackIndexedGeometry)(source4) : source4;
5280
+ super({
5281
+ id: props.id,
5282
+ topology: source4.topology,
5283
+ indices: props.unpack ? void 0 : source4.indices,
5284
+ attributes: mergeAttributes(data.attributes, props.attributes)
5285
+ });
5286
+ }
5287
+ };
5288
+ function orientPlane(geometry, type, offset, flipCull) {
5289
+ const positions = geometry.attributes["POSITION"].value;
5290
+ const normals = geometry.attributes["NORMAL"].value;
5291
+ const texCoords = geometry.attributes["TEXCOORD_0"].value;
5292
+ for (let vertexIndex = 0; vertexIndex < positions.length / 3; vertexIndex++) {
5293
+ const positionIndex = vertexIndex * 3;
5294
+ const horizontal = Number(positions[positionIndex]) * (flipCull ? -1 : 1);
5295
+ const vertical = -Number(positions[positionIndex + 2]);
5296
+ const normal = flipCull ? 1 : -1;
5297
+ if (type === "x,y") {
5298
+ positions.set([horizontal, vertical, offset], positionIndex);
5299
+ normals.set([0, 0, normal], positionIndex);
5300
+ } else if (type === "x,z") {
5301
+ positions.set([horizontal, offset, vertical], positionIndex);
5302
+ normals.set([0, normal, 0], positionIndex);
5303
+ } else {
5304
+ positions.set([offset, horizontal, vertical], positionIndex);
5305
+ normals.set([normal, 0, 0], positionIndex);
5332
5306
  }
5307
+ if (flipCull)
5308
+ texCoords[vertexIndex * 2] = 1 - Number(texCoords[vertexIndex * 2]);
5333
5309
  }
5334
- return {
5335
- indices: { size: 1, value: indices },
5336
- attributes: {
5337
- POSITION: { size: 3, value: positions },
5338
- NORMAL: { size: 3, value: normals },
5339
- TEXCOORD_0: { size: 2, value: texCoords }
5310
+ if (type !== "x,z" && geometry.indices) {
5311
+ const indices = geometry.indices.value;
5312
+ for (let index = 0; index < indices.length; index += 3) {
5313
+ const second = indices[index + 1];
5314
+ indices[index + 1] = indices[index + 2];
5315
+ indices[index + 2] = second;
5340
5316
  }
5341
- };
5317
+ }
5318
+ }
5319
+ function mergeAttributes(source4, overrides = {}) {
5320
+ const attributes = {};
5321
+ for (const [name, attribute] of Object.entries(source4)) {
5322
+ if (attribute)
5323
+ attributes[name] = attribute;
5324
+ }
5325
+ return { ...attributes, ...overrides };
5342
5326
  }
5343
5327
 
5344
5328
  // dist/models/light-model-utils.js
@@ -5741,121 +5725,6 @@ var PointLightModel = class extends BaseLightModel {
5741
5725
  }
5742
5726
  };
5743
5727
 
5744
- // dist/geometries/truncated-cone-geometry.js
5745
- var INDEX_OFFSETS = {
5746
- x: [2, 0, 1],
5747
- y: [0, 1, 2],
5748
- z: [1, 2, 0]
5749
- };
5750
- var TruncatedConeGeometry = class extends Geometry {
5751
- constructor(props = {}) {
5752
- const { id = uid("truncated-code-geometry") } = props;
5753
- const { indices, attributes } = tesselateTruncatedCone(props);
5754
- super({
5755
- ...props,
5756
- id,
5757
- topology: "triangle-list",
5758
- indices,
5759
- attributes: {
5760
- POSITION: { size: 3, value: attributes.POSITION },
5761
- NORMAL: { size: 3, value: attributes.NORMAL },
5762
- TEXCOORD_0: { size: 2, value: attributes.TEXCOORD_0 },
5763
- ...props.attributes
5764
- }
5765
- });
5766
- }
5767
- };
5768
- function tesselateTruncatedCone(props = {}) {
5769
- const { bottomRadius = 0, topRadius = 0, height = 1, nradial = 10, nvertical = 10, verticalAxis = "y", topCap = false, bottomCap = false } = props;
5770
- const extra = (topCap ? 2 : 0) + (bottomCap ? 2 : 0);
5771
- const numVertices = (nradial + 1) * (nvertical + 1 + extra);
5772
- const slant = Math.atan2(bottomRadius - topRadius, height);
5773
- const msin = Math.sin;
5774
- const mcos = Math.cos;
5775
- const mpi = Math.PI;
5776
- const cosSlant = mcos(slant);
5777
- const sinSlant = msin(slant);
5778
- const start = topCap ? -2 : 0;
5779
- const end = nvertical + (bottomCap ? 2 : 0);
5780
- const vertsAroundEdge = nradial + 1;
5781
- const indices = new Uint16Array(nradial * (nvertical + extra) * 6);
5782
- const indexOffset = INDEX_OFFSETS[verticalAxis];
5783
- const positions = new Float32Array(numVertices * 3);
5784
- const normals = new Float32Array(numVertices * 3);
5785
- const texCoords = new Float32Array(numVertices * 2);
5786
- let i3 = 0;
5787
- let i2 = 0;
5788
- for (let i = start; i <= end; i++) {
5789
- let v = i / nvertical;
5790
- let y = height * v;
5791
- let ringRadius;
5792
- if (i < 0) {
5793
- y = 0;
5794
- v = 1;
5795
- ringRadius = bottomRadius;
5796
- } else if (i > nvertical) {
5797
- y = height;
5798
- v = 1;
5799
- ringRadius = topRadius;
5800
- } else {
5801
- ringRadius = bottomRadius + (topRadius - bottomRadius) * (i / nvertical);
5802
- }
5803
- if (i === -2 || i === nvertical + 2) {
5804
- ringRadius = 0;
5805
- v = 0;
5806
- }
5807
- y -= height / 2;
5808
- for (let j = 0; j < vertsAroundEdge; j++) {
5809
- const sin = msin(j * mpi * 2 / nradial);
5810
- const cos = mcos(j * mpi * 2 / nradial);
5811
- positions[i3 + indexOffset[0]] = sin * ringRadius;
5812
- positions[i3 + indexOffset[1]] = y;
5813
- positions[i3 + indexOffset[2]] = cos * ringRadius;
5814
- normals[i3 + indexOffset[0]] = i < 0 || i > nvertical ? 0 : sin * cosSlant;
5815
- normals[i3 + indexOffset[1]] = i < 0 ? -1 : i > nvertical ? 1 : sinSlant;
5816
- normals[i3 + indexOffset[2]] = i < 0 || i > nvertical ? 0 : cos * cosSlant;
5817
- texCoords[i2 + 0] = j / nradial;
5818
- texCoords[i2 + 1] = v;
5819
- i2 += 2;
5820
- i3 += 3;
5821
- }
5822
- }
5823
- for (let i = 0; i < nvertical + extra; i++) {
5824
- for (let j = 0; j < nradial; j++) {
5825
- const index = (i * nradial + j) * 6;
5826
- indices[index + 0] = vertsAroundEdge * (i + 0) + 0 + j;
5827
- indices[index + 1] = vertsAroundEdge * (i + 0) + 1 + j;
5828
- indices[index + 2] = vertsAroundEdge * (i + 1) + 1 + j;
5829
- indices[index + 3] = vertsAroundEdge * (i + 0) + 0 + j;
5830
- indices[index + 4] = vertsAroundEdge * (i + 1) + 1 + j;
5831
- indices[index + 5] = vertsAroundEdge * (i + 1) + 0 + j;
5832
- }
5833
- }
5834
- return {
5835
- indices,
5836
- attributes: {
5837
- POSITION: positions,
5838
- NORMAL: normals,
5839
- TEXCOORD_0: texCoords
5840
- }
5841
- };
5842
- }
5843
-
5844
- // dist/geometries/cone-geometry.js
5845
- var ConeGeometry = class extends TruncatedConeGeometry {
5846
- constructor(props = {}) {
5847
- const { id = uid("cone-geometry"), radius = 1, cap = true } = props;
5848
- super({
5849
- ...props,
5850
- id,
5851
- topRadius: 0,
5852
- topCap: Boolean(cap),
5853
- bottomCap: Boolean(cap),
5854
- bottomRadius: radius
5855
- });
5856
- }
5857
- };
5858
-
5859
5728
  // dist/models/spot-light-model.js
5860
5729
  var SPOT_LIGHT_GEOMETRY = new ConeGeometry({
5861
5730
  cap: true,
@@ -6872,935 +6741,6 @@ function compareCollapses(first, second) {
6872
6741
  return first.cost - second.cost || first.retainedVertex - second.retainedVertex || first.removedVertex - second.removedVertex;
6873
6742
  }
6874
6743
 
6875
- // dist/geometries/cube-geometry.js
6876
- var CubeGeometry = class extends Geometry {
6877
- constructor(props = {}) {
6878
- const { id = uid("cube-geometry"), indices = true } = props;
6879
- super(indices ? {
6880
- ...props,
6881
- id,
6882
- topology: "triangle-list",
6883
- indices: { size: 1, value: CUBE_INDICES },
6884
- attributes: { ...ATTRIBUTES, ...props.attributes }
6885
- } : {
6886
- ...props,
6887
- id,
6888
- topology: "triangle-list",
6889
- indices: void 0,
6890
- attributes: { ...NON_INDEXED_ATTRIBUTES, ...props.attributes }
6891
- });
6892
- }
6893
- };
6894
- var CUBE_INDICES = new Uint16Array([
6895
- 0,
6896
- 1,
6897
- 2,
6898
- 0,
6899
- 2,
6900
- 3,
6901
- 4,
6902
- 5,
6903
- 6,
6904
- 4,
6905
- 6,
6906
- 7,
6907
- 8,
6908
- 9,
6909
- 10,
6910
- 8,
6911
- 10,
6912
- 11,
6913
- 12,
6914
- 13,
6915
- 14,
6916
- 12,
6917
- 14,
6918
- 15,
6919
- 16,
6920
- 17,
6921
- 18,
6922
- 16,
6923
- 18,
6924
- 19,
6925
- 20,
6926
- 21,
6927
- 22,
6928
- 20,
6929
- 22,
6930
- 23
6931
- ]);
6932
- var CUBE_POSITIONS = new Float32Array([
6933
- -1,
6934
- -1,
6935
- 1,
6936
- 1,
6937
- -1,
6938
- 1,
6939
- 1,
6940
- 1,
6941
- 1,
6942
- -1,
6943
- 1,
6944
- 1,
6945
- -1,
6946
- -1,
6947
- -1,
6948
- -1,
6949
- 1,
6950
- -1,
6951
- 1,
6952
- 1,
6953
- -1,
6954
- 1,
6955
- -1,
6956
- -1,
6957
- -1,
6958
- 1,
6959
- -1,
6960
- -1,
6961
- 1,
6962
- 1,
6963
- 1,
6964
- 1,
6965
- 1,
6966
- 1,
6967
- 1,
6968
- -1,
6969
- -1,
6970
- -1,
6971
- -1,
6972
- 1,
6973
- -1,
6974
- -1,
6975
- 1,
6976
- -1,
6977
- 1,
6978
- -1,
6979
- -1,
6980
- 1,
6981
- 1,
6982
- -1,
6983
- -1,
6984
- 1,
6985
- 1,
6986
- -1,
6987
- 1,
6988
- 1,
6989
- 1,
6990
- 1,
6991
- -1,
6992
- 1,
6993
- -1,
6994
- -1,
6995
- -1,
6996
- -1,
6997
- -1,
6998
- 1,
6999
- -1,
7000
- 1,
7001
- 1,
7002
- -1,
7003
- 1,
7004
- -1
7005
- ]);
7006
- var CUBE_NORMALS = new Float32Array([
7007
- // Front face
7008
- 0,
7009
- 0,
7010
- 1,
7011
- 0,
7012
- 0,
7013
- 1,
7014
- 0,
7015
- 0,
7016
- 1,
7017
- 0,
7018
- 0,
7019
- 1,
7020
- // Back face
7021
- 0,
7022
- 0,
7023
- -1,
7024
- 0,
7025
- 0,
7026
- -1,
7027
- 0,
7028
- 0,
7029
- -1,
7030
- 0,
7031
- 0,
7032
- -1,
7033
- // Top face
7034
- 0,
7035
- 1,
7036
- 0,
7037
- 0,
7038
- 1,
7039
- 0,
7040
- 0,
7041
- 1,
7042
- 0,
7043
- 0,
7044
- 1,
7045
- 0,
7046
- // Bottom face
7047
- 0,
7048
- -1,
7049
- 0,
7050
- 0,
7051
- -1,
7052
- 0,
7053
- 0,
7054
- -1,
7055
- 0,
7056
- 0,
7057
- -1,
7058
- 0,
7059
- // Right face
7060
- 1,
7061
- 0,
7062
- 0,
7063
- 1,
7064
- 0,
7065
- 0,
7066
- 1,
7067
- 0,
7068
- 0,
7069
- 1,
7070
- 0,
7071
- 0,
7072
- // Left face
7073
- -1,
7074
- 0,
7075
- 0,
7076
- -1,
7077
- 0,
7078
- 0,
7079
- -1,
7080
- 0,
7081
- 0,
7082
- -1,
7083
- 0,
7084
- 0
7085
- ]);
7086
- var CUBE_TEX_COORDS = new Float32Array([
7087
- // Front face
7088
- 0,
7089
- 0,
7090
- 1,
7091
- 0,
7092
- 1,
7093
- 1,
7094
- 0,
7095
- 1,
7096
- // Back face
7097
- 1,
7098
- 0,
7099
- 1,
7100
- 1,
7101
- 0,
7102
- 1,
7103
- 0,
7104
- 0,
7105
- // Top face
7106
- 0,
7107
- 1,
7108
- 0,
7109
- 0,
7110
- 1,
7111
- 0,
7112
- 1,
7113
- 1,
7114
- // Bottom face
7115
- 1,
7116
- 1,
7117
- 0,
7118
- 1,
7119
- 0,
7120
- 0,
7121
- 1,
7122
- 0,
7123
- // Right face
7124
- 1,
7125
- 0,
7126
- 1,
7127
- 1,
7128
- 0,
7129
- 1,
7130
- 0,
7131
- 0,
7132
- // Left face
7133
- 0,
7134
- 0,
7135
- 1,
7136
- 0,
7137
- 1,
7138
- 1,
7139
- 0,
7140
- 1
7141
- ]);
7142
- var CUBE_FACE_INDICES = new Uint32Array([
7143
- 0,
7144
- 0,
7145
- 0,
7146
- 0,
7147
- 1,
7148
- 1,
7149
- 1,
7150
- 1,
7151
- 2,
7152
- 2,
7153
- 2,
7154
- 2,
7155
- 3,
7156
- 3,
7157
- 3,
7158
- 3,
7159
- 4,
7160
- 4,
7161
- 4,
7162
- 4,
7163
- 5,
7164
- 5,
7165
- 5,
7166
- 5
7167
- ]);
7168
- var CUBE_NON_INDEXED_POSITIONS = new Float32Array([
7169
- 1,
7170
- -1,
7171
- 1,
7172
- -1,
7173
- -1,
7174
- 1,
7175
- -1,
7176
- -1,
7177
- -1,
7178
- 1,
7179
- -1,
7180
- -1,
7181
- 1,
7182
- -1,
7183
- 1,
7184
- -1,
7185
- -1,
7186
- -1,
7187
- 1,
7188
- 1,
7189
- 1,
7190
- 1,
7191
- -1,
7192
- 1,
7193
- 1,
7194
- -1,
7195
- -1,
7196
- 1,
7197
- 1,
7198
- -1,
7199
- 1,
7200
- 1,
7201
- 1,
7202
- 1,
7203
- -1,
7204
- -1,
7205
- -1,
7206
- 1,
7207
- 1,
7208
- 1,
7209
- 1,
7210
- 1,
7211
- 1,
7212
- 1,
7213
- -1,
7214
- -1,
7215
- 1,
7216
- -1,
7217
- -1,
7218
- 1,
7219
- 1,
7220
- 1,
7221
- 1,
7222
- -1,
7223
- -1,
7224
- -1,
7225
- 1,
7226
- -1,
7227
- 1,
7228
- 1,
7229
- -1,
7230
- 1,
7231
- -1,
7232
- -1,
7233
- -1,
7234
- -1,
7235
- -1,
7236
- -1,
7237
- 1,
7238
- -1,
7239
- 1,
7240
- -1,
7241
- 1,
7242
- 1,
7243
- 1,
7244
- -1,
7245
- 1,
7246
- 1,
7247
- -1,
7248
- -1,
7249
- 1,
7250
- -1,
7251
- -1,
7252
- 1,
7253
- 1,
7254
- -1,
7255
- 1,
7256
- 1,
7257
- 1,
7258
- 1,
7259
- 1,
7260
- -1,
7261
- -1,
7262
- -1,
7263
- -1,
7264
- -1,
7265
- -1,
7266
- 1,
7267
- -1,
7268
- 1,
7269
- 1,
7270
- -1,
7271
- 1,
7272
- -1,
7273
- -1,
7274
- -1,
7275
- 1,
7276
- -1
7277
- ]);
7278
- var CUBE_NON_INDEXED_TEX_COORDS = new Float32Array([
7279
- 1,
7280
- 1,
7281
- 0,
7282
- 1,
7283
- 0,
7284
- 0,
7285
- 1,
7286
- 0,
7287
- 1,
7288
- 1,
7289
- 0,
7290
- 0,
7291
- 1,
7292
- 1,
7293
- 0,
7294
- 1,
7295
- 0,
7296
- 0,
7297
- 1,
7298
- 0,
7299
- 1,
7300
- 1,
7301
- 0,
7302
- 0,
7303
- 1,
7304
- 1,
7305
- 0,
7306
- 1,
7307
- 0,
7308
- 0,
7309
- 1,
7310
- 0,
7311
- 1,
7312
- 1,
7313
- 0,
7314
- 0,
7315
- 1,
7316
- 1,
7317
- 0,
7318
- 1,
7319
- 0,
7320
- 0,
7321
- 1,
7322
- 0,
7323
- 1,
7324
- 1,
7325
- 0,
7326
- 0,
7327
- 1,
7328
- 1,
7329
- 0,
7330
- 1,
7331
- 0,
7332
- 0,
7333
- 0,
7334
- 0,
7335
- 1,
7336
- 0,
7337
- 1,
7338
- 1,
7339
- 1,
7340
- 1,
7341
- 0,
7342
- 1,
7343
- 0,
7344
- 0,
7345
- 1,
7346
- 0,
7347
- 1,
7348
- 1,
7349
- 0,
7350
- 0
7351
- ]);
7352
- var CUBE_NON_INDEXED_COLORS = new Float32Array([
7353
- 1,
7354
- 0,
7355
- 1,
7356
- 1,
7357
- 0,
7358
- 0,
7359
- 1,
7360
- 1,
7361
- 0,
7362
- 0,
7363
- 0,
7364
- 1,
7365
- 1,
7366
- 0,
7367
- 0,
7368
- 1,
7369
- 1,
7370
- 0,
7371
- 1,
7372
- 1,
7373
- 0,
7374
- 0,
7375
- 0,
7376
- 1,
7377
- 1,
7378
- 1,
7379
- 1,
7380
- 1,
7381
- 1,
7382
- 0,
7383
- 1,
7384
- 1,
7385
- 1,
7386
- 0,
7387
- 0,
7388
- 1,
7389
- 1,
7390
- 1,
7391
- 0,
7392
- 1,
7393
- 1,
7394
- 1,
7395
- 1,
7396
- 1,
7397
- 1,
7398
- 0,
7399
- 0,
7400
- 1,
7401
- 0,
7402
- 1,
7403
- 1,
7404
- 1,
7405
- 1,
7406
- 1,
7407
- 1,
7408
- 1,
7409
- 1,
7410
- 1,
7411
- 0,
7412
- 1,
7413
- 0,
7414
- 1,
7415
- 0,
7416
- 1,
7417
- 0,
7418
- 1,
7419
- 1,
7420
- 1,
7421
- 1,
7422
- 1,
7423
- 0,
7424
- 1,
7425
- 0,
7426
- 0,
7427
- 1,
7428
- 1,
7429
- 0,
7430
- 1,
7431
- 1,
7432
- 1,
7433
- 0,
7434
- 1,
7435
- 0,
7436
- 1,
7437
- 0,
7438
- 0,
7439
- 0,
7440
- 1,
7441
- 0,
7442
- 0,
7443
- 1,
7444
- 1,
7445
- 0,
7446
- 1,
7447
- 0,
7448
- 1,
7449
- 1,
7450
- 1,
7451
- 1,
7452
- 1,
7453
- 0,
7454
- 1,
7455
- 1,
7456
- 1,
7457
- 0,
7458
- 0,
7459
- 1,
7460
- 1,
7461
- 0,
7462
- 0,
7463
- 1,
7464
- 1,
7465
- 1,
7466
- 0,
7467
- 1,
7468
- 1,
7469
- 1,
7470
- 1,
7471
- 1,
7472
- 1,
7473
- 1,
7474
- 0,
7475
- 0,
7476
- 1,
7477
- 0,
7478
- 0,
7479
- 0,
7480
- 1,
7481
- 0,
7482
- 1,
7483
- 0,
7484
- 1,
7485
- 1,
7486
- 1,
7487
- 0,
7488
- 1,
7489
- 1,
7490
- 0,
7491
- 0,
7492
- 1,
7493
- 0,
7494
- 1,
7495
- 0,
7496
- 1
7497
- ]);
7498
- var CUBE_NON_INDEXED_FACE_INDICES = new Uint32Array([
7499
- 3,
7500
- 3,
7501
- 3,
7502
- 3,
7503
- 3,
7504
- 3,
7505
- 4,
7506
- 4,
7507
- 4,
7508
- 4,
7509
- 4,
7510
- 4,
7511
- 2,
7512
- 2,
7513
- 2,
7514
- 2,
7515
- 2,
7516
- 2,
7517
- 5,
7518
- 5,
7519
- 5,
7520
- 5,
7521
- 5,
7522
- 5,
7523
- 0,
7524
- 0,
7525
- 0,
7526
- 0,
7527
- 0,
7528
- 0,
7529
- 1,
7530
- 1,
7531
- 1,
7532
- 1,
7533
- 1,
7534
- 1
7535
- ]);
7536
- var ATTRIBUTES = {
7537
- POSITION: { size: 3, value: CUBE_POSITIONS },
7538
- NORMAL: { size: 3, value: CUBE_NORMALS },
7539
- TEXCOORD_0: { size: 2, value: CUBE_TEX_COORDS },
7540
- faceIndex: { size: 1, value: CUBE_FACE_INDICES }
7541
- };
7542
- var NON_INDEXED_ATTRIBUTES = {
7543
- POSITION: { size: 3, value: CUBE_NON_INDEXED_POSITIONS },
7544
- // NORMAL: {size: 3, value: CUBE_NON_INDEXED_NORMALS},
7545
- TEXCOORD_0: { size: 2, value: CUBE_NON_INDEXED_TEX_COORDS },
7546
- COLOR_0: { size: 3, value: CUBE_NON_INDEXED_COLORS },
7547
- faceIndex: { size: 1, value: CUBE_NON_INDEXED_FACE_INDICES }
7548
- };
7549
-
7550
- // dist/geometries/cylinder-geometry.js
7551
- var CylinderGeometry = class extends TruncatedConeGeometry {
7552
- constructor(props = {}) {
7553
- const { id = uid("cylinder-geometry"), radius = 1 } = props;
7554
- super({
7555
- ...props,
7556
- id,
7557
- bottomRadius: radius,
7558
- topRadius: radius
7559
- });
7560
- }
7561
- };
7562
-
7563
- // dist/geometries/ico-sphere-geometry.js
7564
- var import_core26 = require("@math.gl/core");
7565
- var ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
7566
- 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];
7567
- var IcoSphereGeometry = class extends Geometry {
7568
- constructor(props = {}) {
7569
- const { id = uid("ico-sphere-geometry") } = props;
7570
- const { indices, attributes } = tesselateIcosaHedron(props);
7571
- super({
7572
- ...props,
7573
- id,
7574
- topology: "triangle-list",
7575
- indices,
7576
- attributes: { ...attributes, ...props.attributes }
7577
- });
7578
- }
7579
- };
7580
- function tesselateIcosaHedron(props) {
7581
- const { iterations = 0 } = props;
7582
- const PI = Math.PI;
7583
- const PI2 = PI * 2;
7584
- const positions = [...ICO_POSITIONS];
7585
- let indices = [...ICO_INDICES];
7586
- positions.push();
7587
- indices.push();
7588
- const getMiddlePoint = /* @__PURE__ */ (() => {
7589
- const pointMemo = {};
7590
- return (i1, i2) => {
7591
- i1 *= 3;
7592
- i2 *= 3;
7593
- const mini = i1 < i2 ? i1 : i2;
7594
- const maxi = i1 > i2 ? i1 : i2;
7595
- const key = `${mini}|${maxi}`;
7596
- if (key in pointMemo) {
7597
- return pointMemo[key];
7598
- }
7599
- const x1 = positions[i1];
7600
- const y1 = positions[i1 + 1];
7601
- const z1 = positions[i1 + 2];
7602
- const x2 = positions[i2];
7603
- const y2 = positions[i2 + 1];
7604
- const z2 = positions[i2 + 2];
7605
- let xm = (x1 + x2) / 2;
7606
- let ym = (y1 + y2) / 2;
7607
- let zm = (z1 + z2) / 2;
7608
- const len = Math.sqrt(xm * xm + ym * ym + zm * zm);
7609
- xm /= len;
7610
- ym /= len;
7611
- zm /= len;
7612
- positions.push(xm, ym, zm);
7613
- const pointIndex = positions.length / 3 - 1;
7614
- pointMemo[key] = pointIndex;
7615
- return pointIndex;
7616
- };
7617
- })();
7618
- for (let i = 0; i < iterations; i++) {
7619
- const indices2 = [];
7620
- for (let j = 0; j < indices.length; j += 3) {
7621
- const a = getMiddlePoint(indices[j + 0], indices[j + 1]);
7622
- const b = getMiddlePoint(indices[j + 1], indices[j + 2]);
7623
- const c = getMiddlePoint(indices[j + 2], indices[j + 0]);
7624
- indices2.push(c, indices[j + 0], a, a, indices[j + 1], b, b, indices[j + 2], c, a, b, c);
7625
- }
7626
- indices = indices2;
7627
- }
7628
- const normals = new Array(positions.length);
7629
- const texCoords = new Array(positions.length / 3 * 2);
7630
- const l = indices.length;
7631
- for (let i = l - 3; i >= 0; i -= 3) {
7632
- const i1 = indices[i + 0];
7633
- const i2 = indices[i + 1];
7634
- const i3 = indices[i + 2];
7635
- const in1 = i1 * 3;
7636
- const in2 = i2 * 3;
7637
- const in3 = i3 * 3;
7638
- const iu1 = i1 * 2;
7639
- const iu2 = i2 * 2;
7640
- const iu3 = i3 * 2;
7641
- const x1 = positions[in1 + 0];
7642
- const y1 = positions[in1 + 1];
7643
- const z1 = positions[in1 + 2];
7644
- const theta1 = Math.acos(z1 / Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1));
7645
- const phi1 = Math.atan2(y1, x1) + PI;
7646
- const v1 = theta1 / PI;
7647
- const u1 = 1 - phi1 / PI2;
7648
- const x2 = positions[in2 + 0];
7649
- const y2 = positions[in2 + 1];
7650
- const z2 = positions[in2 + 2];
7651
- const theta2 = Math.acos(z2 / Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2));
7652
- const phi2 = Math.atan2(y2, x2) + PI;
7653
- const v2 = theta2 / PI;
7654
- const u2 = 1 - phi2 / PI2;
7655
- const x3 = positions[in3 + 0];
7656
- const y3 = positions[in3 + 1];
7657
- const z3 = positions[in3 + 2];
7658
- const theta3 = Math.acos(z3 / Math.sqrt(x3 * x3 + y3 * y3 + z3 * z3));
7659
- const phi3 = Math.atan2(y3, x3) + PI;
7660
- const v3 = theta3 / PI;
7661
- const u3 = 1 - phi3 / PI2;
7662
- const vec1 = [x3 - x2, y3 - y2, z3 - z2];
7663
- const vec2 = [x1 - x2, y1 - y2, z1 - z2];
7664
- const normal = new import_core26.Vector3(vec1).cross(vec2).normalize();
7665
- let newIndex;
7666
- if ((u1 === 0 || u2 === 0 || u3 === 0) && (u1 === 0 || u1 > 0.5) && (u2 === 0 || u2 > 0.5) && (u3 === 0 || u3 > 0.5)) {
7667
- positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]);
7668
- newIndex = positions.length / 3 - 1;
7669
- indices.push(newIndex);
7670
- texCoords[newIndex * 2 + 0] = 1;
7671
- texCoords[newIndex * 2 + 1] = v1;
7672
- normals[newIndex * 3 + 0] = normal.x;
7673
- normals[newIndex * 3 + 1] = normal.y;
7674
- normals[newIndex * 3 + 2] = normal.z;
7675
- positions.push(positions[in2 + 0], positions[in2 + 1], positions[in2 + 2]);
7676
- newIndex = positions.length / 3 - 1;
7677
- indices.push(newIndex);
7678
- texCoords[newIndex * 2 + 0] = 1;
7679
- texCoords[newIndex * 2 + 1] = v2;
7680
- normals[newIndex * 3 + 0] = normal.x;
7681
- normals[newIndex * 3 + 1] = normal.y;
7682
- normals[newIndex * 3 + 2] = normal.z;
7683
- positions.push(positions[in3 + 0], positions[in3 + 1], positions[in3 + 2]);
7684
- newIndex = positions.length / 3 - 1;
7685
- indices.push(newIndex);
7686
- texCoords[newIndex * 2 + 0] = 1;
7687
- texCoords[newIndex * 2 + 1] = v3;
7688
- normals[newIndex * 3 + 0] = normal.x;
7689
- normals[newIndex * 3 + 1] = normal.y;
7690
- normals[newIndex * 3 + 2] = normal.z;
7691
- }
7692
- normals[in1 + 0] = normals[in2 + 0] = normals[in3 + 0] = normal.x;
7693
- normals[in1 + 1] = normals[in2 + 1] = normals[in3 + 1] = normal.y;
7694
- normals[in1 + 2] = normals[in2 + 2] = normals[in3 + 2] = normal.z;
7695
- texCoords[iu1 + 0] = u1;
7696
- texCoords[iu1 + 1] = v1;
7697
- texCoords[iu2 + 0] = u2;
7698
- texCoords[iu2 + 1] = v2;
7699
- texCoords[iu3 + 0] = u3;
7700
- texCoords[iu3 + 1] = v3;
7701
- }
7702
- return {
7703
- indices: { size: 1, value: new Uint16Array(indices) },
7704
- attributes: {
7705
- POSITION: { size: 3, value: new Float32Array(positions) },
7706
- NORMAL: { size: 3, value: new Float32Array(normals) },
7707
- TEXCOORD_0: { size: 2, value: new Float32Array(texCoords) }
7708
- }
7709
- };
7710
- }
7711
-
7712
- // dist/geometries/plane-geometry.js
7713
- var PlaneGeometry = class extends Geometry {
7714
- constructor(props = {}) {
7715
- const { id = uid("plane-geometry") } = props;
7716
- const { indices, attributes } = tesselatePlane(props);
7717
- super({
7718
- ...props,
7719
- id,
7720
- topology: "triangle-list",
7721
- indices,
7722
- attributes: { ...attributes, ...props.attributes }
7723
- });
7724
- }
7725
- };
7726
- function tesselatePlane(props) {
7727
- const { type = "x,y", offset = 0, flipCull = false, unpack = false } = props;
7728
- const coords = type.split(",");
7729
- let c1len = props[`${coords[0]}len`] || 1;
7730
- const c2len = props[`${coords[1]}len`] || 1;
7731
- const subdivisions1 = props[`n${coords[0]}`] || 1;
7732
- const subdivisions2 = props[`n${coords[1]}`] || 1;
7733
- const numVertices = (subdivisions1 + 1) * (subdivisions2 + 1);
7734
- const positions = new Float32Array(numVertices * 3);
7735
- const normals = new Float32Array(numVertices * 3);
7736
- const texCoords = new Float32Array(numVertices * 2);
7737
- if (flipCull) {
7738
- c1len = -c1len;
7739
- }
7740
- let i2 = 0;
7741
- let i3 = 0;
7742
- for (let z = 0; z <= subdivisions2; z++) {
7743
- for (let x = 0; x <= subdivisions1; x++) {
7744
- const u = x / subdivisions1;
7745
- const v = z / subdivisions2;
7746
- texCoords[i2 + 0] = flipCull ? 1 - u : u;
7747
- texCoords[i2 + 1] = v;
7748
- switch (type) {
7749
- case "x,y":
7750
- positions[i3 + 0] = c1len * u - c1len * 0.5;
7751
- positions[i3 + 1] = c2len * v - c2len * 0.5;
7752
- positions[i3 + 2] = offset;
7753
- normals[i3 + 0] = 0;
7754
- normals[i3 + 1] = 0;
7755
- normals[i3 + 2] = flipCull ? 1 : -1;
7756
- break;
7757
- case "x,z":
7758
- positions[i3 + 0] = c1len * u - c1len * 0.5;
7759
- positions[i3 + 1] = offset;
7760
- positions[i3 + 2] = c2len * v - c2len * 0.5;
7761
- normals[i3 + 0] = 0;
7762
- normals[i3 + 1] = flipCull ? 1 : -1;
7763
- normals[i3 + 2] = 0;
7764
- break;
7765
- case "y,z":
7766
- positions[i3 + 0] = offset;
7767
- positions[i3 + 1] = c1len * u - c1len * 0.5;
7768
- positions[i3 + 2] = c2len * v - c2len * 0.5;
7769
- normals[i3 + 0] = flipCull ? 1 : -1;
7770
- normals[i3 + 1] = 0;
7771
- normals[i3 + 2] = 0;
7772
- break;
7773
- default:
7774
- throw new Error("PlaneGeometry: unknown type");
7775
- }
7776
- i2 += 2;
7777
- i3 += 3;
7778
- }
7779
- }
7780
- const numVertsAcross = subdivisions1 + 1;
7781
- const indices = new Uint16Array(subdivisions1 * subdivisions2 * 6);
7782
- for (let z = 0; z < subdivisions2; z++) {
7783
- for (let x = 0; x < subdivisions1; x++) {
7784
- const index = (z * subdivisions1 + x) * 6;
7785
- indices[index + 0] = (z + 0) * numVertsAcross + x;
7786
- indices[index + 1] = (z + 1) * numVertsAcross + x;
7787
- indices[index + 2] = (z + 0) * numVertsAcross + x + 1;
7788
- indices[index + 3] = (z + 1) * numVertsAcross + x;
7789
- indices[index + 4] = (z + 1) * numVertsAcross + x + 1;
7790
- indices[index + 5] = (z + 0) * numVertsAcross + x + 1;
7791
- }
7792
- }
7793
- const geometry = {
7794
- indices: { size: 1, value: indices },
7795
- attributes: {
7796
- POSITION: { size: 3, value: positions },
7797
- NORMAL: { size: 3, value: normals },
7798
- TEXCOORD_0: { size: 2, value: texCoords }
7799
- }
7800
- };
7801
- return unpack ? unpackIndexedGeometry(geometry) : geometry;
7802
- }
7803
-
7804
6744
  // dist/application-utils/random.js
7805
6745
  function makeRandomGenerator() {
7806
6746
  let s = 1;
@@ -7863,7 +6803,7 @@ function isAbsoluteLoadFileUrl(url) {
7863
6803
  }
7864
6804
 
7865
6805
  // dist/dynamic-texture/video-texture.js
7866
- var import_core27 = require("@luma.gl/core");
6806
+ var import_core26 = require("@luma.gl/core");
7867
6807
  var VideoTexture = class {
7868
6808
  /** Device used to create copied and native external texture bindings. */
7869
6809
  device;
@@ -7912,7 +6852,7 @@ var VideoTexture = class {
7912
6852
  * @param props Live video source and copied texture options.
7913
6853
  */
7914
6854
  constructor(device, props) {
7915
- (0, import_core27.assert)(isHTMLVideoElementSource(props == null ? void 0 : props.source) || isVideoFrameSource(props == null ? void 0 : props.source));
6855
+ (0, import_core26.assert)(isHTMLVideoElementSource(props == null ? void 0 : props.source) || isVideoFrameSource(props == null ? void 0 : props.source));
7916
6856
  this.device = device;
7917
6857
  this.id = props.id || uid("video-texture");
7918
6858
  this._source = props.source;
@@ -7926,7 +6866,7 @@ var VideoTexture = class {
7926
6866
  * @param source Next caller-owned video source to follow.
7927
6867
  */
7928
6868
  setSource(source4) {
7929
- (0, import_core27.assert)(isHTMLVideoElementSource(source4) || isVideoFrameSource(source4));
6869
+ (0, import_core26.assert)(isHTMLVideoElementSource(source4) || isVideoFrameSource(source4));
7930
6870
  this._destroyExternalTexture();
7931
6871
  this._source = source4;
7932
6872
  this._sourceVersion++;
@@ -8006,7 +6946,7 @@ var VideoTexture = class {
8006
6946
  width: size.width,
8007
6947
  height: size.height,
8008
6948
  format: "rgba8unorm",
8009
- usage: import_core27.Texture.SAMPLE | import_core27.Texture.COPY_DST,
6949
+ usage: import_core26.Texture.SAMPLE | import_core26.Texture.COPY_DST,
8010
6950
  mipLevels: 1,
8011
6951
  sampler: this._sampler
8012
6952
  });
@@ -8042,7 +6982,7 @@ var VideoTexture = class {
8042
6982
  */
8043
6983
  _getResolvedSize() {
8044
6984
  const size = getVideoTextureSourceSize(this._source);
8045
- (0, import_core27.assert)(size.width > 0 && size.height > 0);
6985
+ (0, import_core26.assert)(size.width > 0 && size.height > 0);
8046
6986
  return size;
8047
6987
  }
8048
6988
  /** Observes current source readiness and frame identity before binding resolution. */
@@ -8107,11 +7047,11 @@ function getVideoTextureSourceFrameToken(source4, sourceVersion) {
8107
7047
  }
8108
7048
 
8109
7049
  // dist/passes/shader-pass-renderer.js
8110
- var import_core30 = require("@luma.gl/core");
7050
+ var import_core29 = require("@luma.gl/core");
8111
7051
  var import_shadertools7 = require("@luma.gl/shadertools");
8112
7052
 
8113
7053
  // dist/compute/swap.js
8114
- var import_core28 = require("@luma.gl/core");
7054
+ var import_core27 = require("@luma.gl/core");
8115
7055
  var Swap = class {
8116
7056
  id;
8117
7057
  /** The current resource - usually the source for renders or computations */
@@ -8144,7 +7084,7 @@ var SwapFramebuffers = class extends Swap {
8144
7084
  let colorAttachments = (_a = props.colorAttachments) == null ? void 0 : _a.map((colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
8145
7085
  id: `${props.id}-texture-0`,
8146
7086
  format: colorAttachment,
8147
- usage: import_core28.Texture.SAMPLE | import_core28.Texture.RENDER | import_core28.Texture.COPY_SRC | import_core28.Texture.COPY_DST,
7087
+ usage: import_core27.Texture.SAMPLE | import_core27.Texture.RENDER | import_core27.Texture.COPY_SRC | import_core27.Texture.COPY_DST,
8148
7088
  width,
8149
7089
  height
8150
7090
  }));
@@ -8152,7 +7092,7 @@ var SwapFramebuffers = class extends Swap {
8152
7092
  colorAttachments = (_b = props.colorAttachments) == null ? void 0 : _b.map((colorAttachment) => typeof colorAttachment !== "string" ? colorAttachment : device.createTexture({
8153
7093
  id: `${props.id}-texture-1`,
8154
7094
  format: colorAttachment,
8155
- usage: import_core28.Texture.SAMPLE | import_core28.Texture.RENDER | import_core28.Texture.COPY_SRC | import_core28.Texture.COPY_DST,
7095
+ usage: import_core27.Texture.SAMPLE | import_core27.Texture.RENDER | import_core27.Texture.COPY_SRC | import_core27.Texture.COPY_DST,
8156
7096
  width,
8157
7097
  height
8158
7098
  }));
@@ -8215,7 +7155,7 @@ var SwapBuffers = class extends Swap {
8215
7155
  };
8216
7156
 
8217
7157
  // dist/compute/computation.js
8218
- var import_core29 = require("@luma.gl/core");
7158
+ var import_core28 = require("@luma.gl/core");
8219
7159
  var import_shadertools6 = require("@luma.gl/shadertools");
8220
7160
  var import_types2 = require("@math.gl/types");
8221
7161
  var LOG_DRAW_PRIORITY2 = 2;
@@ -8228,14 +7168,14 @@ var Computation = class _Computation {
8228
7168
  * constructor remains the synchronous compatibility path.
8229
7169
  */
8230
7170
  static async createAsync(device, props) {
8231
- const ownsCompilation = !import_core29.PipelineFactory.getAsyncCompilation(device);
8232
- const asyncCompilation = ownsCompilation ? import_core29.PipelineFactory.beginAsyncCompilation(device) : import_core29.PipelineFactory.getAsyncCompilation(device);
7171
+ const ownsCompilation = !import_core28.PipelineFactory.getAsyncCompilation(device);
7172
+ const asyncCompilation = ownsCompilation ? import_core28.PipelineFactory.beginAsyncCompilation(device) : import_core28.PipelineFactory.getAsyncCompilation(device);
8233
7173
  let computation;
8234
7174
  try {
8235
7175
  computation = new _Computation(device, props);
8236
7176
  } finally {
8237
7177
  if (ownsCompilation)
8238
- import_core29.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
7178
+ import_core28.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
8239
7179
  }
8240
7180
  try {
8241
7181
  if (ownsCompilation) {
@@ -8250,7 +7190,7 @@ var Computation = class _Computation {
8250
7190
  }
8251
7191
  }
8252
7192
  static defaultProps = {
8253
- ...import_core29.ComputePipeline.defaultProps,
7193
+ ...import_core28.ComputePipeline.defaultProps,
8254
7194
  id: "unnamed",
8255
7195
  handle: void 0,
8256
7196
  userData: {},
@@ -8314,10 +7254,10 @@ var Computation = class _Computation {
8314
7254
  const modules = mergeShaderModules(this.props.modules, (_a = this.shaderInputs) == null ? void 0 : _a.getModules());
8315
7255
  const defines = { ...resolvedPlugins.defines, ...this.props.defines };
8316
7256
  this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout, modules) || null;
8317
- this.pipelineFactory = props.pipelineFactory || import_core29.PipelineFactory.getDefaultPipelineFactory(this.device);
8318
- this.shaderFactory = props.shaderFactory || import_core29.ShaderFactory.getDefaultShaderFactory(this.device);
7257
+ this.pipelineFactory = props.pipelineFactory || import_core28.PipelineFactory.getDefaultPipelineFactory(this.device);
7258
+ this.shaderFactory = props.shaderFactory || import_core28.ShaderFactory.getDefaultShaderFactory(this.device);
8319
7259
  const shaderAssembler = this.props.shaderAssembler;
8320
- (0, import_core29.assert)(shaderAssembler instanceof import_shadertools6.WGSLShaderAssembler);
7260
+ (0, import_core28.assert)(shaderAssembler instanceof import_shadertools6.WGSLShaderAssembler);
8321
7261
  const { source: source4, getUniforms: getUniforms2, entryPoints = {}, shaderLayout: assembledShaderLayout } = shaderAssembler.assembleWGSLShader({
8322
7262
  platformInfo,
8323
7263
  ...this.props,
@@ -8333,7 +7273,7 @@ var Computation = class _Computation {
8333
7273
  this._getModuleUniforms = getUniforms2;
8334
7274
  const inferredShaderLayout = assembledShaderLayout ?? ((_b = device.getShaderLayout) == null ? void 0 : _b.call(device, this.source, { scanVertexAttributes: false }));
8335
7275
  this.props.shaderLayout = mergeShaderModuleBindingsIntoLayout(this.props.shaderLayout || inferredShaderLayout || null, modules) || null;
8336
- const asyncCompilation = import_core29.PipelineFactory.getAsyncCompilation(this.device);
7276
+ const asyncCompilation = import_core28.PipelineFactory.getAsyncCompilation(this.device);
8337
7277
  if (asyncCompilation) {
8338
7278
  this._pipelineInitialization = this._updatePipelineAsync();
8339
7279
  asyncCompilation.push(this._pipelineInitialization);
@@ -8403,7 +7343,7 @@ var Computation = class _Computation {
8403
7343
  }
8404
7344
  setShaderInputs(shaderInputs) {
8405
7345
  this.shaderInputs = shaderInputs;
8406
- this._uniformStore = new import_core29.UniformStore(this.device, this.shaderInputs.modules);
7346
+ this._uniformStore = new import_core28.UniformStore(this.device, this.shaderInputs.modules);
8407
7347
  for (const [moduleName, module2] of Object.entries(this.shaderInputs.modules)) {
8408
7348
  if (shaderModuleHasUniforms(module2)) {
8409
7349
  const uniformBuffer = this._uniformStore.getManagedUniformBuffer(moduleName);
@@ -8473,7 +7413,7 @@ var Computation = class _Computation {
8473
7413
  return null;
8474
7414
  const previousShader = this.pipeline ? this.shader : null;
8475
7415
  if (this.pipeline) {
8476
- import_core29.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
7416
+ import_core28.log.log(1, `Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)();
8477
7417
  }
8478
7418
  this._pipelineNeedsUpdate = false;
8479
7419
  this.shader = this.shaderFactory.createShader({
@@ -8492,27 +7432,27 @@ var Computation = class _Computation {
8492
7432
  _lastLogTime = 0;
8493
7433
  _logOpen = false;
8494
7434
  _logDrawCallStart() {
8495
- const logDrawTimeout = import_core29.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT2;
8496
- if (import_core29.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
7435
+ const logDrawTimeout = import_core28.log.level > 3 ? 0 : LOG_DRAW_TIMEOUT2;
7436
+ if (import_core28.log.level < 2 || Date.now() - this._lastLogTime < logDrawTimeout) {
8497
7437
  return;
8498
7438
  }
8499
7439
  this._lastLogTime = Date.now();
8500
7440
  this._logOpen = true;
8501
- import_core29.log.group(LOG_DRAW_PRIORITY2, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core29.log.level <= 2 })();
7441
+ import_core28.log.group(LOG_DRAW_PRIORITY2, `>>> DRAWING MODEL ${this.id}`, { collapsed: import_core28.log.level <= 2 })();
8502
7442
  }
8503
7443
  _logDrawCallEnd() {
8504
7444
  if (this._logOpen) {
8505
7445
  const uniformTable = this.shaderInputs.getDebugTable();
8506
- import_core29.log.table(LOG_DRAW_PRIORITY2, uniformTable)();
8507
- import_core29.log.groupEnd(LOG_DRAW_PRIORITY2)();
7446
+ import_core28.log.table(LOG_DRAW_PRIORITY2, uniformTable)();
7447
+ import_core28.log.groupEnd(LOG_DRAW_PRIORITY2)();
8508
7448
  this._logOpen = false;
8509
7449
  }
8510
7450
  }
8511
7451
  _drawCount = 0;
8512
7452
  // TODO - fix typing of luma data types
8513
7453
  _getBufferOrConstantValues(attribute, dataType) {
8514
- const TypedArrayConstructor = import_core29.dataTypeDecoder.getTypedArrayConstructor(dataType);
8515
- const typedArray = attribute instanceof import_core29.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
7454
+ const TypedArrayConstructor = import_core28.dataTypeDecoder.getTypedArrayConstructor(dataType);
7455
+ const typedArray = attribute instanceof import_core28.Buffer ? new TypedArrayConstructor(attribute.debugData) : attribute;
8516
7456
  return typedArray.toString();
8517
7457
  }
8518
7458
  };
@@ -9048,7 +7988,7 @@ var CompositeShaderPassComputeRenderer = class {
9048
7988
  this.parameterBuffer = device.createBuffer({
9049
7989
  id: `${optimization.name}-parameters`,
9050
7990
  byteLength: Math.max(Math.ceil(optimization.uniformNames.length / 4) * 16, 16),
9051
- usage: import_core30.Buffer.UNIFORM | import_core30.Buffer.COPY_DST
7991
+ usage: import_core29.Buffer.UNIFORM | import_core29.Buffer.COPY_DST
9052
7992
  });
9053
7993
  const outputBindings = Object.entries(optimization.outputs).map(([bindingName, targetName], outputIndex) => ({
9054
7994
  name: bindingName,
@@ -9308,7 +8248,7 @@ function createTargetResources(device, name, spec, targetSize) {
9308
8248
  width: targetSize[0],
9309
8249
  height: targetSize[1],
9310
8250
  format: spec.format || device.preferredColorFormat,
9311
- usage: import_core30.Texture.SAMPLE | import_core30.Texture.RENDER | import_core30.Texture.COPY_SRC | import_core30.Texture.COPY_DST | (spec.storage && device.type === "webgpu" && device.getTextureFormatCapabilities(spec.format || device.preferredColorFormat).store ? import_core30.Texture.STORAGE : 0),
8251
+ usage: import_core29.Texture.SAMPLE | import_core29.Texture.RENDER | import_core29.Texture.COPY_SRC | import_core29.Texture.COPY_DST | (spec.storage && device.type === "webgpu" && device.getTextureFormatCapabilities(spec.format || device.preferredColorFormat).store ? import_core29.Texture.STORAGE : 0),
9312
8252
  ...spec.sampler ? { sampler: spec.sampler } : {}
9313
8253
  });
9314
8254
  const framebuffer = device.createFramebuffer({
@@ -9364,18 +8304,18 @@ function calculateTextureScale(sourceTexture, outputTexture) {
9364
8304
  }
9365
8305
 
9366
8306
  // dist/compute/kernel.js
9367
- var import_core31 = require("@luma.gl/core");
8307
+ var import_core30 = require("@luma.gl/core");
9368
8308
  var Kernel = class _Kernel {
9369
8309
  /** Creates a kernel while allowing the backend to compile its pipeline asynchronously. */
9370
8310
  static async createAsync(device, props) {
9371
- const ownsCompilation = !import_core31.PipelineFactory.getAsyncCompilation(device);
9372
- const asyncCompilation = ownsCompilation ? import_core31.PipelineFactory.beginAsyncCompilation(device) : import_core31.PipelineFactory.getAsyncCompilation(device);
8311
+ const ownsCompilation = !import_core30.PipelineFactory.getAsyncCompilation(device);
8312
+ const asyncCompilation = ownsCompilation ? import_core30.PipelineFactory.beginAsyncCompilation(device) : import_core30.PipelineFactory.getAsyncCompilation(device);
9373
8313
  let kernel;
9374
8314
  try {
9375
8315
  kernel = new _Kernel(device, props);
9376
8316
  } finally {
9377
8317
  if (ownsCompilation)
9378
- import_core31.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
8318
+ import_core30.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
9379
8319
  }
9380
8320
  try {
9381
8321
  if (ownsCompilation) {
@@ -9406,8 +8346,8 @@ var Kernel = class _Kernel {
9406
8346
  this.device = device;
9407
8347
  this.id = props.id ?? "kernel";
9408
8348
  this.source = source4;
9409
- this.pipelineFactory = pipelineFactory ?? import_core31.PipelineFactory.getDefaultPipelineFactory(device);
9410
- this.shaderFactory = shaderFactory ?? import_core31.ShaderFactory.getDefaultShaderFactory(device);
8349
+ this.pipelineFactory = pipelineFactory ?? import_core30.PipelineFactory.getDefaultPipelineFactory(device);
8350
+ this.shaderFactory = shaderFactory ?? import_core30.ShaderFactory.getDefaultShaderFactory(device);
9411
8351
  this.shader = this.shaderFactory.createShader({
9412
8352
  id: `${this.id}-compute`,
9413
8353
  stage: "compute",
@@ -9415,7 +8355,7 @@ var Kernel = class _Kernel {
9415
8355
  debugShaders
9416
8356
  });
9417
8357
  const computePipelineProps = { ...pipelineProps, shader: this.shader };
9418
- const asyncCompilation = import_core31.PipelineFactory.getAsyncCompilation(device);
8358
+ const asyncCompilation = import_core30.PipelineFactory.getAsyncCompilation(device);
9419
8359
  if (asyncCompilation) {
9420
8360
  const pipelineInitialization = this.pipelineFactory.createComputePipelineAsync(computePipelineProps);
9421
8361
  this._pipelineInitialization = pipelineInitialization;
@@ -9452,18 +8392,18 @@ var Kernel = class _Kernel {
9452
8392
  };
9453
8393
 
9454
8394
  // dist/compute/render-kernel.js
9455
- var import_core32 = require("@luma.gl/core");
8395
+ var import_core31 = require("@luma.gl/core");
9456
8396
  var RenderKernel = class _RenderKernel {
9457
8397
  /** Creates a render kernel while allowing the backend to compile its pipeline asynchronously. */
9458
8398
  static async createAsync(device, props) {
9459
- const ownsCompilation = !import_core32.PipelineFactory.getAsyncCompilation(device);
9460
- const asyncCompilation = ownsCompilation ? import_core32.PipelineFactory.beginAsyncCompilation(device) : import_core32.PipelineFactory.getAsyncCompilation(device);
8399
+ const ownsCompilation = !import_core31.PipelineFactory.getAsyncCompilation(device);
8400
+ const asyncCompilation = ownsCompilation ? import_core31.PipelineFactory.beginAsyncCompilation(device) : import_core31.PipelineFactory.getAsyncCompilation(device);
9461
8401
  let kernel;
9462
8402
  try {
9463
8403
  kernel = new _RenderKernel(device, props);
9464
8404
  } finally {
9465
8405
  if (ownsCompilation)
9466
- import_core32.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
8406
+ import_core31.PipelineFactory.endAsyncCompilation(device, asyncCompilation);
9467
8407
  }
9468
8408
  try {
9469
8409
  if (ownsCompilation) {
@@ -9497,8 +8437,8 @@ var RenderKernel = class _RenderKernel {
9497
8437
  this.id = props.id ?? "render-kernel";
9498
8438
  this.vertexSource = vertexSource;
9499
8439
  this.fragmentSource = fragmentSource;
9500
- this.pipelineFactory = pipelineFactory ?? import_core32.PipelineFactory.getDefaultPipelineFactory(device);
9501
- this.shaderFactory = shaderFactory ?? import_core32.ShaderFactory.getDefaultShaderFactory(device);
8440
+ this.pipelineFactory = pipelineFactory ?? import_core31.PipelineFactory.getDefaultPipelineFactory(device);
8441
+ this.shaderFactory = shaderFactory ?? import_core31.ShaderFactory.getDefaultShaderFactory(device);
9502
8442
  this.vertexShader = this.shaderFactory.createShader({
9503
8443
  id: `${this.id}-vertex`,
9504
8444
  stage: "vertex",
@@ -9516,7 +8456,7 @@ var RenderKernel = class _RenderKernel {
9516
8456
  vs: this.vertexShader,
9517
8457
  fs: this.fragmentShader
9518
8458
  };
9519
- const asyncCompilation = import_core32.PipelineFactory.getAsyncCompilation(device);
8459
+ const asyncCompilation = import_core31.PipelineFactory.getAsyncCompilation(device);
9520
8460
  if (asyncCompilation) {
9521
8461
  const pipelineInitialization = this.pipelineFactory.createRenderPipelineAsync(renderPipelineProps);
9522
8462
  this._pipelineInitialization = pipelineInitialization;
@@ -9564,7 +8504,7 @@ var RenderKernel = class _RenderKernel {
9564
8504
  };
9565
8505
 
9566
8506
  // dist/modules/picking/picking-manager.js
9567
- var import_core33 = require("@luma.gl/core");
8507
+ var import_core32 = require("@luma.gl/core");
9568
8508
 
9569
8509
  // dist/modules/picking/picking-uniforms.js
9570
8510
  var DEFAULT_HIGHLIGHT_COLOR = [0, 1, 1, 1];
@@ -9823,13 +8763,13 @@ var PickingManager = class _PickingManager {
9823
8763
  format: "rgba8unorm",
9824
8764
  width: 1,
9825
8765
  height: 1,
9826
- usage: import_core33.Texture.RENDER_ATTACHMENT
8766
+ usage: import_core32.Texture.RENDER_ATTACHMENT
9827
8767
  });
9828
8768
  const pickingTexture = this.device.createTexture({
9829
8769
  format: "rg32sint",
9830
8770
  width: 1,
9831
8771
  height: 1,
9832
- usage: import_core33.Texture.RENDER_ATTACHMENT | import_core33.Texture.COPY_SRC
8772
+ usage: import_core32.Texture.RENDER_ATTACHMENT | import_core32.Texture.COPY_SRC
9833
8773
  });
9834
8774
  return this.device.createFramebuffer({
9835
8775
  colorAttachments: [colorTexture, pickingTexture],
@@ -9841,7 +8781,7 @@ var PickingManager = class _PickingManager {
9841
8781
  format: "rgba8unorm",
9842
8782
  width: 1,
9843
8783
  height: 1,
9844
- usage: import_core33.Texture.RENDER_ATTACHMENT | import_core33.Texture.COPY_SRC
8784
+ usage: import_core32.Texture.RENDER_ATTACHMENT | import_core32.Texture.COPY_SRC
9845
8785
  });
9846
8786
  return this.device.createFramebuffer({
9847
8787
  colorAttachments: [pickingTexture],
@@ -9865,7 +8805,7 @@ var PickingManager = class _PickingManager {
9865
8805
  const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
9866
8806
  const readBuffer = this.device.createBuffer({
9867
8807
  byteLength: layout.byteLength,
9868
- usage: import_core33.Buffer.COPY_DST | import_core33.Buffer.MAP_READ
8808
+ usage: import_core32.Buffer.COPY_DST | import_core32.Buffer.MAP_READ
9869
8809
  });
9870
8810
  try {
9871
8811
  pickTexture.readBuffer({
@@ -9899,7 +8839,7 @@ var PickingManager = class _PickingManager {
9899
8839
  const layout = pickTexture.computeMemoryLayout({ width: 1, height: 1 });
9900
8840
  const readBuffer = this.device.createBuffer({
9901
8841
  byteLength: layout.byteLength,
9902
- usage: import_core33.Buffer.COPY_DST | import_core33.Buffer.MAP_READ
8842
+ usage: import_core32.Buffer.COPY_DST | import_core32.Buffer.MAP_READ
9903
8843
  });
9904
8844
  try {
9905
8845
  pickTexture.readBuffer({