MVertexBufferDescriptor Class Reference

This reference page is linked to from the following overview topics: Data Classes, 2.2 Geometric Data (MGeometry), 4.3 Customizing Geometric Data for Shaders.



Detailed Description

Describes properties of a vertex buffer.

This class gives a complete description of a vertex buffer and is used by MGeometry, MVertexBuffer and MGeometryRequirements to simplify management of vertex buffer attributes.

Note that not all combinations of semantics, data types and dimensions are currently supported. Attempts to create vertex buffers with unsupported attributes will fail.

Examples:

cgfxShaderNode.cpp, hwColorPerVertexShader.cpp, and hwPhongShader.cpp.

#include <MHWGeometry.h>

List of all members.

Public Member Functions

 MVertexBufferDescriptor ()
 Constructor.
 MVertexBufferDescriptor (const MString &name, MGeometry::Semantic semantic, MGeometry::DataType dataType, int dimension)
 Constructor.
 ~MVertexBufferDescriptor ()
 Destructor.
 MVertexBufferDescriptor (const MVertexBufferDescriptor &other)
 NO SCRIPT SUPPORT.
MVertexBufferDescriptoroperator= (const MVertexBufferDescriptor &other)
 NO SCRIPT SUPPORT.
MString name () const
 Get the name of the buffer.
void setName (const MString &n)
 Set the name of the buffer The buffer name is used to determine which render item this buffer belongs to.
MGeometry::Semantic semantic () const
 Get the semantic of the buffer The semantic is used by the hardware effects system and must be one of the predefined types.
void setSemantic (MGeometry::Semantic s)
 Set the semantic of the buffer.
MString semanticName () const
 Get the semantic name of the buffer The semanticName is used to identify a custom vertex stream request in order to fill the stream with the appropriate data requested by a shader override.
void setSemanticName (const MString &n)
 Set the semantic name of the buffer The semanticName is used to identify a custom vertex stream request in order to fill the stream with the appropriate data requested by a shader override.
MGeometry::DataType dataType () const
 Get the data type of the buffer.
void setDataType (MGeometry::DataType d)
 Set the data type of the buffer.
unsigned int dataTypeSize () const
 Get the size in bytes of the data type of the buffer.
int dimension () const
 Get the dimension of the buffer.
void setDimension (int d)
 Set the dimension of the buffer.
int offset () const
 Get the offset of the vertex buffer.
void setOffset (int o)
 Set the offset of the vertex element in an interleaved vertex buffer.
int stride () const
 Get the stride of the vertex buffer.

Static Public Member Functions

static const char * className ()
 Returns the name of this class.

Friends

class MGeometryRequirements

Constructor & Destructor Documentation

MVertexBufferDescriptor ( const MString name,
MGeometry::Semantic  semantic,
MGeometry::DataType  type,
int  dimension 
)

Constructor.

Parameters:
[in]nameThe name of the buffer
[in]semanticThe semantic of the buffer
[in]typeThe data type of the buffer
[in]dimensionThe dimension of the data type

NO SCRIPT SUPPORT.

Copy constructor.

Parameters:
[in]otherThe descriptor to copy

Member Function Documentation

MVertexBufferDescriptor & operator= ( const MVertexBufferDescriptor other)

NO SCRIPT SUPPORT.

Assignment operator.

Parameters:
[in]otherThe descriptor to copy
Returns:
Reference to this
MString name ( ) const

Get the name of the buffer.

Returns:
The name of the buffer
Examples:
cgfxShaderNode.cpp, and hwPhongShader.cpp.
void setName ( const MString n)

Set the name of the buffer The buffer name is used to determine which render item this buffer belongs to.

This name is typically set by the evaluator of the geometry.

Parameters:
[in]nThe new name
MGeometry::Semantic semantic ( ) const

Get the semantic of the buffer The semantic is used by the hardware effects system and must be one of the predefined types.

Returns:
The semantic of the buffer
Examples:
cgfxShaderNode.cpp, hwColorPerVertexShader.cpp, and hwPhongShader.cpp.
void setSemantic ( MGeometry::Semantic  s)

Set the semantic of the buffer.

Parameters:
[in]sThe new semantic
MString semanticName ( ) const

Get the semantic name of the buffer The semanticName is used to identify a custom vertex stream request in order to fill the stream with the appropriate data requested by a shader override.

Returns:
The custom semantic name assigned to the buffer
Examples:
cgfxShaderNode.cpp.
void setSemanticName ( const MString n)

Set the semantic name of the buffer The semanticName is used to identify a custom vertex stream request in order to fill the stream with the appropriate data requested by a shader override.

Parameters:
[in]nThe new semantic name to assign to the buffer
MGeometry::DataType dataType ( ) const

Get the data type of the buffer.

Returns:
The data type of the buffer
Examples:
hwPhongShader.cpp.
void setDataType ( MGeometry::DataType  d)

Set the data type of the buffer.

Parameters:
[in]dThe new dataType
unsigned int dataTypeSize ( ) const

Get the size in bytes of the data type of the buffer.

Returns:
the size in bytes of the data type of the buffer
Examples:
cgfxShaderNode.cpp.
int dimension ( ) const

Get the dimension of the buffer.

Returns:
The dimension of the buffer
Examples:
cgfxShaderNode.cpp, and hwPhongShader.cpp.
void setDimension ( int  d)

Set the dimension of the buffer.

Parameters:
[in]dThe new dimension
int offset ( ) const

Get the offset of the vertex buffer.

The value returned by this method is currently only valid in the context of MPxShaderOverride::draw().

Returns:
The offset of the vertex buffer.
Examples:
cgfxShaderNode.cpp, hwColorPerVertexShader.cpp, and hwPhongShader.cpp.
void setOffset ( int  o)

Set the offset of the vertex element in an interleaved vertex buffer.

User-setting of this value is only supported when using custom client buffers via resourceHandle(void*).

Vertex fields in shared, interleaved vertex buffers should be given the same resourceHandle pointer. Interleaved vertex formats must be close-packed, with no extra space in between defined fields.

Not currently supported in DirectX.

Parameters:
[in]oThe new offset of the vertex field, in number of 4-byte words (floats).
int stride ( ) const

Get the stride of the vertex buffer.

Note user-setting of this value is not currently supported. The value returned by this method is currently only valid in the context of MPxShaderOverride::draw().

Returns:
The stride of the vertex buffer.
Examples:
cgfxShaderNode.cpp, hwColorPerVertexShader.cpp, and hwPhongShader.cpp.
const char * className ( ) [static]

Returns the name of this class.

Returns:
The name of this class.

MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor
MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor MVertexBufferDescriptor