MRasterizerState Class Reference

This reference page is linked to from the following overview topics: 2.6 State and State Manager.



Detailed Description

Container class for an acquired complete GPU rasterizer state.

MRasterizerState wraps an acquired composite GPU rasterizer state. This rasterizer state can be used to set the current GPU rasterizer state using MStateManager::setRaserizerState(myRaserizerState).

Instances of MRasterizerState cannot be created or modified by users. You can read the descriptor for an MRasterizerState using MRasterizerState::desc(), but you cannot set or alter the descriptor directly.

MRasterizerState can only be obtained via MStateManager::acquireRaserizerState(). To use MStateManager::acquireRaserizerState(), create and fill an MRasterizerStateDesc instance with the requested state and pass it to MStateManager::acquireRaserizerState() which will return the cached unique rasterizer state of that description. If the unique rasterizer state did not previously exist in the cache, it is created.

The information included in the rasterizer state includes fill mode, culling mode, anti-aliasing enables, depth bias information, depth clipping enable, scissor clip enable, and whether CW or CCW winding is "front".

The advantages of using this class rather than setting rasterizer states explicitly are:

1. Since the states are cached internally, state setting is much faster than setting individual states. 2. Since state is set through the Maya viewport API, Maya can maintain accurate knowledge of the current GPU state, even in the presence of arbitrary plug-ins. This also speeds state setup by reducing redundant state setting and OGL queries. 3. The information is device aware, meaning that it will return the correct results based on the current active device. For example it will return the appropriate values for DirectX versus an OpenGL device.

Examples:

cgfxShaderNode.h, and footPrintNode.cpp.

#include <MStateManager.h>

List of all members.

Public Types

enum  FillMode { kFillSolid = 3, kFillWireFrame = 2 }
 

Indicates how to fill various primitives.

More...
enum  CullMode { kCullNone = 1, kCullFront = 2, kCullBack = 3 }
 

Indicates how to cull primitive faces during drawing.

More...

Public Member Functions

const MRasterizerStateDescdesc (MStatus *ReturnStatus=NULL) const
 Get the rasterizer state descriptor that was used to create the state object.
void * resourceHandle () const
 This method allows access to the draw API dependent handle for a rasteriser state.

Static Public Member Functions

static const char * className ()
 Returns the name of this class.

Member Enumeration Documentation

enum FillMode

Indicates how to fill various primitives.

Enumerator:
kFillSolid 

Primitives are solid filled.

kFillWireFrame 

Primitives have only the wireframe edges drawn.

enum CullMode

Indicates how to cull primitive faces during drawing.

Enumerator:
kCullNone 

Disables frontface/backface culling.

kCullFront 

Culls front facing facets.

kCullBack 

Culls back facing facets.


Member Function Documentation

const MRasterizerStateDesc & desc ( MStatus ReturnStatus = NULL) const

Get the rasterizer state descriptor that was used to create the state object.

Parameters:
[out]ReturnStatusreturn status
Returns:
A reference to the rasterizer state descriptor
Status Codes:
Examples:
footPrintNode.cpp.
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.
void * resourceHandle ( ) const

This method allows access to the draw API dependent handle for a rasteriser state.

This handle is owned by the MRasterizerState and is provided to allow access to use as a read-only object.

Modifications should never be performed on this handle.

Any modifications may result in unpredictable stability as the MRasterizerState no longer has knowledge of it's contents.

For OpenGL, such a handle does not exist and a NULL pointer will be returned.

For DirectX 10 and higher, a pointer to a Direct3D state will be returned.

Returns:
A pointer (handle) to the state if successful, otherwise NULL.

MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState
MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState MRasterizerState