drawIndexed method
Appends an indexed draw of indexCount indices.
Indices are read from the index buffer previously bound with bindIndexBuffer. Vertex data is read from the vertex buffers previously bound with bindVertexBuffer. Buffers whose VertexBuffer.stepMode is VertexStepMode.vertex advance once per vertex selected by the index buffer. Buffers whose VertexBuffer.stepMode is VertexStepMode.instance advance once per instance.
Set instanceCount greater than 1 to repeat the same indexed geometry
multiple times while reading a new element from each instance-rate vertex
buffer for each instance. An indexCount or instanceCount of 0 is valid
and records no drawing work.
If the bound pipeline does not use any instance-rate vertex buffers, each instance receives the same vertex and index buffer data. This is valid, but every instance will produce the same geometry unless the shader varies its output another way.
Implementation
void drawIndexed(int indexCount, {int instanceCount = 1}) {
RangeError.checkNotNegative(indexCount, 'indexCount');
RangeError.checkNotNegative(instanceCount, 'instanceCount');
if (indexCount == 0 || instanceCount == 0) {
return;
}
_validateVertexBindings();
if (!_drawIndexed(indexCount, instanceCount)) {
throw Exception("Failed to append drawIndexed");
}
}