MDepthStencilState Class Reference


Detailed Description

Container class for an acquired complete GPU depth stencil state.

MDepthStencilState wraps an acquired composite GPU depth stencil state. This depth stencil state can be used to set the current GPU depth stencil state using MStateManager::setDepthStencilState(myDepthState).

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

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

The information included in the depth stencil state includes depth buffer enable, depth buffer write enable, stencil enable, and separate stencil operations for front faces and back faces.

The advantages of using this class rather than setting depth stencil 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   StencilOperation {
  kKeepStencil = 1, kZeroStencil = 2, kReplaceStencil = 3, kIncrementStencilSat = 4,
  kDecrementStencilSat = 5, kInvertStencil = 6, kIncrementStencil = 7, kDecrementStencil = 8
}
 

Describes the choices for stencil buffer operations.

More...

Public Member Functions

  ~MDepthStencilState ()
  Destructor.
const MDepthStencilStateDesc desc (MStatus *ReturnStatus=NULL) const
  Get the depth stencil 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

Describes the choices for stencil buffer operations.

Enumerator:
kKeepStencil 

Do not update the entry in the stencil buffer.

This is the default value

kZeroStencil 

Set the stencil-buffer entry to 0.

kReplaceStencil 

Replace the stencil-buffer entry with a reference value.

kIncrementStencilSat 

Increment the stencil buffer entry, clamping to the maximum value.

kDecrementStencilSat 

Decrement the stencil buffer entry, clamping to zero.

kInvertStencil 

Invert the bits in the stencil-buffer entry.

kIncrementStencil 

Increment the stencil buffer entry, wrapping to zero if the new value exceeds the maximum value.

kDecrementStencil 

Decrement the stencil buffer entry, wrapping to the maximum value if the new value is less than zero.


Member Function Documentation

const MDepthStencilStateDesc & desc ( MStatus ReturnStatus = NULL ) const

Get the depth stencil state descriptor that was used to create the state object.

Parameters:
[out] ReturnStatus return status
Returns:
A reference to the depth stencil state descriptor
Status Codes:
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.

MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState
MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState MDepthStencilState