C++ API Reference
MGeometryList Class Reference

This class holds the set of data elements which represent a Maya surface. More...

#include <MGeometryList.h>

Public Types

enum  {
  kNone = 0, kMatrices = 1 << 0, kFixedFunctionLighting = 1 << 1, kCulling = 1 << 2,
  kAll = -1
}
 Bit flags for the geometry method that govern which OpenGL state Maya sets for you. More...
 
enum  MCullMode { kCullNone, kCullCW, kCullCCW }
 Defines the culling modes to use when rendering this geometry. More...
 

Public Member Functions

 MGeometryList (const MRenderingInfo &info, int initialCapacity=1)
 Create an emtpy GeometryIterator for the specified rendering context. More...
 
 ~MGeometryList ()
 Class destructor.
 
bool isDone () const
 Tests to see if the iterator has reached the end of the elements it contains. More...
 
void next ()
 Advance to the next element in the iterator. More...
 
void reset ()
 Reset this iterator to the first element. More...
 
int length () const
 Query the total number of elements available through this iterator. More...
 
void setCurrentElement (int i)
 Randomly access the ith element in the iterator. More...
 
MGeometryLegacygeometry (int setupFlags=kAll)
 Get the geometry for the current element in the iterator. More...
 
const MMatrixobjectToWorldMatrix () const
 Get the object to world matrix for the current element in the iterator. More...
 
const MMatrixprojectionMatrix () const
 Get the camera project matrix for the current element in the iterator. More...
 
const MMatrixviewMatrix () const
 Get the camera view matrix for the current element in the iterator. More...
 
MDagPath path () const
 Get the dag path for the current element in the iterator. More...
 
MGeometryList::MCullMode cullMode () const
 Get the rendering cull mode to use for current element in the iterator. More...
 
bool addLast (const MDagPath &path, const MObject *components=NULL)
 Add the geometry representing a shape to this geometry iterator. More...
 
bool addLast (const MGeometryLegacy &geometry, const MMatrix &matrix)
 Add arbitrary geometry to this geometry iterator. More...
 

Public Attributes

enum MGeometryList:: { ... }  MSetupFlags
 Bit flags for the geometry method that govern which OpenGL state Maya sets for you.
 

Detailed Description

This class holds the set of data elements which represent a Maya surface.

It provides iterated access to a list of geometry items, along with the rendering context require to render them (e.g. matrix, etc).

Examples:
customTextureShader/customTextureShader.cpp, customTextureShader/customTextureShader.h, dx11Shader/dx11Shader.cpp, dx11Shader/dx11Shader.h, hlslShader/hlslShader.cpp, and hlslShader/hlslShader.h.

Member Enumeration Documentation

anonymous enum

Bit flags for the geometry method that govern which OpenGL state Maya sets for you.

Enumerator
kNone 

No renderer setup is required for this element.

kMatrices 

Setup the model view matrix for this element.

kFixedFunctionLighting 

Setup the fixed function lighting state for this element.

kCulling 

Setup the back/front face culling state for this element.

kAll 

Setup all renderer state for this element.

enum MCullMode

Defines the culling modes to use when rendering this geometry.

Enumerator
kCullNone 

No culling should be performed on this geometry.

kCullCW 

Cull clockwise faces when rendering this geometry.

kCullCCW 

Cull counter-clockwise faces when rendering this geometry.

Constructor & Destructor Documentation

MGeometryList ( const MRenderingInfo info,
int  initialCapacity = 1 
)

Create an emtpy GeometryIterator for the specified rendering context.

Parameters
[in]infothe rendering context the geometry in this iterator should use.
[in]initialCapacitythe number of elements to pre-allocate space for.

Member Function Documentation

bool isDone ( ) const

Tests to see if the iterator has reached the end of the elements it contains.

Once this method returns true, you should not call any further methods on the iterator.

Returns
True if the iterator has no further elements, false if there are more elements remaining.
Examples:
dx11Shader/dx11Shader.cpp, and hlslShader/hlslShader.cpp.
void next ( )

Advance to the next element in the iterator.

This should only be called if the iterator indicates it has more elements through the isDone() method.

Examples:
dx11Shader/dx11Shader.cpp, and hlslShader/hlslShader.cpp.
void reset ( )

Reset this iterator to the first element.

This allows you to iterate multiple times through the list.

int length ( ) const

Query the total number of elements available through this iterator.

Returns
The total number of elements in the iterator.
void setCurrentElement ( int  i)

Randomly access the ith element in the iterator.

Parameters
[in]ithe index of the element you want to access
MGeometryLegacy & geometry ( int  setupFlags = kAll)

Get the geometry for the current element in the iterator.

Parameters
[in]setupFlagsthe parts of the rendering pipeline your shader needs setup in order to render. This can be any combination of kMatrices, kFixedFunctionLighting, kCulling, or kAll. For efficiency, you can avoid the overhead of setting up parts of the rendering pipeline not used by your shader (e.g. fixed function lighting).
Returns
The geometry for the current element.
Examples:
dx11Shader/dx11Shader.cpp, and hlslShader/hlslShader.cpp.
const MMatrix & objectToWorldMatrix ( ) const

Get the object to world matrix for the current element in the iterator.

Returns
The matrix for the current element.
Examples:
hlslShader/hlslShader.cpp.
const MMatrix & projectionMatrix ( ) const

Get the camera project matrix for the current element in the iterator.

Returns
The matrix for the current element.
Examples:
hlslShader/hlslShader.cpp.
const MMatrix & viewMatrix ( ) const

Get the camera view matrix for the current element in the iterator.

Returns
The matrix for the current element.
Examples:
hlslShader/hlslShader.cpp.
MDagPath path ( ) const

Get the dag path for the current element in the iterator.

Returns
The dag path for the current element.
MGeometryList::MCullMode cullMode ( ) const

Get the rendering cull mode to use for current element in the iterator.

Returns
The cull mode for the current element.
Examples:
hlslShader/hlslShader.cpp.
bool addLast ( const MDagPath path,
const MObject components = NULL 
)

Add the geometry representing a shape to this geometry iterator.

Note that you are only able to add geometry items to MGeometryLists you have created using the public constructor. Trying to add elements to an iterator passed to you from Maya (e.g. in a shader render call) will fail.

Parameters
[in]pathThe DAG path for the shape to add
[in]componentsThe optional set of components (faces) to include in the geometry. A NULL value indicates the whole object should be added
Returns
True if the element was added to the iterator, false otherwise.
bool addLast ( const MGeometryLegacy geometry,
const MMatrix matrix 
)

Add arbitrary geometry to this geometry iterator.

Note that you are only able to add geometry items to MGeometryLists you have created using the public constructor. Trying to add elements to an iterator passed to you from Maya (e.g. in a shader render call) will fail.

Parameters
[in]geometrythe geometry cache to add
[in]matrixthe transformation to associate with this geometry
Returns
True if the element was added to the iterator, false otherwise.

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