MRasterizerState Class Reference


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.

#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

  ~MRasterizerState ()
  Destructor.
const MRasterizerStateDesc desc (MStatus *ReturnStatus=NULL) const
  Get the rasterizer state descriptor that was used to create the state object.

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] ReturnStatus return status
Returns:
A reference to the rasterizer state descriptor
Status Codes:
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.

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