Public Types | Public Member Functions | Friends

MGeometryList Class Reference

Search for all occurrences

Detailed Description

Geometric data cache.

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:

hlslShader.cpp, and hlslShader.h.

#include <MGeometryList.h>

List of all members.

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.
  ~MGeometryList ()
  Class destructor.
bool  isDone () const
  Tests to see if the iterator has reached the end of the elements it contains.
void  next ()
  Advance to the next element in the iterator.
void  reset ()
  Reset this iterator to the first element.
int  length () const
  Query the total number of elements available through this iterator.
void  setCurrentElement (int i)
  Randomly access the ith element in the iterator.
MGeometry geometry (int setupFlags=kAll)
  Get the geometry for the current element in the iterator.
const MMatrix objectToWorldMatrix () const
  Get the object to world matrix for the current element in the iterator.
const MMatrix projectionMatrix () const
  Get the camera project matrix for the current element in the iterator.
const MMatrix viewMatrix () const
  Get the camera view matrix for the current element in the iterator.
MDagPath  path () const
  Get the dag path for the current element in the iterator.
MGeometryList::MCullMode  cullMode () const
  Get the rendering cull mode to use for current element in the iterator.
bool  addLast (const MDagPath &path, const MObject *components=NULL)
  Add the geometry representing a shape to this geometry iterator.
bool  addLast (const MGeometry &geometry, const MMatrix &matrix)
  Add arbitrary geometry to this geometry iterator.

Friends

class  MUniformParameter
class  MGeometryManager

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] info the rendering context the geometry in this iterator should use.
[in] initialCapacity the 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:
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:
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] i the index of the element you want to access
MGeometry & geometry ( int  setupFlags = kAll )

Get the geometry for the current element in the iterator.

Parameters:
[in] setupFlags the 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:
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.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.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.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.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] path The DAG path for the shape to add
[in] components The 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 MGeometry 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] geometry the geometry cache to add
[in] matrix the transformation to associate with this geometry
Returns:
True if the element was added to the iterator, false otherwise.

MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList
MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList MGeometryList