Home -> IRenderableNode -> SetVertexCount
Description
The SetVertexCount method is used to update the the number of vertices that are drawn for this IRenderableNode, as well as specifying offsets for the vertex and index buffers. This allows any one sub-range of the bound index and vertex buffers to be used by this renderable during the draw process.
Important
For the simple case where an IRenderableNode needs to draw the entire contents of the bound vertex and index buffers, this method doesn't need to be called at all. By default, the IRenderableNode will use the total number of indices in the bound index buffer, or the total vertex count in the last bound vertex attribute to determine the vertex count, and all offsets will be set to 0. If this method is called once however, the vertex count and offsets will be fixed to the manually specified values.
Important
This method can be called at any time after the creation of the IRenderableNode, including when it has already been added to the render tree. Any changes made will not affect any current frame being drawn, and will take effect on the next frame.
Usage
SuccessToken SetVertexCount(size_t vertexCount, size_t vertexBufferOffset = 0, size_t indexBufferOffset = 0, ptrdiff_t indexValueOffset = 0);
Argument list
- vertexCount [size_t]
- Specifies the number of vertices which will be drawn for this renderable
- vertexBufferOffset [size_t]
- Specifies an initial offset into each vertex attribute buffer, in units of whole vertices. For example, an offset of 10 will cause the first vertex to be read from the 10th position in each vertex attribute array.
- indexBufferOffset [size_t]
- Specifies an initial offset into the index attribute buffer, in units of whole indices. For example, an offset of 10 will cause the first index to be read from the 10th position in the index attribute array.
- indexValueOffset [ptrdiff_t]
- Specifies an offset to be applied to each index value read from the index array. This is a signed value, so the offset applied can either be positive or negative.
Return value
- [SuccessToken]
- True if the vertex and index count and offset values were successfully updated, false otherwise. There are currently no circumstances under which this method will fail, however in future updates the supplied values may be validated in debug builds to ensure they meet constraints set by the defined PrimitiveMode, and the types and sizes of the bound index and vertex buffers. An assertion will be raised in debug builds if the result isn't tested.