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

BufferMesh Class Reference
[XEngineUtil Library]

List of all members.

Detailed Description

This class represents a buffer mesh which is a particular kind of mesh that exclusively uses vertex and index buffers (i.e. render resources) to store its data. Therefore, this kind of mesh is highly efficient for rendering, especially if the buffers referenced by the mesh object are all static buffers and thus potentially already uploaded to video memory. A buffer mesh object is created by calling BufferMesh::Create and is passed around as shared pointer.

A buffer mesh consists of a number of sub meshes where each sub mesh references a vertex buffer stream and an index buffer via shared pointers. Each sub mesh holds a number of primitive groups, such as line lists or triangle strips, that actually describe the geometry that makes up the mesh. Additionally, a buffer mesh holds an optional global state set which will be applied before rendering any sub mesh.


Public Member Functions

boost::shared_ptr< RenderContextGetRenderContext () const
 Returns the render context used by this buffer mesh.
void SetStateSet (const boost::shared_ptr< StateSet > &pStateSet)
 Sets the global state set of this buffer mesh.
const boost::shared_ptr< StateSet > & GetStateSet () const
 Returns the global state set of this buffer mesh.
void AddSubMesh (const SubMesh &subMesh)
 Adds a new sub mesh to this buffer mesh.
template<typename InputIteratorT>
void AddSubMeshes (InputIteratorT itFirst, InputIteratorT itLast)
 Adds a number of new sub meshes to this buffer mesh.
void AddSubMeshes (size_t count)
 Adds a number of new empty sub meshes to this buffer mesh. Use BufferMesh::GetSubMesh to access and fill the newly added sub meshes.
void ReplaceSubMesh (size_t index, const SubMesh &subMesh)
 Replaces a specific sub mesh of this buffer mesh with the given sub mesh.
size_t GetSubMeshCount () const
 Returns the number of sub meshes in this object.
const SubMeshGetSubMesh (size_t index) const
 Returns a specific sub mesh of this buffer mesh.
SubMeshGetSubMesh (size_t index)
 Returns a reference to a specific sub mesh of this buffer mesh.
const std::vector< SubMesh > & GetSubMeshes () const
 Returns all sub meshes in this buffer mesh.
template<typename OutputIteratorT>
void GetSubMeshes (OutputIteratorT it) const
 Returns all sub meshes in this buffer mesh.
void Render ()
 Renders this mesh.

Static Public Member Functions

static boost::shared_ptr<
BufferMesh
Create (const boost::shared_ptr< RenderContext > &pContext, const boost::shared_ptr< StateSet > &pStateSet=boost::shared_ptr< StateSet >(), size_t initialSubMeshCount=0)
 Constructs a new buffer mesh that uses the given render context and global state set.

Classes

class  PrimitiveGroup
 This class represents a group of primitives of a buffer mesh. More...
class  SubMesh
 The sub mesh class which represents a part of a buffer mesh. More...


Member Function Documentation

void AddSubMesh const SubMesh subMesh  ) 
 

Adds a new sub mesh to this buffer mesh.

void AddSubMeshes size_t  count  ) 
 

Adds a number of empty new sub meshes to this buffer mesh. Use BufferMesh::GetSubMesh to access and fill the newly added sub meshes.

void AddSubMeshes InputIteratorT  itFirst,
InputIteratorT  itLast
 

Adds a number of new sub meshes to this buffer mesh. The given input iterator must be able to deliver objects of type BufferMesh::SubMesh.

boost::shared_ptr< BufferMesh > Create const boost::shared_ptr< RenderContext > &  pContext,
const boost::shared_ptr< StateSet > &  pStateSet = boost::shared_ptr<StateSet>(),
size_t  initialSubMeshCount = 0
[static]
 

Constructs a new empty buffer mesh that uses the given render context and the optionally given global state set.

Parameters:
pContext The render context to be used by the buffer mesh.
pStateSet The global state set used by the buffer mesh. Can be an empty pointer (the default).
initialSubMeshCount If this parameter is not 0, then the given number of BufferMesh::SubMesh objects will be preallocated in the buffer mesh. These sub meshes will all be empty, i.e. have no associated vertex buffer stream mapping, index buffer, or primitive groups. Using BufferMesh::GetSubMesh the client can later fill in these sub meshes.

boost::shared_ptr< RenderContext > GetRenderContext  )  const
 

Returns the render context used by this buffer mesh.

const boost::shared_ptr< StateSet > & GetStateSet  )  const
 

Returns the global state set of this buffer mesh or an empty pointer if there is no global state set associated with this buffer mesh.

BufferMesh::SubMesh & GetSubMesh size_t  index  ) 
 

Returns a reference to a specific sub mesh of this buffer mesh thus allowing direct modification of a sub mesh of this buffer mesh. This is useful, for example, for keyframe animated meshes to change the vertex buffer streams during animations.

const BufferMesh::SubMesh & GetSubMesh size_t  index  )  const
 

Returns a specific sub mesh of this buffer mesh.

size_t GetSubMeshCount  )  const
 

Returns the number of sub meshes in this object.

void GetSubMeshes OutputIteratorT  it  )  const
 

Returns all sub meshes in this buffer mesh.

const std::vector< BufferMesh::SubMesh > & GetSubMeshes  )  const
 

Returns all sub meshes in this buffer mesh.

void Render  ) 
 

Renders this mesh.

void ReplaceSubMesh size_t  index,
const SubMesh subMesh
 

Replaces a specific sub mesh of this buffer mesh with the given sub mesh.

void SetStateSet const boost::shared_ptr< StateSet > &  pStateSet  ) 
 

Sets the global state set of this buffer mesh. The given shared pointer can be empty in which case no global state set will be associated with this buffer mesh.


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