Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | Namespace Members | Class Members | Related Pages

BufferMesh::SubMesh Class Reference
[XEngineUtil Library]

List of all members.

Detailed Description

A sub mesh is a part of a buffer mesh consisting of a number of primitive groups that only use one index buffer and one vertex buffer stream mapping. For most meshes having only one sub mesh will be enough since a mesh rarely requires more than one index buffer (i.e. more than 65536 indices when using 16-bit indices). Therefore, most mesh objects will only have one sub mesh object. But it is nevertheless possible to have meshes with more than one sub mesh.

Note that the primitive groups stored in a sub mesh are rendered in the order they were added to the sub mesh. This also implies that if e.g. the first primitive group has an associated state set and the rest of the primitive groups do not, the state set of that first primitive group determines the states for all other primitive groups of the sub mesh. To put it another way, for efficiency reasons it is advisable to group primitive groups according to their materials (= render states) and then for each material add the primitive groups with that material in sequence to the sub mesh where the first primitive group has the appropriate state set associated with it.


Public Member Functions

 SubMesh ()
 Constructs an empty sub mesh.
 SubMesh (const VertexBufferStreamMapping &vertexBufferStreams, const boost::shared_ptr< IndexBuffer > &pIndexBuffer)
 Constructs an empty sub mesh using the given vertex buffer streams and index buffer.
template<typename InputIteratorT>
 SubMesh (const VertexBufferStreamMapping &vertexBufferStreams, const boost::shared_ptr< IndexBuffer > &pIndexBuffer, InputIteratorT itPrimitiveGroupFirst, InputIteratorT itPrimitiveGroupLast)
 Constructs a sub mesh with the given primitive groups using the given vertex buffer streams and index buffer.
void SetVertexBufferStreamMapping (const VertexBufferStreamMapping &mapping)
 Sets the vertex buffer stream mapping of this sub mesh.
VertexBufferStreamMappingGetVertexBufferStreamMapping ()
 Returns the vertex buffer stream mapping used by this sub mesh allowing direct modification.
const VertexBufferStreamMappingGetVertexBufferStreamMapping () const
 Returns the vertex buffer stream mapping used by this sub mesh.
void SetIndexBuffer (const boost::shared_ptr< IndexBuffer > &pIndexBuffer)
 Sets the index buffer used by this sub mesh.
const boost::shared_ptr< IndexBuffer > & GetIndexBuffer () const
 Returns the index buffer used by this sub mesh.
void AddPrimitiveGroup (const PrimitiveGroup &primitives)
 Adds a primitive group to this sub mesh.
template<typename InputIteratorT>
void AddPrimitiveGroups (InputIteratorT itFirst, InputIteratorT itLast)
 Adds multiple primitive groups to this sub mesh.
void ReplacePrimitiveGroup (size_t index, const PrimitiveGroup &primitives)
 Replaces a specific primitive group of this sub mesh.
size_t GetPrimitiveGroupCount () const
 Returns the number of primitive groups stored in this object.
const PrimitiveGroupGetPrimitiveGroup (size_t index) const
 Returns a specific primitive group of this sub mesh.
const std::vector< PrimitiveGroup > & GetPrimitiveGroups () const
 Returns all primitive groups stored in this sub mesh.
template<typename OutputIteratorT>
void GetPrimitiveGroups (OutputIteratorT it) const
 Returns all primitive groups stored in this sub mesh.


Constructor & Destructor Documentation

SubMesh  ) 
 

Constructs an empty sub mesh.

SubMesh const VertexBufferStreamMapping vertexBufferStreams,
const boost::shared_ptr< IndexBuffer > &  pIndexBuffer
 

Constructs an empty sub mesh using the given vertex buffer streams and index buffer.

SubMesh const VertexBufferStreamMapping vertexBufferStreams,
const boost::shared_ptr< IndexBuffer > &  pIndexBuffer,
InputIteratorT  itPrimitiveGroupFirst,
InputIteratorT  itPrimitiveGroupLast
 

Constructs a sub mesh with the given primitive groups using the given vertex buffer streams and index buffer.


Member Function Documentation

void AddPrimitiveGroup const PrimitiveGroup primitives  ) 
 

Adds a primitive group to this sub mesh.

void AddPrimitiveGroups InputIteratorT  itFirst,
InputIteratorT  itLast
 

Adds multiple primitive groups to this sub mesh. The given input iterator must deliver objects of type BufferMesh::PrimitiveGroup.

const boost::shared_ptr< IndexBuffer > & GetIndexBuffer  )  const
 

Returns the index buffer used by this sub mesh.

const BufferMesh::PrimitiveGroup & GetPrimitiveGroup size_t  index  )  const
 

Returns a specific primitive group of this sub mesh.

size_t GetPrimitiveGroupCount  )  const
 

Returns the number of primitive groups stored in this object.

void GetPrimitiveGroups OutputIteratorT  it  )  const
 

Returns all primitive groups stored in this sub mesh.

const std::vector< BufferMesh::PrimitiveGroup > & GetPrimitiveGroups  )  const
 

Returns all primitive groups stored in this sub mesh.

const VertexBufferStreamMapping & GetVertexBufferStreamMapping  )  const
 

Returns the vertex buffer stream mapping used by this sub mesh.

VertexBufferStreamMapping & GetVertexBufferStreamMapping  ) 
 

Returns the vertex buffer stream mapping used by this sub mesh allowing direct modification.

void ReplacePrimitiveGroup size_t  index,
const PrimitiveGroup primitives
 

Replaces a specific primitive group of this sub mesh.

void SetIndexBuffer const boost::shared_ptr< IndexBuffer > &  pIndexBuffer  ) 
 

Sets a new index buffer to be used by this sub mesh. The new index buffer must have the same render context as the previous index buffer. Furthermore, the number of indices must be equal to or greater than the previous number of indices.

void SetVertexBufferStreamMapping const VertexBufferStreamMapping mapping  ) 
 

Sets a new vertex buffer stream mapping for this sub mesh. Note that the new vertex buffers must have the same render context as the previous vertex buffers and the number of vertices must be equal to or greater than the previous number of vertices.


The documentation for this class was generated from the following files: