# DrawCommands

Class · category: Graphics

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/platform/graphics/draw-commands.js#L11

Container holding parameters for multi-draw commands.

Obtain an instance via [MeshInstance#setMultiDraw](https://api.playcanvas.com/engine/classes/MeshInstance.md#setmultidraw) and populate it using [add](https://api.playcanvas.com/engine/classes/DrawCommands.md#add)
followed by [update](https://api.playcanvas.com/engine/classes/DrawCommands.md#update).

## Accessors

### count

```ts
get count(): number
```

Number of draw calls to perform.

### maxCount

```ts
get maxCount(): number
```

Maximum number of multi-draw calls the space is allocated for.

## Methods

### add

```ts
add(i: number, indexOrVertexCount: number, instanceCount: number, firstIndexOrVertex: number, baseVertex?: number, firstInstance?: number): void
```

Writes one draw command into the allocated storage.

**Parameters**

- `i` (`number`): Draw index to update.
- `indexOrVertexCount` (`number`): Number of indices or vertices to draw.
- `instanceCount` (`number`): Number of instances to draw (use 1 if not instanced).
- `firstIndexOrVertex` (`number`): Starting index (in indices, not bytes) or starting vertex.
- `baseVertex` (`number`, optional, default `0`): Signed base vertex (WebGPU only). Defaults to 0.
- `firstInstance` (`number`, optional, default `0`): First instance (WebGPU only). Defaults to 0.

### update

```ts
update(count: number): void
```

Finalize and set draw count after all commands have been added.

**Parameters**

- `count` (`number`): Number of draws to execute.
