@luma.gl/engine 9.0.0-alpha.26 → 9.0.0-alpha.27

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.
package/dist/dist.dev.js CHANGED
@@ -2028,6 +2028,7 @@ var __exports__ = (() => {
2028
2028
  };
2029
2029
  /** Set attributes (stored on pipeline and set before each call) */
2030
2030
  /** Set attributes (stored on pipeline and set before each call) */
2031
+ /** Set constant attributes (WebGL only) */
2031
2032
  /** Set bindings (stored on pipeline and set before each call) */
2032
2033
  /** Uniforms (only supported on WebGL devices. Reset before each call to enable pipeline sharing) */
2033
2034
  /** Draw call */
@@ -2433,6 +2434,43 @@ var __exports__ = (() => {
2433
2434
  });
2434
2435
  }
2435
2436
 
2437
+ // ../api/src/lib/utils/array-utils-flat.ts
2438
+ var arrayBuffer;
2439
+ function getScratchArrayBuffer(byteLength) {
2440
+ if (!arrayBuffer || arrayBuffer.byteLength < byteLength) {
2441
+ arrayBuffer = new ArrayBuffer(byteLength);
2442
+ }
2443
+ return arrayBuffer;
2444
+ }
2445
+ function getScratchArray(Type, length) {
2446
+ const scratchArrayBuffer = getScratchArrayBuffer(Type.BYTES_PER_ELEMENT * length);
2447
+ return new Type(scratchArrayBuffer, 0, length);
2448
+ }
2449
+ function fillArray(options) {
2450
+ const {
2451
+ target,
2452
+ source,
2453
+ start = 0,
2454
+ count = 1
2455
+ } = options;
2456
+ const length = source.length;
2457
+ const total = count * length;
2458
+ let copied = 0;
2459
+ for (let i = start; copied < length; copied++) {
2460
+ target[i++] = source[copied];
2461
+ }
2462
+ while (copied < total) {
2463
+ if (copied < total - copied) {
2464
+ target.copyWithin(start + copied, start, start + copied);
2465
+ copied *= 2;
2466
+ } else {
2467
+ target.copyWithin(start + copied, start, start + total - copied);
2468
+ copied = total;
2469
+ }
2470
+ }
2471
+ return options.target;
2472
+ }
2473
+
2436
2474
  // ../api/src/lib/request-animation-frame.ts
