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.
#include <MStateManager.h>
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. |
enum FillMode |
Indicates how to fill various primitives.
enum CullMode |
Indicates how to cull primitive faces during drawing.
const MRasterizerStateDesc & desc | ( | MStatus * | ReturnStatus =
NULL |
) | const |
Get the rasterizer state descriptor that was used to create the state object.
[out] | ReturnStatus | return status |
const char * className | ( | ) | [static] |