[ < ] | [ Up ] | [ > ] |  |  |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 2.6.1 The VertexData class

The VertexData class collects together all the vertex-related information used to render geometry. The new RenderOperation requires a pointer to a VertexData object, and it is also used in Mesh and SubMesh to store the vertex positions, normals, texture coordinates etc. VertexData can either be used alone (in order to render unindexed geometry, where the stream of vertices defines the triangles), or in combination with IndexData where the triangles are defined by indexes which refer to the entries in VertexData.
It's worth noting that you don't necessarily have to use VertexData to store your applications geometry; all that is required is that you can build a VertexData structure when it comes to rendering. This is pretty easy since all of VertexData's members are pointers, so you could maintain your vertex buffers and declarations in alternative structures if you like, so long as you can convert them for rendering.
The VertexData class has a number of important members:

vertexStart
  The position in the bound buffers to start reading vertex data from. This allows you to use a single buffer for many different renderables.
vertexCount
  The number of vertices to process in this particular rendering group
vertexDeclaration
  A pointer to a VertexDeclaration object which defines the format of the vertex input; note this is created for you by VertexData. See section 2.6.2 Vertex Declarations
vertexBufferBinding
  A pointer to a VertexBufferBinding object which defines which vertex buffers are bound to which sources - again, this is created for you by VertexData. See section 2.6.3 Vertex Buffer Bindings

This document was generated by steve on May 10 2008 using texi2html