MGeometryExtractor Class Reference

#include <MGeometryExtractor.h>

Class 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.

+ Examples:

Public Member Functions

 MGeometryExtractor (const MHWRender::MGeometryRequirements &requirements, const MDagPath &path, MPolyGeomOptions options, MStatus *status=NULL)
 Construct a MGeometryExtractor. More...
 
 ~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. More...
 
MStatus populateIndexBuffer (void *data, const unsigned int primitiveCount, const MHWRender::MIndexBufferDescriptor &indexDesc) const
 Fill a buffer with geometry indexing data. More...
 
unsigned int vertexCount () const
 Returns the number of vertices that will be produced for the vertex requirement. More...
 
MStatus populateVertexBuffer (void *data, const unsigned int vertexCount, const MHWRender::MVertexBufferDescriptor &bufferDesc) const
 Fill a buffer with vertex data. More...
 
 MGeometryExtractor (const MHWRender::MGeometryRequirements &requirements, const MDagPath &path, const bool sharing=true, MStatus *status=NULL)
 

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(). More...
 

Constructor & Destructor Documentation

MGeometryExtractor ( const MHWRender::MGeometryRequirements requirements,
const MDagPath path,
MPolyGeomOptions  options,
MStatus status = NULL 
)

Construct a MGeometryExtractor.

Parameters
[in]requirementsThe list of requirements that will be requested from the geometry. This includes descriptions for the vertex and index streams that will be requested.
[in]pathA path to the object being translated.
[in]optionsA bit mask providing options to be applied to the extraction. See the MGeometeryExtractor::MPolyGeomOptions enum for the available options.
[out]statusA 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.
MGeometryExtractor ( const MHWRender::MGeometryRequirements requirements,
const MDagPath path,
const bool  sharing = true,
MStatus status = NULL 
)
Deprecated:
Use MGeometryExtractor(const MGeometryRequirements&, const MDagPath&, const bool, const bool, MStatus*)
Parameters
[in]requirements
[in]path
[in]sharing
[out]statusStatus code.

Member Function Documentation

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.

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

Parameters
[in]indexDescThe 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

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]dataThe buffer you want filled.
[in]primitiveCountThe number of primitives you expect to be filled in the buffer.
[in]indexDescThe description of the buffer you are requesting.
Returns
Status code
Status Codes:
unsigned int vertexCount ( ) const

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

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()).

values for normals, tangents and bitangents are all normalized.

Parameters
[in]dataThe buffer you want filled.
[in]vertexCountThe vertex count you expect to be filled in the buffer.
[in]bufferDescThe description of the buffer you are requesting.
Returns
Status code
Status Codes:
unsigned int minimumBufferSize ( unsigned int  primitiveCount,
MGeometry::Primitive  primitive,
unsigned int  primitiveStride = 0 
)
static

Get the minimum buffer size required by populateIndexBuffer().

Parameters
[in]primitiveCountThe number of primitives.
[in]primitiveThe primitive type
[in]primitiveStrideThe number of control points in a patch when the type is kPatch.
Returns
The minimum buffer size required by populateIndexBuffer().

The documentation for this class was generated from the following files:
  • MGeometryExtractor.h
  • MGeometryExtractor.cpp