2437
2475
  function requestAnimationFrame(callback) {
2438
2476
  return typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame(callback) : setTimeout(callback, 1e3 / 60);
@@ -5916,18 +5954,49 @@ void main() {
5916
5954
  this.pipeline.setIndexBuffer(indices);
5917
5955
  return this;
5918
5956
  }
5919
- setAttributes(attributes) {
5920
- if (attributes.indices) {
5921
- this.setIndexBuffer(attributes.indices);
5922
- attributes = {
5923
- ...attributes
5924
- };
5925
- delete attributes.indices;
5957
+ // Temporary hack to support deck.gl's dependency on luma.gl v8 Model attribute API.
5958
+ _splitAttributes(attributes, filterBuffers) {
5959
+ const bufferAttributes = {};
5960
+ const constantAttributes = {};
5961
+ const indices = attributes.indices;
5962
+ delete attributes.indices;
5963
+ for (const name in attributes) {
5964
+ let attribute = attributes[name];
5965
+ if (attribute instanceof Buffer2) {
5966
+ bufferAttributes[name] = attribute;
5967
+ continue;
5968
+ }
5969
+ if (attribute.getValue) {
5970
+ attribute = attribute.getValue();
5971
+ console.warn(`attribute ${name}: getValue() will be removed`);
5972
+ }
5973
+ if (ArrayBuffer.isView(attribute) && !attribute) {
5974
+ constantAttributes[name] = attribute;
5975
+ continue;
5976
+ }
5977
+ if (filterBuffers && attribute[name]._buffer) {
5978
+ buffer[name] = attribute[name]._buffer;
5979
+ }
5980
+ }
5981
+ return {
5982
+ bufferAttributes,
5983
+ constantAttributes,
5984
+ indices
5985
+ };
5986
+ }
5987
+ setAttributes(attributes, filterBuffers) {
5988
+ const {
5989
+ bufferAttributes,
5990
+ constantAttributes,
5991
+ indices
5992
+ } = this._splitAttributes(attributes, filterBuffers);
5993
+ if (indices) {
5994
+ this.setIndexBuffer(indices);
5926
5995
  console.warn("luma.gl: indices should not be part of attributes");
5927
5996
  }
5928
- this.pipeline.setAttributes(attributes);
5929
- Object.assign(this.props.attributes, attributes);
5930
- return this;
5997
+ this.pipeline.setAttributes(bufferAttributes);
5998
+ this.pipeline.setConstantAttributes(constantAttributes);
5999
+ Object.assign(this.props.attributes, bufferAttributes, constantAttributes);
5931
6000
  }
5932
6001
  /** Set the bindings */
5933
6002
  setBindings(bindings) {
@@ -6770,13 +6839,13 @@ void main() {
6770
6839
  attrib.enabled = false;
6771
6840
  return original.disableVertexAttribArray.apply(this, arguments);
6772
6841
  };
6773
- gl.bindBuffer = function bindBuffer2(target, buffer) {
6842
+ gl.bindBuffer = function bindBuffer2(target, buffer2) {
6774
6843
  switch (target) {
6775
6844
  case gl.ARRAY_BUFFER:
6776
- self.currentArrayBuffer = buffer;
6845
+ self.currentArrayBuffer = buffer2;
6777
6846
  break;
6778
6847
  case gl.ELEMENT_ARRAY_BUFFER:
6779
- self.currentVertexArrayObject.elementArrayBuffer = buffer;
6848
+ self.currentVertexArrayObject.elementArrayBuffer = buffer2;
6780
6849
  break;
6781
6850
  default:
6782
6851
  }
@@ -7615,7 +7684,7 @@ void main() {
7615
7684
  return null;
7616
7685
  }
7617
7686
  },
7618
- bindBuffer: (update, target, buffer) => {
7687
+ bindBuffer: (update, target, buffer2) => {
7619
7688
  const pname = {
7620
7689
  [GL.ARRAY_BUFFER]: [GL.ARRAY_BUFFER_BINDING],
7621
7690
  [GL.COPY_READ_BUFFER]: [GL.COPY_READ_BUFFER_BINDING],
@@ -7625,7 +7694,7 @@ void main() {
7625
7694
  }[target];
7626
7695
  if (pname) {
7627
7696
  return update({
7628
- [pname]: buffer
7697
+ [pname]: buffer2
7629
7698
  });
7630
7699
  }
7631
7700
  return {
@@ -12391,8 +12460,25 @@ ${formattedLog}`)();
12391
12460
  get [Symbol.toStringTag]() {
12392
12461
  return "BaseVertexArrayObject";
12393
12462
  }
12463
+ /** Buffer constant */
12464
+ buffer = null;
12465
+ bufferValue = null;
12466
+ static isConstantAttributeZeroSupported(device) {
12467
+ return device.info.type === "webgl2" || getBrowser() === "Chrome";
12468
+ }
12469
+ // Create a VertexArray
12394
12470
  constructor(device, props) {
12395
- super(device, props, {});
12471
+ super(device, props, {
12472
+ ...Resource.defaultProps,
12473
+ constantAttributeZero: false
12474
+ });
12475
+ Object.seal(this);
12476
+ }
12477
+ destroy() {
12478
+ super.destroy();
12479
+ if (this.buffer) {
12480
+ this.buffer?.destroy();
12481
+ }
12396
12482
  }
12397
12483
  _createHandle() {
12398
12484
  return this.gl2.createVertexArray();
@@ -12404,6 +12490,20 @@ ${formattedLog}`)();
12404
12490
  _bindHandle(handle) {
12405
12491
  this.gl2.bindVertexArray(handle);
12406
12492
  }
12493
+ /**
12494
+ * Enabling an attribute location makes it reference the currently bound buffer
12495
+ * Disabling an attribute location makes it reference the global constant value
12496
+ * TODO - handle single values for size 1 attributes?
12497
+ * TODO - convert classic arrays based on known type?
12498
+ */
12499
+ enable(location, enable2 = true) {
12500
+ const canDisableAttributeZero = this.device.isWebGL2 || getBrowser() === "Chrome";
12501
+ const canDisableAttribute = canDisableAttributeZero || location !== 0;
12502
+ if (enable2 || canDisableAttribute) {
12503
+ location = Number(location);
12504
+ this.bind(() => enable2 ? this.gl.enableVertexAttribArray(location) : this.gl.disableVertexAttribArray(location));
12505
+ }
12506
+ }
12407
12507
  // Set (bind) an elements buffer, for indexed rendering.
12408
12508
  // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported
12409
12509
  setElementBuffer(elementBuffer = null, opts = {}) {
@@ -12411,12 +12511,12 @@ ${formattedLog}`)();
12411
12511
  this.bind(() => {
12412
12512
  this.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, elementBuffer ? elementBuffer.handle : null);
12413
12513
  });
12414
- return this;
12415
12514
  }
12416
12515
  /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
12417
- setBuffer(location, buffer, accessor) {
12418
- if (buffer.target === GL.ELEMENT_ARRAY_BUFFER) {
12419
- return this.setElementBuffer(buffer, accessor);
12516
+ setBuffer(location, buffer2, accessor) {
12517
+ if (buffer2.target === GL.ELEMENT_ARRAY_BUFFER) {
12518
+ this.setElementBuffer(buffer2, accessor);
12519
+ return;
12420
12520
  }
12421
12521
  const {
12422
12522
  size,
@@ -12433,7 +12533,7 @@ ${formattedLog}`)();
12433
12533
  } = this;
12434
12534
  location = Number(location);
12435
12535
  this.bind(() => {
12436
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer.handle);
12536
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer2.handle);
12437
12537
  if (integer) {
12438
12538
  this.device.assertWebGL2();
12439
12539
  gl2.vertexAttribIPointer(location, size, type, stride, offset);
@@ -12443,24 +12543,106 @@ ${formattedLog}`)();
12443
12543
  gl.enableVertexAttribArray(location);
12444
12544
  gl2.vertexAttribDivisor(location, divisor || 0);
12445
12545
  });
12446
- return this;
12447
12546
  }
12448
12547
  /**
12449
- * Enabling an attribute location makes it reference the currently bound buffer
12450
- * Disabling an attribute location makes it reference the global constant value
12451
- * TODO - handle single values for size 1 attributes?
12452
- * TODO - convert classic arrays based on known type?
12548
+ * Set an attribute to a constant value
12549
+ * @param device
12550
+ * @param location
12551
+ * @param array
12552
+ *
12553
+ * @note Constants are stored globally on the WebGL context, not the VAO
12554
+ * so they need to be updated before every render
12555
+ * @todo - use known type (in configuration or passed in) to allow non-typed arrays?
12556
+ * @todo - remember/cache values to avoid setting them unnecessarily?
12453
12557
  */
12454
- enable(location, enable2 = true) {
12455
- const canDisableAttributeZero = this.device.isWebGL2 || getBrowser() === "Chrome";
12456
- const canDisableAttribute = canDisableAttributeZero || location !== 0;
12457
- if (enable2 || canDisableAttribute) {
12458
- location = Number(location);
12459
- this.bind(() => enable2 ? this.gl.enableVertexAttribArray(location) : this.gl.disableVertexAttribArray(location));
12558
+ setConstant(location, array) {
12559
+ switch (array.constructor) {
12560
+ case Float32Array:
12561
+ setConstantFloatArray(this.device, location, array);
12562
+ break;
12563
+ case Int32Array:
12564
+ setConstantIntArray(this.device, location, array);
12565
+ break;
12566
+ case Uint32Array:
12567
+ setConstantUintArray(this.device, location, array);
12568
+ break;
12569
+ default:
12570
+ assert2(false);
12460
12571
  }
12461
- return this;
12572
+ }
12573
+ /**
12574
+ * Provide a means to create a buffer that is equivalent to a constant.
12575
+ * NOTE: Desktop OpenGL cannot disable attribute 0.
12576
+ * https://stackoverflow.com/questions/20305231/webgl-warning-attribute-0-is-disabled-
12577
+ * this-has-significant-performance-penalty
12578
+ */
12579
+ getConstantBuffer(elementCount, value) {
12580
+ const constantValue = normalizeConstantArrayValue(value);
12581
+ const byteLength = constantValue.byteLength * elementCount;
12582
+ const length = constantValue.length * elementCount;
12583
+ let updateNeeded = !this.buffer;
12584
+ this.buffer = this.buffer || this.device.createBuffer({
12585
+ byteLength
12586
+ });
12587
+ updateNeeded = updateNeeded || this.buffer.reallocate(byteLength);
12588
+ updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
12589
+ if (updateNeeded) {
12590
+ const typedArray = getScratchArray(value.constructor, length);
12591
+ fillArray({
12592
+ target: typedArray,
12593
+ source: constantValue,
12594
+ start: 0,
12595
+ count: length
12596
+ });
12597
+ this.buffer.subData(typedArray);
12598
+ this.bufferValue = value;
12599
+ }
12600
+ return this.buffer;
12462
12601
  }
12463
12602
  };
12603
+ function setConstantFloatArray(device, location, array) {
12604
+ switch (array.length) {
12605
+ case 1:
12606
+ device.gl.vertexAttrib1fv(location, array);
12607
+ break;
12608
+ case 2:
12609
+ device.gl.vertexAttrib2fv(location, array);
12610
+ break;
12611
+ case 3:
12612
+ device.gl.vertexAttrib3fv(location, array);
12613
+ break;
12614
+ case 4:
12615
+ device.gl.vertexAttrib4fv(location, array);
12616
+ break;
12617
+ default:
12618
+ assert2(false);
12619
+ }
12620
+ }
12621
+ function setConstantIntArray(device, location, array) {
12622
+ device.assertWebGL2();
12623
+ device.gl2?.vertexAttribI4iv(location, array);
12624
+ }
12625
+ function setConstantUintArray(device, location, array) {
12626
+ device.assertWebGL2();
12627
+ device.gl2?.vertexAttribI4uiv(location, array);
12628
+ }
12629
+ function normalizeConstantArrayValue(arrayValue) {
12630
+ if (Array.isArray(arrayValue)) {
12631
+ return new Float32Array(arrayValue);
12632
+ }
12633
+ return arrayValue;
12634
+ }
12635
+ function compareConstantArrayValues(v1, v2) {
12636
+ if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {
12637
+ return false;
12638
+ }
12639
+ for (let i = 0; i < v1.length; ++i) {
12640
+ if (v1[i] !== v2[i]) {
12641
+ return false;
12642
+ }
12643
+ }
12644
+ return true;
12645
+ }
12464
12646
 
12465
12647
  // ../webgl/src/adapter/resources/webgl-render-pipeline.ts
12466
12648
  var LOG_PROGRAM_PERF_PRIORITY = 4;
@@ -12510,11 +12692,11 @@ ${formattedLog}`)();
12510
12692
  }
12511
12693
  /** @todo needed for portable model */
12512
12694
  setAttributes(attributes) {
12513
- for (const [name, buffer] of Object.entries(attributes)) {
12514
- const webglBuffer = cast(buffer);
12695
+ for (const [name, buffer2] of Object.entries(attributes)) {
12696
+ const webglBuffer = cast(buffer2);
12515
12697
  const attribute = getAttributeLayout(this.layout, name);
12516
12698
  if (!attribute) {
12517
- log.warn(`Ignoring buffer supplied for unknown attribute "${name}" in pipeline "${this.id}" (buffer "${buffer.id}")`)();
12699
+ log.warn(`Ignoring buffer supplied for unknown attribute "${name}" in pipeline "${this.id}" (buffer "${buffer2.id}")`)();
12518
12700
  continue;
12519
12701
  }
12520
12702
  const decoded = decodeVertexFormat(attribute.format);
@@ -12538,7 +12720,26 @@ ${formattedLog}`)();
12538
12720
  });
12539
12721
  }
12540
12722
  }
12541
- /** @todo needed for portable model */
12723
+ /**
12724
+ * Constant attributes are only supported in WebGL, not in WebGPU
12725
+ * Any attribute that is disabled in the current vertex array object
12726
+ * is read from the context's global constant value for that attribute location.
12727
+ * @param attributes
12728
+ */
12729
+ setConstantAttributes(attributes) {
12730
+ for (const [name, value] of Object.entries(attributes)) {
12731
+ const attribute = getAttributeLayout(this.layout, name);
12732
+ if (!attribute) {
12733
+ log.warn(`Ignoring constant value supplied for unknown attribute "${name}" in pipeline "${this.id}"`)();
12734
+ continue;
12735
+ }
12736
+ this.vertexArrayObject.setConstant(attribute.location, value);
12737
+ }
12738
+ }
12739
+ /**
12740
+ * Bindings include: textures, samplers and uniform buffers
12741
+ * @todo needed for portable model
12742
+ */
12542
12743
  setBindings(bindings) {
12543
12744
  for (const [name, value] of Object.entries(bindings)) {
12544
12745
  const binding = this.layout.bindings.find((binding2) => binding2.name === name);
package/dist/index.cjs CHANGED
@@ -655,6 +655,7 @@ function makeAnimationLoop(AnimationLoopTemplateCtor, props) {
655
655
 
656
656
  // src/model/model.ts
657
657
  var import_api5 = require("@luma.gl/api");
658
+ var import_api6 = require("@luma.gl/api");
658
659
 
659
660
  // src/model/model-utils.ts
660
661
  var import_api4 = require("@luma.gl/api");
@@ -847,7 +848,7 @@ var PipelineFactory = class {
847
848
  };
848
849
 
849
850
  // src/model/model.ts
850
- var DEFAULT_MODEL_PROPS = __spreadProps(__spreadValues({}, import_api5.RenderPipeline._DEFAULT_PROPS), {
851
+ var DEFAULT_MODEL_PROPS = __spreadProps(__spreadValues({}, import_api6.RenderPipeline._DEFAULT_PROPS), {
851
852
  vs: null,
852
853
  fs: null,
853
854
  id: "unnamed",
@@ -936,16 +937,41 @@ var Model = class {
936
937
  this.pipeline.setIndexBuffer(indices);
937
938
  return this;
938
939
  }
939
- setAttributes(attributes) {
940
- if (attributes.indices) {
941
- this.setIndexBuffer(attributes.indices);
942
- attributes = __spreadValues({}, attributes);
943
- delete attributes.indices;
940
+ // Temporary hack to support deck.gl's dependency on luma.gl v8 Model attribute API.
941
+ _splitAttributes(attributes, filterBuffers) {
942
+ const bufferAttributes = {};
943
+ const constantAttributes = {};
944
+ const indices = attributes.indices;
945
+ delete attributes.indices;
946
+ for (const name in attributes) {
947
+ let attribute = attributes[name];
948
+ if (attribute instanceof import_api5.Buffer) {
949
+ bufferAttributes[name] = attribute;
950
+ continue;
951
+ }
952
+ if (attribute.getValue) {
953
+ attribute = attribute.getValue();
954
+ console.warn(`attribute ${name}: getValue() will be removed`);
955
+ }
956
+ if (ArrayBuffer.isView(attribute) && !attribute) {
957
+ constantAttributes[name] = attribute;
958
+ continue;
959
+ }
960
+ if (filterBuffers && attribute[name]._buffer) {
961
+ buffer[name] = attribute[name]._buffer;
962
+ }
963
+ }
964
+ return { bufferAttributes, constantAttributes, indices };
965
+ }
966
+ setAttributes(attributes, filterBuffers) {
967
+ const { bufferAttributes, constantAttributes, indices } = this._splitAttributes(attributes, filterBuffers);
968
+ if (indices) {
969
+ this.setIndexBuffer(indices);
944
970
  console.warn("luma.gl: indices should not be part of attributes");
945
971
  }
946
- this.pipeline.setAttributes(attributes);
947
- Object.assign(this.props.attributes, attributes);
948
- return this;
972
+ this.pipeline.setAttributes(bufferAttributes);
973
+ this.pipeline.setConstantAttributes(constantAttributes);
974
+ Object.assign(this.props.attributes, bufferAttributes, constantAttributes);
949
975
  }
950
976
  /** Set the bindings */
951
977
  setBindings(bindings) {
@@ -1062,11 +1088,11 @@ var Transform = class {
1062
1088
 
1063
1089
  // src/lib/clip-space.ts
1064
1090
  var import_constants3 = require("@luma.gl/constants");
1065
- var import_api7 = require("@luma.gl/api");
1091
+ var import_api8 = require("@luma.gl/api");
1066
1092
  var import_webgl2 = require("@luma.gl/webgl");
1067
1093
 
1068
1094
  // src/geometry/geometry.ts
1069
- var import_api6 = require("@luma.gl/api");
1095
+ var import_api7 = require("@luma.gl/api");
1070
1096
  var import_constants2 = require("@luma.gl/constants");
1071
1097
  var Geometry = class {
1072
1098
  constructor(props = {}) {
@@ -1074,7 +1100,7 @@ var Geometry = class {
1074
1100
  /** @deprecated */
1075
1101
  this.drawMode = import_constants2.GL.TRIANGLES;
1076
1102
  const {
1077
- id = (0, import_api6.uid)("geometry"),
1103
+ id = (0, import_api7.uid)("geometry"),
1078
1104
  drawMode = import_constants2.GL.TRIANGLES,
1079
1105
  attributes = {},
1080
1106
  indices = null,
@@ -1089,7 +1115,7 @@ var Geometry = class {
1089
1115
  this.attributes = {};
1090
1116
  for (const [attributeName, attributeValue] of Object.entries(attributes)) {
1091
1117
  const attribute = ArrayBuffer.isView(attributeValue) ? { value: attributeValue } : attributeValue;
1092
- (0, import_api6.assert)(
1118
+ (0, import_api7.assert)(
1093
1119
  ArrayBuffer.isView(attribute.value),
1094
1120
  `${this._print(attributeName)}: must be typed array or object with value as typed array`
1095
1121
  );
@@ -1097,7 +1123,7 @@ var Geometry = class {
1097
1123
  attribute.size = 3;
1098
1124
  }
1099
1125
  if (attributeName === "indices") {
1100
- (0, import_api6.assert)(!this.indices);
1126
+ (0, import_api7.assert)(!this.indices);
1101
1127
  this.indices = attribute;
1102
1128
  } else {
1103
1129
  this.attributes[attributeName] = attribute;
@@ -1144,7 +1170,7 @@ var Geometry = class {
1144
1170
  vertexCount = Math.min(vertexCount, value.length / size);
1145
1171
  }
1146
1172
  }
1147
- (0, import_api6.assert)(Number.isFinite(vertexCount));
1173
+ (0, import_api7.assert)(Number.isFinite(vertexCount));
1148
1174
  return vertexCount;
1149
1175
  }
1150
1176
  };
@@ -1187,7 +1213,7 @@ function convertToTopology(drawMode) {
1187
1213
  }
1188
1214
 
1189
1215
  // src/lib/clip-space.ts
1190
- var CLIPSPACE_VERTEX_SHADER = import_api7.glsl`\
1216
+ var CLIPSPACE_VERTEX_SHADER = import_api8.glsl`\
1191
1217
  attribute vec2 aClipSpacePosition;
1192
1218
  attribute vec2 aTexCoord;
1193
1219
  attribute vec2 aCoordinate;
@@ -1227,7 +1253,7 @@ var ClipSpace = class extends Model {
1227
1253
  };
1228
1254
 
1229
1255
  // src/scenegraph/scenegraph-node.ts
1230
- var import_api8 = require("@luma.gl/api");
1256
+ var import_api9 = require("@luma.gl/api");
1231
1257
  var import_core = require("@math.gl/core");
1232
1258
  var ScenegraphNode = class {
1233
1259
  constructor(props = {}) {
@@ -1239,7 +1265,7 @@ var ScenegraphNode = class {
1239
1265
  this.userData = {};
1240
1266
  this.props = {};
1241
1267
  const { id } = props;
1242
- this.id = id || (0, import_api8.uid)(this.constructor.name);
1268
+ this.id = id || (0, import_api9.uid)(this.constructor.name);
1243
1269
  this._setScenegraphNodeProps(props);
1244
1270
  }
1245
1271
  getBounds() {
@@ -1259,17 +1285,17 @@ var ScenegraphNode = class {
1259
1285
  return `{type: ScenegraphNode, id: ${this.id})}`;
1260
1286
  }
1261
1287
  setPosition(position) {
1262
- (0, import_api8.assert)(position.length === 3, "setPosition requires vector argument");
1288
+ (0, import_api9.assert)(position.length === 3, "setPosition requires vector argument");
1263
1289
  this.position = position;
1264
1290
  return this;
1265
1291
  }
1266
1292
  setRotation(rotation) {
1267
- (0, import_api8.assert)(rotation.length === 3, "setRotation requires vector argument");
1293
+ (0, import_api9.assert)(rotation.length === 3, "setRotation requires vector argument");
1268
1294
  this.rotation = rotation;
1269
1295
  return this;
1270
1296
  }
1271
1297
  setScale(scale) {
1272
- (0, import_api8.assert)(scale.length === 3, "setScale requires vector argument");
1298
+ (0, import_api9.assert)(scale.length === 3, "setScale requires vector argument");
1273
1299
  this.scale = scale;
1274
1300
  return this;
1275
1301
  }
@@ -1321,7 +1347,7 @@ var ScenegraphNode = class {
1321
1347
  return this;
1322
1348
  }
1323
1349
  getCoordinateUniforms(viewMatrix, modelMatrix) {
1324
- (0, import_api8.assert)(viewMatrix);
1350
+ (0, import_api9.assert)(viewMatrix);
1325
1351
  modelMatrix = modelMatrix || this.matrix;
1326
1352
  const worldMatrix = new import_core.Matrix4(viewMatrix).multiplyRight(modelMatrix);
1327
1353
  const worldInverse = worldMatrix.invert();
@@ -1379,12 +1405,12 @@ var ScenegraphNode = class {
1379
1405
 
1380
1406
  // src/scenegraph/group-node.ts
1381
1407
  var import_core2 = require("@math.gl/core");
1382
- var import_api9 = require("@luma.gl/api");
1408
+ var import_api10 = require("@luma.gl/api");
1383
1409
  var GroupNode = class extends ScenegraphNode {
1384
1410
  constructor(props = {}) {
1385
1411
  props = Array.isArray(props) ? { children: props } : props;
1386
1412
  const { children = [] } = props;
1387
- import_api9.log.assert(
1413
+ import_api10.log.assert(
1388
1414
  children.every((child) => child instanceof ScenegraphNode),
1389
1415
  "every child must an instance of ScenegraphNode"
1390
1416
  );
@@ -1492,10 +1518,10 @@ var ModelNode = class extends ScenegraphNode {
1492
1518
  };
1493
1519
 
1494
1520
  // src/geometries/cone-geometry.ts
1495
- var import_api11 = require("@luma.gl/api");
1521
+ var import_api12 = require("@luma.gl/api");
1496
1522
 
1497
1523
  // src/geometries/truncated-cone-geometry.ts
1498
- var import_api10 = require("@luma.gl/api");
1524
+ var import_api11 = require("@luma.gl/api");
1499
1525
  var INDEX_OFFSETS = {
1500
1526
  x: [2, 0, 1],
1501
1527
  y: [0, 1, 2],
@@ -1503,7 +1529,7 @@ var INDEX_OFFSETS = {
1503
1529
  };
1504
1530
  var TruncatedConeGeometry = class extends Geometry {
1505
1531
  constructor(props = {}) {
1506
- const { id = (0, import_api10.uid)("truncated-code-geometry") } = props;
1532
+ const { id = (0, import_api11.uid)("truncated-code-geometry") } = props;
1507
1533
  const { indices, attributes } = tesselateTruncatedCone(props);
1508
1534
  super(__spreadProps(__spreadValues({}, props), {
1509
1535
  id,
@@ -1604,7 +1630,7 @@ function tesselateTruncatedCone(props = {}) {
1604
1630
  // src/geometries/cone-geometry.ts
1605
1631
  var ConeGeometry = class extends TruncatedConeGeometry {
1606
1632
  constructor(props = {}) {
1607
- const { id = (0, import_api11.uid)("cone-geometry"), radius = 1, cap = true } = props;
1633
+ const { id = (0, import_api12.uid)("cone-geometry"), radius = 1, cap = true } = props;
1608
1634
  super(__spreadProps(__spreadValues({}, props), {
1609
1635
  id,
1610
1636
  topRadius: 0,
@@ -1616,10 +1642,10 @@ var ConeGeometry = class extends TruncatedConeGeometry {
1616
1642
  };
1617
1643
 
1618
1644
  // src/geometries/cube-geometry.ts
1619
- var import_api12 = require("@luma.gl/api");
1645
+ var import_api13 = require("@luma.gl/api");
1620
1646
  var CubeGeometry = class extends Geometry {
1621
1647
  constructor(props = {}) {
1622
- const { id = (0, import_api12.uid)("cube-geometry"), indices = true } = props;
1648
+ const { id = (0, import_api13.uid)("cube-geometry"), indices = true } = props;
1623
1649
  super(indices ? __spreadProps(__spreadValues({}, props), {
1624
1650
  id,
1625
1651
  indices: { size: 1, value: CUBE_INDICES },
@@ -2258,10 +2284,10 @@ var NON_INDEXED_ATTRIBUTES = {
2258
2284
  };
2259
2285
 
2260
2286
  // src/geometries/cylinder-geometry.ts
2261
- var import_api13 = require("@luma.gl/api");
2287
+ var import_api14 = require("@luma.gl/api");
2262
2288
  var CylinderGeometry = class extends TruncatedConeGeometry {
2263
2289
  constructor(props = {}) {
2264
- const { id = (0, import_api13.uid)("cylinder-geometry"), radius = 1 } = props;
2290
+ const { id = (0, import_api14.uid)("cylinder-geometry"), radius = 1 } = props;
2265
2291
  super(__spreadProps(__spreadValues({}, props), {
2266
2292
  id,
2267
2293
  bottomRadius: radius,
@@ -2271,13 +2297,13 @@ var CylinderGeometry = class extends TruncatedConeGeometry {
2271
2297
  };
2272
2298
 
2273
2299
  // src/geometries/ico-sphere-geometry.ts
2274
- var import_api14 = require("@luma.gl/api");
2300
+ var import_api15 = require("@luma.gl/api");
2275
2301
  var import_core3 = require("@math.gl/core");
2276
2302
  var ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0];
2277
2303
  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];
2278
2304
  var IcoSphereGeometry = class extends Geometry {
2279
2305
  constructor(props = {}) {
2280
- const { id = (0, import_api14.uid)("ico-sphere-geometry") } = props;
2306
+ const { id = (0, import_api15.uid)("ico-sphere-geometry") } = props;
2281
2307
  const { indices, attributes } = tesselateIcosaHedron(props);
2282
2308
  super(__spreadProps(__spreadValues({}, props), {
2283
2309
  id,
@@ -2417,7 +2443,7 @@ function tesselateIcosaHedron(props) {
2417
2443
  }
2418
2444
 
2419
2445
  // src/geometries/plane-geometry.ts
2420
- var import_api15 = require("@luma.gl/api");
2446
+ var import_api16 = require("@luma.gl/api");
2421
2447
 
2422
2448
  // src/geometry/geometry-utils.ts
2423
2449
  function unpackIndexedGeometry(geometry) {
@@ -2450,7 +2476,7 @@ function unpackIndexedGeometry(geometry) {
2450
2476
  // src/geometries/plane-geometry.ts
2451
2477
  var PlaneGeometry = class extends Geometry {
2452
2478
  constructor(props = {}) {
2453
- const { id = (0, import_api15.uid)("plane-geometry") } = props;
2479
+ const { id = (0, import_api16.uid)("plane-geometry") } = props;
2454
2480
  const { indices, attributes } = tesselatePlane(props);
2455
2481
  super(__spreadProps(__spreadValues({}, props), {
2456
2482
  id,
@@ -2538,10 +2564,10 @@ function tesselatePlane(props) {
2538
2564
  }
2539
2565
 
2540
2566
  // src/geometries/sphere-geometry.ts
2541
- var import_api16 = require("@luma.gl/api");
2567
+ var import_api17 = require("@luma.gl/api");
2542
2568
  var SphereGeometry = class extends Geometry {
2543
2569
  constructor(props = {}) {
2544
- const { id = (0, import_api16.uid)("sphere-geometry") } = props;
2570
+ const { id = (0, import_api17.uid)("sphere-geometry") } = props;
2545
2571
  const { indices, attributes } = tesselateSphere(props);
2546
2572
  super(__spreadProps(__spreadValues({}, props), {
2547
2573
  id,