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

BufferMesh::PrimitiveGroup Class Reference
[XEngineUtil Library]

List of all members.

Detailed Description

This class represents a primitive group. Primitive groups describe primitives, such as points, lines, or triangles, stored in a way defined by RenderContext::PrimitiveType, such as triangle list, line strip, or point list.

There are two flavours of primitive groups:

The PrimitiveGroup class by itself is rather useless. Only in combination with the SubMesh class does a primitive group get a meaning because a sub mesh object stores pointers to the vertex and index buffers that a primtive group uses.

The primitive group class stores the following properties about a group of primitives:


Public Types

enum  PrimitiveGroupType { Indexed, NonIndexed }
 The primitive group type enum. More...

Public Member Functions

 PrimitiveGroup (PrimitiveGroupType type, RenderContext::PrimitiveType primitiveType, size_t startIndex, size_t primitiveCount, const boost::shared_ptr< StateSet > &pStateSet, size_t minVertexIndex=0, size_t maxVertexIndex=0)
 Constructor that takes a state set that will be associated with this primitive group.
 PrimitiveGroup (PrimitiveGroupType type, RenderContext::PrimitiveType primitiveType, size_t startIndex, size_t primitiveCount, size_t minVertexIndex=0, size_t maxVertexIndex=0)
 Constructor that doesn't associate a state set with this primitive group.
PrimitiveGroupType GetType () const
 Returns the type of this primitive group, whether it is indexed or non-indexed.
RenderContext::PrimitiveType GetPrimitiveType () const
 Returns the primitive type of this primitive group (i.e. triangle list, triangle strip, ...).
size_t GetPrimitiveCount () const
 Returns the primitive count.
size_t GetVertexCount () const
 Returns the number of vertices that this primitive uses.
size_t GetStartIndex () const
 Returns the start index into the vertex buffer for non-indexed primitives and into the index buffer for indexed primitives.
const boost::shared_ptr< StateSet > & GetStateSet () const
 Returns the state set associated with this primitive group.
size_t GetMinVertexIndex () const
 Returns the minimum vertex index in the vertex buffer used by this primitive group, if it is an indexed primitive group.
size_t GetMaxVertexIndex () const
 Returns the maximum vertex index in the vertex buffer used by this primitive group, if it is an indexed primitive group.


Member Enumeration Documentation

enum PrimitiveGroupType
 

This enum type defines the two types of primitive groups, indexed and non-indexed.

Enumeration values:
Indexed  Indexed primitive group.
NonIndexed  Not indexed primitive group.


Constructor & Destructor Documentation

PrimitiveGroup PrimitiveGroupType  type,
RenderContext::PrimitiveType  primitiveType,
size_t  startIndex,
size_t  primitiveCount,
const boost::shared_ptr< StateSet > &  pStateSet,
size_t  minVertexIndex = 0,
size_t  maxVertexIndex = 0
 

Constructs a new primitive group with the given parameters.

Parameters:
type The primitive group type, either Indexed or NonIndexed.
primitiveType The primitive type (points, lines or triangles).
startIndex For indexed primitive groups, the start offset into the index buffer where the primitives are supposed to begin. For non-indexed primitive groups, the start offset into the vertex buffer.
primitiveCount The number of primitive elements that make up the primitive group.
pStateSet The state set that is supposed to be associated with this primitive group.
minVertexIndex The minimum vertex index occuring in the index buffer. If you specify this, be sure that it really is the minimum vertex index used. If specified, optimizes performance because the vertex buffer will only have to be accessed starting with the vertex indexed by minVertexIndex.
maxVertexIndex The maximum vertex index occuring in the index buffer If this value is 0, then the maximum possible vertex index (which corresponds to the size of the vertex buffer - 1) will be used.
Warning:
The primitive type PointList is not allowed for indexed primitives.

PrimitiveGroup PrimitiveGroupType  type,
RenderContext::PrimitiveType  primitiveType,
size_t  startIndex,
size_t  primitiveCount,
size_t  minVertexIndex = 0,
size_t  maxVertexIndex = 0
 

Constructs a new primitive group with the given parameters. This constructor does not associate a state set with the primitive group and thus creates a primitive group that doesn't change any state when rendered.

Parameters:
type The primitive group type, either Indexed or NonIndexed.
primitiveType The primitive type (points, lines or triangles).
startIndex For indexed primitive groups, the start offset into the index buffer where the primitives are supposed to begin. For non-indexed primitive groups, the start offset into the vertex buffer.
primitiveCount The number of primitive elements that make up the primitive group.
minVertexIndex The minimum vertex index occuring in the index buffer. If you specify this, be sure that it really is the minimum vertex index used. If specified, optimizes performance because the vertex buffer will only have to be accessed starting with the vertex indexed by minVertexIndex.
maxVertexIndex The maximum vertex index occuring in the index buffer If this value is 0, then the maximum possible vertex index (which corresponds to the size of the vertex buffer - 1) will be used.
Warning:
The primitive type PointList is not allowed for indexed primitives.


Member Function Documentation

size_t GetMaxVertexIndex  )  const
 

Returns the maximum vertex index in the vertex buffer used by this primitive group, if it is an indexed primitive group.

size_t GetMinVertexIndex  )  const
 

Returns the minimum vertex index in the vertex buffer used by this primitive group, if it is an indexed primitive group.

size_t GetPrimitiveCount  )  const
 

Returns the primitive count.

RenderContext::PrimitiveType GetPrimitiveType  )  const
 

Returns the primitive type of this primitive group (i.e. triangle list, triangle strip, ...).

size_t GetStartIndex  )  const
 

Returns the start index into the vertex buffer for non-indexed primitives and into the index buffer for indexed primitives.

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

Returns the state set associated with this primitive group.

BufferMesh::PrimitiveGroup::PrimitiveGroupType GetType  )  const
 

Returns the type of this primitive group, whether it is indexed or non-indexed.

size_t GetVertexCount  )  const
 

Returns the number of vertices that this primitive group uses. Uses the stored primitive count and primitive type to determine the number of vertices used by this primitive group.


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