Public Member Functions | Friends

MGeometry Class Reference

This reference page is linked to from the following overview topics: Extension for Autodesk Maya 2013, Data Classes, Devkit Samples, 2.2 Geometric Data (MGeometry), 2.3 Shader Instances, 3.3 Geometry Overrides.


Search for all occurrences

Detailed Description

Geometric data cache.

MGeometry stores the collection of MGeometryData arrays which describe a Maya surface, including per-component data such as UV mapping and colour.

Various methods are provided for returning MGeometryData containing the data for different properties of the geometry: the position() method returns position data, the normal() method returns normals, and so on.

The primitiveArray() method returns MGeometryPrimitive's which provide indexing into those property arrays for each primitive to be drawn.

Examples:

D3DGeometryItem.cpp, hlslShader.cpp, and OpenGLViewportRenderer.cpp.

#include <MGeometry.h>

List of all members.

Public Member Functions

 ~MGeometry ()
 Class destructor.
 MGeometry (const MGeometry &geom)
 Copy constructor.
MGeometryoperator= (const MGeometry &rhs)
 Copy constructor.
unsigned int primitiveArrayCount () const
 Get the number of primitive arrays for this surface.
const MGeometryPrimitive primitiveArray (unsigned int arrayNumber) const
 Get the primitive indexing data for this surface.
const MGeometryData position ()
 Get the position data for this surface.
const MGeometryData normal ()
 Get the normal data for this surface.
const MGeometryData componentId ()
 Get the Maya component id data for this surface.
const MGeometryData texCoord (const MString &name)
 Get a texture coordinate set by name.
const MGeometryData color (const MString &name)
 Get a color set by name.
const MGeometryData tangent (const MString &name)
 Get a tangent set by name.
const MGeometryData binormal (const MString &name)
 Get a binormal set by name.
const MGeometryData data (MGeometryData::DataType what, const MString &name)
 Get arbitrary surface data by name.

Friends

class MGeometryManager
class MGeometryList
class MVaryingParameter

Constructor & Destructor Documentation

MGeometry ( const MGeometry geom)

Copy constructor.

Parameters:
[in]geomMGeometry to copy.

Member Function Documentation

MGeometry & operator= ( const MGeometry rhs)

Copy constructor.

Parameters:
[in]rhsMGeometry to copy
Returns:
MGeometry copied into.
unsigned int primitiveArrayCount ( ) const

Get the number of primitive arrays for this surface.

Returns:
Number of primitive arrays
Examples:
D3DGeometryItem.cpp, and OpenGLViewportRenderer.cpp.
const MGeometryPrimitive primitiveArray ( unsigned int  arrayNumber) const

Get the primitive indexing data for this surface.

The surface geometry may consist of more than one MGeometryPrimitive, each representing an array of primitives. For example, if the surface was composed of both triangles and quads there might be one MGeometryPrimitive for the triangles and a second for the quads. The arrayNumber parameter is used to select between these.

Each MGeometryPrimitive contains indices which are used to map the MGeometryData returned by the other methods of this class onto the primitives. For example, if the returned MGeometryPrimitive is for an array of triangles it will contain three indices for each triangle. Those indices can be used to index into the position data returned by the position() method, the normal data returned by the normal() method, and so on.

Parameters:
[in]arrayNumberNumber of the index data to retrieve. Must be in the range 0 to primitiveArrayCount() - 1.
Returns:
Primitive data structure, which may be empty.
Examples:
D3DGeometryItem.cpp, hlslShader.cpp, and OpenGLViewportRenderer.cpp.
const MGeometryData position ( )

Get the position data for this surface.

Returns:
The position data (which may be empty).
Examples:
D3DGeometryItem.cpp, hlslShader.cpp, and OpenGLViewportRenderer.cpp.
const MGeometryData normal ( )

Get the normal data for this surface.

Returns:
The normal data (which may be empty).
Examples:
D3DGeometryItem.cpp, hlslShader.cpp, and OpenGLViewportRenderer.cpp.
const MGeometryData componentId ( )

Get the Maya component id data for this surface.

This array allows you to correlate MGeometry entries with the corresponding component on the Maya surface (e.g. for meshes, this array will contains the vertex id).

Returns:
The component id data (which may be empty).
const MGeometryData texCoord ( const MString name)

Get a texture coordinate set by name.

Parameters:
[in]namethe name of the set to return
Returns:
The texture coordinate data (which may be empty).
Examples:
D3DGeometryItem.cpp, hlslShader.cpp, and OpenGLViewportRenderer.cpp.
const MGeometryData color ( const MString name)

Get a color set by name.

Parameters:
[in]namethe name of the set to return
Returns:
The color data (which may be empty).
Examples:
D3DGeometryItem.cpp, and OpenGLViewportRenderer.cpp.
const MGeometryData tangent ( const MString name)

Get a tangent set by name.

Parameters:
[in]namethe name of the uv set tangent data should be returned for
Returns:
The tangent data (which may be empty).
Examples:
D3DGeometryItem.cpp, and OpenGLViewportRenderer.cpp.
const MGeometryData binormal ( const MString name)

Get a binormal set by name.

Parameters:
[in]namethe name of the uv set binormal data should be returned for
Returns:
The binormal data (which may be empty).
Examples:
D3DGeometryItem.cpp, and OpenGLViewportRenderer.cpp.
const MGeometryData data ( MGeometryData::DataType  what,
const MString name 
)

Get arbitrary surface data by name.

Parameters:
[in]whatthe type of data requested
[in]namethe name of the data set requested
Returns:
The geometry data (which may be empty).

MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry
MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry MGeometry