MGeometryData Class Reference
[OpenMayaRender - API module for rendering]

#include <MGeometryData.h>

List of all members.


Detailed Description

Geometric data container.

This class allows storage of arbitrary data which is formated to be specifically suitable for usage using a 3D display interface such as OpenGL.

Format options include:

Currently Maya only interprets a fixed format subset for data with recongnized semantics, This does not mean that the user cannot create any arbitrary format for data storage. Support formats with semantics includes:

Memory allocation of the correct size is left up to the user of this class.

Memory can be marked as "owned" by this class or the user of this class. Ownership by this class is the default behaviour specified in the constructor. If the data is marked as being owned by the class, it is assumed that the data is created using a "new" operation, as the destructor of this class will use a "delete" operation to free memory.

Internal Maya data which is passed to the user via this class is always assumed to be non-modifiable. If modified, stability cannot be ensured.

Examples:

cgfxShaderNode.cpp, D3DGeometryItem.cpp, GLSLShaderNode.cpp, GLSLShaderNode.h, hlslShader.cpp, hwColorPerVertexShader.cpp, hwPhongShader.cpp, hwPhongShader.h, and OpenGLViewportRenderer.cpp.


Public Types

enum  ElementSize {
  kInvalidElementSize = 0, kOne = 1, kTwo, kThree,
  kFour
}
 Specifies the size or dimension of each data element of the storage. More...
enum  ElementType {
  kInvalidElementType = -1, kFloat = 0, kDouble, kChar,
  kUnsignedChar, kInt16, kUnsignedInt16, kInt32,
  kUnsignedInt32
}
 Specifies the data type of each data element of the storage. More...
enum  DataType {
  kInvalidDataType = 0, kPosition, kNormal, kTexCoord,
  kColor, kWeight, kAPISupported, kTangent,
  kBiNormal, kVelocity, kPrimitiveCenter, kColorMask,
  kUserData, kMaxDataTypeIndex
}
 Specifies the data type of the storage array. More...

Public Member Functions

 MGeometryData (const char *dataName, DataType dataType, ElementType elementType, ElementSize elementSize, unsigned int elementCount, void *dataPtr=NULL, bool ownsData=true)
 MGeometryData (const MGeometryData &)
 ~MGeometryData ()
const char * objectName () const
int uniqueID () const
DataType dataType () const
ElementType elementType () const
unsigned int elementTypeSize () const
ElementSize elementSize () const
unsigned int elementCount () const
void * data () const
void setCollectionNumber (int cn)
int collectionNumber () const
void setObjectOwnsData (bool val)
bool objectOwnsData () const

Friends

class MGeometry
class MHardwareRenderer
class MD3D9Renderer

Member Enumeration Documentation

Specifies the size or dimension of each data element of the storage.

Enumerator:
kInvalidElementSize  Invalid element size.
kOne  Single value.
kTwo  2-tuple
kThree  3-tuple
kFour  4-tuple

Specifies the data type of each data element of the storage.

Enumerator:
kInvalidElementType  Invalid element type (default value).
kFloat  IEEE single precision floating point.
kDouble  IEEE double precision floating point.
kChar  Signed char.
kUnsignedChar  Unsigned char.
kInt16  Signed 16-bit integer.
kUnsignedInt16  Unsigned 16-bit integer.
kInt32  Signed 32-bit integer.
kUnsignedInt32  Unsigned 32-bit integer.

Specifies the data type of the storage array.

Enumerator:
kInvalidDataType  Invalid data type (default value).
kPosition  Position vector.
kNormal  Normal vector.
kTexCoord  Texture coordinate tuple.
kColor  Color tuple.
kWeight  Vertex weighting data.
kAPISupported  Separator to indicate native draw API supported types.
kTangent  Tangent vector.
kBiNormal  Bi-normal vector.
kVelocity  Velocity vector.
kPrimitiveCenter  Center of primitive.
kColorMask  Mapped, unmapped color mask.
kUserData  Arbitrary "user data".
kMaxDataTypeIndex  Valid entries are < kMaxDataTypeIndex.


Constructor & Destructor Documentation

MGeometryData::MGeometryData ( const char *  dataName,
MGeometryData::DataType  dataType,
MGeometryData::ElementType  elementType,
MGeometryData::ElementSize  elementSize,
unsigned int  elementCount,
void *  dataPtr = NULL,
bool  ownsData = true 
)

Geometry data constructor. Data is reference counted. On creation the reference count is set to be 1.

Parameters:
[in] dataName name of the data
[in] dataType type of data
[in] elementType element type
[in] elementCount element count
[in] dataPtr pointer to contiguous block of data
[in] ownsData flag to tell if the instance owns the data or not.

MGeometryData::MGeometryData ( const MGeometryData other  ) 

Copy constructor.

MGeometryData::~MGeometryData (  ) 

Class destructor. Automatically releases the associated image array.


Member Function Documentation

const char * MGeometryData::objectName (  )  const

Return the logical name of the geometry

Returns:
NULL or object name string pointer.

int MGeometryData::uniqueID (  )  const

Return the per session unique identifier

Returns:
Unique data identifier. -1 on error.

MGeometryData::DataType MGeometryData::dataType (  )  const

Get the data type for the data.

Returns:
Geometry data type. MGeometryData::kInvalid on error.

MGeometryData::ElementType MGeometryData::elementType (  )  const

Returns the data type.

Returns:
Element type. MGeometryData::kInvalidElementType on error.

unsigned int MGeometryData::elementTypeSize (  )  const

Return the element type size

Returns:
Size of element in bytes.

MGeometryData::ElementSize MGeometryData::elementSize (  )  const

Return element size.

Returns:
Element size. MGeometryData::kInvalidElementSize is returned on error.

unsigned int MGeometryData::elementCount (  )  const

Return element count.

Returns:
Element count. 0 is returned on error.
Examples:

void * MGeometryData::data (  )  const

Retrieve a pointer to the internal data

Returns:
Void pointer to the data. Pointer is NULL on error.
Examples:

void MGeometryData::setCollectionNumber ( int  collectionNumber  ) 

Set the collection number for the object. Numbers less than 0 are invalid collection numbers.

Parameters:
[in] collectionNumber The number to use

int MGeometryData::collectionNumber (  )  const

Get the collection number of the data. Collection numbers are zero-based.

Returns:
-1 if failed. Else number greather than -1.

void MGeometryData::setObjectOwnsData ( bool  value  ) 

Set ownship of the interal data.

Parameters:
[in] value ownership flag to set to.

bool MGeometryData::objectOwnsData (  )  const

Return if the MGeometryData object owns the internal data or not.

Returns:
True if owned internally, else false.


Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6