Game Development Reference
In-Depth Information
BaseVertexIndex —A base number to be added to the indices
used in this call. See the following note.
MinIndex —The minimum index value that will be referenced
NumVertices —The number of vertices that will be referenced in
this call
StartIndex —Index to an element in the index buffer that marks
the starting point from which to begin reading indices
PrimitiveCount —The number of primitives to draw
Example :
_device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12);
Note: The BaseVertexIndex parameter deserves some explana-
tion. Refer to Figure 3.2 during this explanation.
Figure 3.2: Separately defined ver-
tex buffers merged into one global
vertex buffer
The local index buffers reference vertices in the corresponding local
vertex buffer. However, suppose that we want to combine the vertices
of the sphere, box, and cylinder into one global vertex buffer. For each
object we would have to recompute the indices to index correctly into
the global vertex buffer. The new indices are computed by adding an
offset value that specifies the start of the object's vertices in the global
vertex buffer to each index. Note that the offset is measured in verti-
ces, not bytes.
Rather than having to compute the indices relative to where the
object is in the global vertex buffer ourselves, Direct3D allows us to
pass in a vertex-offset value through the BaseVertexIndex parameter.
Direct3D will then recompute the indices internally.
Search WWH ::




Custom Search