setIndices method

void setIndices(
  1. BufferView indices,
  2. IndexType indexType
)

Binds an already-uploaded index buffer view, with element width determined by indexType.

The element count is computed automatically from the buffer view's byte length.

Implementation

void setIndices(gpu.BufferView indices, gpu.IndexType indexType) {
  _indices = indices;
  _indexType = indexType;
  switch (indexType) {
    case gpu.IndexType.int16:
      _indexCount = indices.lengthInBytes ~/ 2;
    case gpu.IndexType.int32:
      _indexCount = indices.lengthInBytes ~/ 4;
  }
}