Class for working with geometric structures used to draw objects.
This class provides a means to specify and access geometric data used to draw objects in Viewport 2.0.
Objects of type MGeometry cannot be created or destroyed. They are only accessed through methods on draw override classes such as MPxShaderOverride or MPxGeometryOverride.
Each MGeometry object contains zero or more vertex buffers and zero or more index buffers. In read-only scenarios, these buffers describe geometry that is about to be drawn and can be used to bind custom shaders to the actual geometry streams on the GPU (see MPxShaderOverride for more details). In the non-read only scenario, MGeometry can be used to provide vertex and index data to Maya to use to draw Maya DAG objects with arbitrary shaders (see MPxGeometryOverride). In all cases the MGeometry instance owns the vertex and index buffers and manages their lifetimes.
cgfxShaderNode.cpp, hwColorPerVertexShader.cpp, and hwPhongShader.cpp.
#include <MHWGeometry.h>
Public Types |
|
enum |
DataType { kInvalidType, kFloat, kDouble, kChar, kUnsignedChar, kInt16, kUnsignedInt16, kInt32, kUnsignedInt32 } |
Specifies data types to use with buffers. More... |
|
enum |
Semantic { kInvalidSemantic, kPosition, kNormal, kTexture, kColor, kTangent, kBitangent } |
Specifies the semantic of a data buffer. More... |
|
enum |
Primitive { kInvalidPrimitive, kPoints, kLines, kLineStrip, kTriangles, kTriangleStrip } |
Specifies the data primitive type constructed by the indexing array. More... |
|
enum | DrawMode { kAll, kWireframe, kShaded } |
Specifies draw mode for render items. More... |
|
Public Member Functions |
|
int | vertexBufferCount () const |
Get the number of vertex buffers contained
in this
MGeometry object. |
|
const MVertexBuffer * | vertexBuffer (int index) const |
Get the vertex buffer stored at the given
index. |
|
MVertexBuffer * | vertexBuffer (int index) |
Get the vertex buffer stored at the given
index. |
|
MVertexBuffer * | createVertexBuffer (const MVertexBufferDescriptor &desc) |
Creates a vertex buffer which is owned by
this object. |
|
bool | deleteVertexBuffer (int index) |
Remove and destroy a vertex buffer from this
object. |
|
int | indexBufferCount () const |
Get the number of index buffers contained in
this
MGeometry object. |
|
const MIndexBuffer * | indexBuffer (int index) const |
Get the index buffer stored at the given
index. |
|
MIndexBuffer * | indexBuffer (int index) |
Get the index buffer stored at the given
index. |
|
MIndexBuffer * | createIndexBuffer (MGeometry::DataType type) |
Creates an index buffer which is owned by
this object. |
|
bool | deleteIndexBuffer (int index) |
Remove and destroy an index buffer from this
object. |
|
Static Public Member Functions |
|
static const MString & | dataTypeString (MGeometry::DataType d) |
Get a logical string name for the data type.
|
|
static const MString & | semanticString (MGeometry::Semantic s) |
Get a logical string name for the semantic.
|
|
static const MString & | primitiveString (MGeometry::Primitive p) |
Get a logical string name for the primitive.
|
|
static const MString & | drawModeString (MGeometry::DrawMode d) |
Get a logical string name for the semantic.
|
|
static const char * | className () |
Returns the name of this class. |
enum DataType |
Specifies data types to use with buffers.
enum Semantic |
Specifies the semantic of a data buffer.
enum Primitive |
Specifies the data primitive type constructed by the indexing array.
enum DrawMode |
Specifies draw mode for render items.
const MString & dataTypeString | ( | MGeometry::DataType | d | ) | [static] |
Get a logical string name for the data type.
Useful for debug printing.
[in] | d | The data type |
const MString & semanticString | ( | MGeometry::Semantic | s | ) | [static] |
Get a logical string name for the semantic.
Useful for debug printing.
[in] | s | The semantic |
const MString & primitiveString | ( | MGeometry::Primitive | p | ) | [static] |
Get a logical string name for the primitive.
Useful for debug printing.
[in] | p | The primitive |
const MString & drawModeString | ( | MGeometry::DrawMode | d | ) | [static] |
Get a logical string name for the semantic.
Useful for debug printing.
[in] | d | The draw mode |
int vertexBufferCount | ( | ) | const |
Get the number of vertex buffers contained in this MGeometry object.
const MVertexBuffer * vertexBuffer | ( | int | index | ) | const |
Get the vertex buffer stored at the given index.
Note, the vertex buffer is owned by this MGeometry object.
[in] | index | The index |
MVertexBuffer * vertexBuffer | ( | int | index | ) |
Get the vertex buffer stored at the given index.
Note, the vertex buffer is owned by this MGeometry object.
[in] | index | The index |
MVertexBuffer * createVertexBuffer | ( | const MVertexBufferDescriptor & | desc | ) |
Creates a vertex buffer which is owned by this object.
Returns the buffer for modification by the caller. Note that not all vertex buffer descriptors can be used to create vertex buffers as not all combinations of data types, dimensions and semantics are supported. If the descriptor is not supported this method will return NULL.
[in] | desc | The descriptor for the buffer to create |
bool deleteVertexBuffer | ( | int | index | ) |
Remove and destroy a vertex buffer from this object.
[in] | index | The index of the buffer to remove |
int indexBufferCount | ( | ) | const |
Get the number of index buffers contained in this MGeometry object.
const MIndexBuffer * indexBuffer | ( | int | index | ) | const |
Get the index buffer stored at the given index.
Note, the index buffer is owned by this MGeometry object.
[in] | index | The index |
MIndexBuffer * indexBuffer | ( | int | index | ) |
Get the index buffer stored at the given index.
Note, the index buffer is owned by this MGeometry object.
[in] | index | The index |
MIndexBuffer * createIndexBuffer | ( | MGeometry::DataType | type | ) |
Creates an index buffer which is owned by this object.
Returns the buffer for modification by the caller. Note, not all data types are supported for index buffer creation. If a data type is not supported this method will return NULL.
[in] | type | The type for the buffer |
bool deleteIndexBuffer | ( | int | index | ) |
Remove and destroy an index buffer from this object.
[in] | index | The index of the buffer to remove |
const char * className | ( | ) | [static] |