- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MGeometryExtractor Class Reference
OpenMayaRender - API module for rendering

Search for all occurrences

## Detailed Description

class for extracting renderable geometry

Construct an instance of this class to populate buffers with vertex and indexing data. Buffers are filled based on the supplied requirements. Use the MIndexBufferDescriptor and MVertexBufferDescriptor classes to request a broad range of data types, formats, and content.

Buffers are filled in-place so you should request the primitive count and vertex count before filling the buffers. Use the count multiplied by the element stride to construct data buffers large enough to fill properly prior to calling one of the populate methods.

`#include <MGeometryExtractor.h>`

List of all members.

## Public Member Functions
| MGeometryExtractor (const MHWRender::MGeometryRequirements &requirements, const MDagPath &path, const bool sharing=true, MStatus *status=NULL)
| Construct a MGeometryExtractor.
| ~MGeometryExtractor ()
| Destructor.
unsigned int | primitiveCount (const MHWRender::MIndexBufferDescriptor &indexDesc) const
| Returns the number of primitives (triangles, lines, points, etc.) that will be produced for the given indexing requirements.
MStatus | populateIndexBuffer (void *data, const unsigned int primitiveCount, const MHWRender::MIndexBufferDescriptor &indexDesc) const
| Fill a buffer with geometry indexing data.
unsigned int | vertexCount () const
| Returns the number of vertices that will be produced for the vertex requirement.
MStatus | populateVertexBuffer (void *data, const unsigned int vertexCount, const MHWRender::MVertexBufferDescriptor &bufferDesc) const
| Fill a buffer with vertex data.
## Static Public Member Functions
static unsigned int | minimumBufferSize (unsigned int primitiveCount, MGeometry::Primitive primitive, unsigned int primitiveStride=0)
| Get the minimum buffer size required by populateIndexBuffer().

## Constructor & Destructor Documentation

MGeometryExtractor | ( | const MHWRender::MGeometryRequirements & | requirements,
|  | const MDagPath & | path,
|  | const bool | sharing = `true`,
|  | MStatus * | status = `NULL`
| ) |  |

Construct a MGeometryExtractor.

Parameters:

  [in] | requirements | The list of requirements that will be requested from the geometry. This includes descriptions for the vertex and index streams that will be requested.
  [in] | path | A path to the object being translated.
  [in] | sharing | Indicates if you want vertex sharing to be computed by the extractor. Vertex buffer size will be reduced if sharing can be performed.
  [out] | status | A return code indicating if this object can be translated or not.

Status Codes:
  - MS::kSuccess The objects supplied in the path can be properly translated.
  - MS::kFailure This object type is not supported for translation.

## Member Function Documentation

unsigned int primitiveCount | ( | const MHWRender::MIndexBufferDescriptor & | indexDesc | ) | const

Search for all occurrences

Returns the number of primitives (triangles, lines, points, etc.) that will be produced for the given indexing requirements.

Call this method before calling populateIndexBuffer to determine the minimum size the buffer passed into populateIndexBuffer needs to be.

Parameters:

  [in] | indexDesc | The description of the index buffer you request the count for.

Returns:
  The number of primitives (triangles, lines, points, etc.) that the extractor will produce for the requirement specified by this index descriptor.

MStatus populateIndexBuffer | ( | void * | data,
|  | const unsigned int | primitiveCount,
|  | const MHWRender::MIndexBufferDescriptor & | indexDesc
| ) |  | const

Search for all occurrences

Fill a buffer with geometry indexing data.

This method will use the information provided in the MIndexBufferDescriptor argument to populate the buffer with the desired indexing data. The descriptor will describe the surface index type, the primitive type, and the data type. The populateIndexBuffer method will generate a buffer that matches the request. The length of the buffer should be at least the as big as the value returned by minimumBufferSize().

Parameters:

  [in] | data | The buffer you want filled.
  [in] | primitiveCount | The number of primitives you expect to be filled in the buffer.
  [in] | indexDesc | The description of the buffer you are requesting.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The buffer was filled properly.
  - MS::kFailure An error occurred.

unsigned int vertexCount | ( |  | ) | const

Search for all occurrences

Returns the number of vertices that will be produced for the vertex requirement.

Call this method before calling populateVertexBuffer to determine the minimum size the buffer passed into populateVertexBuffer needs to be.

Returns:
  The number of vertices that the extractor will produce for this geometry.

MStatus populateVertexBuffer | ( | void * | data,
|  | const unsigned int | vertexCount,
|  | const MHWRender::MVertexBufferDescriptor & | bufferDesc
| ) |  | const

Search for all occurrences

Fill a buffer with vertex data.

This method will use the information provided in the MVertexBufferDescriptor argument to populate the buffer with the desired vertex data. The descriptor will describe the buffer's name, semantic, and data type. The populateVertexBuffer method will supply a buffer that matches the request. The length of the buffer should be at least (vertexCount * bufferDesc.stride()).

Parameters:

  [in] | data | The buffer you want filled.
  [in] | vertexCount | The vertex count you expect to be filled in the buffer.
  [in] | bufferDesc | The description of the buffer you are requesting.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The buffer was filled properly.
  - MS::kFailure An error occurred.

unsigned int minimumBufferSize | ( | unsigned int | primitiveCount,
|  | MGeometry::Primitive | primitive,
|  | unsigned int | primitiveStride = `0`
| ) |  | `[static]`

Search for all occurrences

Get the minimum buffer size required by populateIndexBuffer().

Parameters:

  [in] | primitiveCount | The number of primitives.
  [in] | primitive | The primitive type
  [in] | primitiveStride | The number of control points in a patch when the type is kPatch.

Returns:
  The minimum buffer size required by populateIndexBuffer().

MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor
MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor MGeometryExtractor