@luma.gl/engine 9.4.1 → 9.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2944,7 +2944,7 @@ var Model = class _Model {
2944
2944
  instanceCount = 0;
2945
2945
  /** Vertex count */
2946
2946
  vertexCount;
2947
- /** Indexed draw count override. Undefined draws the full bound index buffer. */
2947
+ /** Indexed draw count override. Undefined uses vertexCount, then the full bound index buffer. */
2948
2948
  indexCount;
2949
2949
  /** First vertex byte offset for WebGL indexed draws or first vertex for non-indexed draws. */
2950
2950
  firstVertex;
@@ -2985,6 +2985,7 @@ var Model = class _Model {
2985
2985
  _needsRedraw = "initializing";
2986
2986
  _drawBlockedReason = false;
2987
2987
  _destroyed = false;
2988
+ _vertexCountSet = false;
2988
2989
  /** "Time" of last draw. Monotonically increasing timestamp */
2989
2990
  _lastDrawTimestamp = -1;
2990
2991
  _bindingTable = [];
@@ -2997,11 +2998,13 @@ var Model = class _Model {
2997
2998
  constructor(device, props) {
2998
2999
  var _a;
2999
3000
  const defaultShaderAssembler = _Model.defaultProps.shaderAssembler;
3001
+ const vertexCountSet = props.vertexCount !== void 0;
3000
3002
  this.props = {
3001
3003
  ..._Model.defaultProps,
3002
3004
  ...props,
3003
3005
  shaderAssembler: props.shaderAssembler ?? (isShaderAssemblerForLanguage(defaultShaderAssembler, device.info.shadingLanguage) ? defaultShaderAssembler : import_shadertools3.ShaderAssembler.getDefaultShaderAssembler(device.info.shadingLanguage))
3004
3006
  };
3007
+ this._vertexCountSet = vertexCountSet;
3005
3008
  props = this.props;
3006
3009
  this.id = props.id || uid("model");
3007
3010
  this.device = device;
@@ -3202,7 +3205,7 @@ var Model = class _Model {
3202
3205
  const syncBindings = this._getBindings(shaderLayout);
3203
3206
  const syncBindGroups = this._getBindGroups(shaderLayout, syncBindings);
3204
3207
  const { indexBuffer } = this.vertexArray;
3205
- const indexCount = indexBuffer ? this.indexCount ?? indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2) : void 0;
3208
+ const indexCount = indexBuffer ? this.indexCount ?? (this._vertexCountSet ? this.vertexCount : indexBuffer.byteLength / (indexBuffer.indexType === "uint32" ? 4 : 2)) : void 0;
3206
3209
  renderPass.setPipeline(this.pipeline);
3207
3210
  renderPass.setBindings(syncBindGroups, {
3208
3211
  _bindGroupCacheKeys: this._getBindGroupCacheKeys()
@@ -3323,6 +3326,7 @@ var Model = class _Model {
3323
3326
  */
3324
3327
  setVertexCount(vertexCount) {
3325
3328
  this.vertexCount = vertexCount;
3329
+ this._vertexCountSet = true;
3326
3330
  this.setNeedsRedraw("vertexCount");
3327
3331
  }
3328
3332
  /** Updates the indexed draw count override. */
@@ -3556,6 +3560,7 @@ var Model = class _Model {
3556
3560
  }
3557
3561
  }
3558
3562
  this.vertexCount = gpuGeometry.vertexCount;
3563
+ this._vertexCountSet = true;
3559
3564
  this.setIndexBuffer(gpuGeometry.indices || null);
3560
3565
  this.setAttributes(gpuGeometry.attributes, { disableWarnings: true });
3561
3566
  this.setAttributes(attributes, { disableWarnings: this.props.disableWarnings });