@luma.gl/engine 9.0.9 → 9.0.11

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
@@ -1027,10 +1027,12 @@ var _Model = class {
1027
1027
  /** Buffer layout */
1028
1028
  bufferLayout;
1029
1029
  // Dynamic properties
1030
+ /** Use instanced rendering */
1031
+ isInstanced = void 0;
1032
+ /** instance count. `undefined` means not instanced */
1033
+ instanceCount = 0;
1030
1034
  /** Vertex count */
1031
1035
  vertexCount;
1032
- /** instance count */
1033
- instanceCount = 0;
1034
1036
  /** Index buffer */
1035
1037
  indexBuffer = null;
1036
1038
  /** Buffer-valued attributes */
@@ -1111,12 +1113,15 @@ var _Model = class {
1111
1113
  if (this._gpuGeometry) {
1112
1114
  this._setGeometryAttributes(this._gpuGeometry);
1113
1115
  }
1114
- if (props.vertexCount) {
1115
- this.setVertexCount(props.vertexCount);
1116
+ if ("isInstanced" in props) {
1117
+ this.isInstanced = props.isInstanced;
1116
1118
  }
1117
1119
  if (props.instanceCount) {
1118
1120
  this.setInstanceCount(props.instanceCount);
1119
1121
  }
1122
+ if (props.vertexCount) {
1123
+ this.setVertexCount(props.vertexCount);
1124
+ }
1120
1125
  if (props.indexBuffer) {
1121
1126
  this.setIndexBuffer(props.indexBuffer);
1122
1127
  }
@@ -1186,6 +1191,7 @@ var _Model = class {
1186
1191
  drawSuccess = this.pipeline.draw({
1187
1192
  renderPass,
1188
1193
  vertexArray: this.vertexArray,
1194
+ isInstanced: this.isInstanced,
1189
1195
  vertexCount: this.vertexCount,
1190
1196
  instanceCount: this.instanceCount,
1191
1197
  indexCount,
@@ -1264,22 +1270,26 @@ var _Model = class {
1264
1270
  }
1265
1271
  }
1266
1272
  // Update dynamic fields
1267
- /**
1268
- * Updates the vertex count (used in draw calls)
1269
- * @note Any attributes with stepMode=vertex need to be at least this big
1270
- */
1271
- setVertexCount(vertexCount) {
1272
- this.vertexCount = vertexCount;
1273
- this.setNeedsRedraw("vertexCount");
1274
- }
1275
1273
  /**
1276
1274
  * Updates the instance count (used in draw calls)
1277
1275
  * @note Any attributes with stepMode=instance need to be at least this big
1278
1276
  */
1279
1277
  setInstanceCount(instanceCount) {
1280
1278
  this.instanceCount = instanceCount;
1279
+ if (this.isInstanced === void 0 && instanceCount > 0) {
1280
+ this.isInstanced = true;
1281
+ }
1281
1282
  this.setNeedsRedraw("instanceCount");
1282
1283
  }
1284
+ /**
1285
+ * Updates the vertex count (used in draw calls)
1286
+ * @note Any attributes with stepMode=vertex need to be at least this big
1287
+ */
1288
+ setVertexCount(vertexCount) {
1289
+ this.vertexCount = vertexCount;
1290
+ this.setNeedsRedraw("vertexCount");
1291
+ }
1292
+ /** Set the shader inputs */
1283
1293
  setShaderInputs(shaderInputs) {
1284
1294
  this.shaderInputs = shaderInputs;
1285
1295
  this._uniformStore = new import_core9.UniformStore(this.shaderInputs.modules);
@@ -1289,6 +1299,7 @@ var _Model = class {
1289
1299
  }
1290
1300
  this.setNeedsRedraw("shaderInputs");
1291
1301
  }
1302
+ /** Update uniform buffers from the model's shader inputs */
1292
1303
  updateShaderInputs() {
1293
1304
  this._uniformStore.setUniforms(this.shaderInputs.getUniformValues());
1294
1305
  this.setNeedsRedraw("shaderInputs");
@@ -1551,6 +1562,9 @@ __publicField(Model, "defaultProps", {
1551
1562
  attributes: {},
1552
1563
  constantAttributes: {},
1553
1564
  varyings: [],
1565
+ isInstanced: void 0,
1566
+ instanceCount: 0,
1567
+ vertexCount: 0,
1554
1568
  shaderInputs: void 0,
1555
1569
  pipelineFactory: void 0,
1556
1570
  shaderFactory: void 0,