MFrameContext Class Reference

This reference page is linked to from the following overview topics: Autodesk Maya 2014, 3.7 Sub-scene Overrides, 3.9 UI draw manager, 4.4 Effects interfaces.



Detailed Description

This class contains some global information for the current render frame.

MFrameContext is designed to provide information which is available per frame render. This includes information such as render targets, viewport size and camera information.

In terms of relative scope, MFrameContext can be thought of as encompassing the time period for a "pass" (MPassContext) and the time period for actual drawing (MDrawContext).

MDrawContext is derived from MFrameContext and provides its own implementation for all virtual methods. The values returned from these methods may differ slightly between MFrameContext and MDrawContext as MFrameContext retrieves the values from Maya and MDrawContext retrieves the values from the GPU device state. Also, MFrameContext::getMatrix() is not able to return values for any matrix type requiring the object-to-world matrix as that information is only available at draw time.

Examples:

footPrintManip.cpp, footPrintNode.cpp, lineManip.cpp, lineManip.h, marqueeTool.cpp, squareScaleManip.cpp, squareScaleManip.h, and swissArmyManip.cpp.

#include <MFrameContext.h>

Inheritance diagram for MFrameContext:

List of all members.

Public Types

enum  MatrixType {
  kWorldMtx, kWorldTransposeMtx, kWorldInverseMtx, kWorldTranspInverseMtx,
  kViewMtx, kViewTransposeMtx, kViewInverseMtx, kViewTranspInverseMtx,
  kProjectionMtx, kProjectionTranposeMtx, kProjectionInverseMtx, kProjectionTranspInverseMtx,
  kViewProjMtx, kViewProjTranposeMtx, kViewProjInverseMtx, kViewProjTranspInverseMtx,
  kWorldViewMtx, kWorldViewTransposeMtx, kWorldViewInverseMtx, kWorldViewTranspInverseMtx,
  kWorldViewProjMtx, kWorldViewProjTransposeMtx, kWorldViewProjInverseMtx, kWorldViewProjTranspInverseMtx
}
 

Matrices that can be accessed.

More...
enum  TupleType {
  kViewPosition, kViewDirection, kViewUp, kViewRight,
  kViewportPixelSize
}
 

Vectors or positions that can be accessed.

More...
enum  DisplayStyle {
  kGouraudShaded = (0x1), kWireFrame = (0x1 << 1), kBoundingBox = (0x1 << 2), kTextured = (0x1 << 3),
  kDefaultMaterial = (0x1 << 4), kXrayJoint = (0x1 << 5), kXray = (0x1 << 6), kTwoSidedLighting = (0x1 << 7)
}
 

Display styles.

More...
enum  LightingMode { kAmbientLight, kLightDefault, kSelectedLights, kSceneLights }
 

Lighting modes.

More...
enum  PostEffectType {
  kAmbientOcclusion, kMotionBlur, kGammaCorrection, kDepthOfField,
  kAntiAliasing
}
 

Types of post effects which may be enabled during rendering.

More...
enum  TransparencyAlgorithm { kUnsorted = 0, kObjectSorting, kWeightedAverage, kDepthPeeling }
 

Options for transparency algorithm.

More...

Public Member Functions

virtual MMatrix getMatrix (MFrameContext::MatrixType mtype, MStatus *ReturnStatus=NULL) const
 Get a matrix value of a certain type.
virtual MDoubleArray getTuple (MFrameContext::TupleType ttype, MStatus *ReturnStatus=NULL) const
 Get a tuple (vector or position) value of a certain type.
virtual MStatus getViewportDimensions (int &originX, int &originY, int &width, int &height) const
 Get the viewport dimensions.
virtual float getGlobalLineWidth () const
 Get global line width.
const MRenderTargetgetCurrentColorRenderTarget () const
 Get current color render target.
const MRenderTargetgetCurrentDepthRenderTarget () const
 Get current depth render target.
unsigned int getDisplayStyle () const
 Get the current display style as a bit field.
LightingMode getLightingMode () const
 Get the current light mode.
unsigned int getLightLimit () const
 Get the current light limit.
bool getPostEffectEnabled (PostEffectType postEffectType) const
 Returns if a given post effect is currently enabled.
TransparencyAlgorithm getTransparencyAlgorithm () const
 Get the current transparency algoritm.

Static Public Member Functions

static MFrameContext::MatrixType semanticToMatrixType (const MString &value, MStatus *ReturnStatus=NULL)
 Given a semantic name return the corresponding matrix enumeration that can be used to retrieve a matrix value via the getMatrix() method.
static MFrameContext::TupleType semanticToTupleType (const MString &value, MStatus *ReturnStatus=NULL)
 Given a semantic name return the corresponding tuple enumeration that can be used to retrieve a value via the getTuple() method.
static const char * className ()
 Returns the name of this class.

Member Enumeration Documentation

enum MatrixType

Matrices that can be accessed.

Enumerator:
kWorldMtx 

Object to world matrix.

kWorldTransposeMtx 

Object to world matrix transpose.

kWorldInverseMtx 

Object to world matrix inverse.

kWorldTranspInverseMtx 

Object to world matrix transpose inverse (adjoint)

kViewMtx 

World to view matrix.

kViewTransposeMtx 

World to view matrix tranpose.

kViewInverseMtx 

World to view matrix inverse.

kViewTranspInverseMtx 

World to view matrix transpose inverse (adjoint)

kProjectionMtx 

Projection matrix.

kProjectionTranposeMtx 

Projection matrix tranpose.

kProjectionInverseMtx 

Projection matrix inverse.

kProjectionTranspInverseMtx 

Projection matrix tranpose inverse (adjoint)

kViewProjMtx 

View * projection matrix.

kViewProjTranposeMtx 

View * projection matrix tranpose.

kViewProjInverseMtx 

View * projection matrix inverse.

kViewProjTranspInverseMtx 

View * projection matrix tranpose inverse (adjoint)

kWorldViewMtx 

World * view matrix.

kWorldViewTransposeMtx 

World * view matrix transpose.

kWorldViewInverseMtx 

World * view matrix inverse.

kWorldViewTranspInverseMtx 

World * view matrix transpose inverse (adjoint)

kWorldViewProjMtx 

World * view * projection matrix.

kWorldViewProjTransposeMtx 

World * view * projection matrix transpose.

kWorldViewProjInverseMtx 

World * view * projection matrix inverse.

kWorldViewProjTranspInverseMtx 

World * view * projection matrix tranpose inverse (adjoint)

enum TupleType

Vectors or positions that can be accessed.

Enumerator:
kViewPosition 

View position.

kViewDirection 

View direction.

kViewUp 

View up vector.

kViewRight 

View right vector.

kViewportPixelSize 

Viewport size in pixels.

Display styles.

Enumerator:
kGouraudShaded 

Shaded display.

kWireFrame 

Wire frame display.

kBoundingBox 

Bounding box display.

kTextured 

Textured display.

kDefaultMaterial 

Default material display.

kXrayJoint 

X-ray joint display.

kXray 

X-ray display.

kTwoSidedLighting 

Two-sided lighting enabled.

Lighting modes.

Enumerator:
kAmbientLight 

Use global ambient light.

kLightDefault 

Use default light.

kSelectedLights 

Use lights which are selected.

kSceneLights 

Use all lights in the scene.

Types of post effects which may be enabled during rendering.

Enumerator:
kAmbientOcclusion 

Screen-space ambient occlusion.

kMotionBlur 

2D Motion blur

kGammaCorrection 

Gamma correction.

kDepthOfField 

Depth of field.

kAntiAliasing 

Hardware multi-sampling.

Options for transparency algorithm.

Enumerator:
kUnsorted 

Unsorted transparent object drawing.

kObjectSorting 

Object sorting of transparent objects.

kWeightedAverage 

Weight average transparency.

kDepthPeeling 

Depth-peel transparency.


Member Function Documentation

MFrameContext::MatrixType semanticToMatrixType ( const MString value,
MStatus ReturnStatus = NULL 
) [static]

Given a semantic name return the corresponding matrix enumeration that can be used to retrieve a matrix value via the getMatrix() method.

Valid semantic names include:

  • world
  • worldtranspose
  • worldinverse
  • worldinversetranspose
  • worldview
  • worldviewtranspose
  • worldviewinverse
  • worldviewinversetranspose
  • worldviewprojection
  • worldviewprojectiontranspose
  • worldviewprojectioninverse
  • worldviewprojectioninversetranspose
  • view
  • viewtranspose
  • viewinverse
  • viewinversetranspose
  • projection
  • projectiontranspose
  • projectioninverse
  • projectioninversetranspose
  • viewprojection
  • viewprojectiontranspose
  • viewprojectioninverse
  • viewprojectioninversetranspose
Parameters:
[in]valueSemantic name
[out]ReturnStatusreturn status
Returns:
Matrix type enumeration
Status Codes:
MMatrix getMatrix ( MFrameContext::MatrixType  mtype,
MStatus ReturnStatus = NULL 
) const [virtual]

Get a matrix value of a certain type.

Note that not all types are available for querying in MFrameContext. Matrix types requiring the object-to-world matrix, are only available from MDrawContext.

Parameters:
[in]mtypeType of matrix to return
[out]ReturnStatusReturn status
Returns:
The requested matrix
Status Codes:

Reimplemented in MDrawContext.

MFrameContext::TupleType semanticToTupleType ( const MString value,
MStatus ReturnStatus = NULL 
) [static]

Given a semantic name return the corresponding tuple enumeration that can be used to retrieve a value via the getTuple() method.

Valid semantic names include:

  • viewdirection
  • worldcameraposition
  • viewportpixelsize
Parameters:
[in]valueSemantic name
[out]ReturnStatusReturn status
Returns:
Tuple type enumeration
Status Codes:
MDoubleArray getTuple ( MFrameContext::TupleType  ttype,
MStatus ReturnStatus = NULL 
) const [virtual]

Get a tuple (vector or position) value of a certain type.

Parameters:
[in]ttypeType of vector or position to return
[out]ReturnStatusReturn status
Returns:
The requested tuple
Status Codes:

Reimplemented in MDrawContext.

MStatus getViewportDimensions ( int &  originX,
int &  originY,
int &  width,
int &  height 
) const [virtual]

Get the viewport dimensions.

The origin is the upper left corner of the viewport.

Parameters:
[out]originXX coordinate of the viewport origin
[out]originYY coordinate of the viewport origin
[out]widthWidth of the viewport
[out]heightHeight of the viewport
Returns:
Status code
Status Codes:

Reimplemented in MDrawContext.

float getGlobalLineWidth ( ) const [virtual]

Get global line width.

Returns:
The current global line width
const MRenderTarget * getCurrentColorRenderTarget ( ) const

Get current color render target.

Calling code is responsible for invoking MRenderTargetManager::releaseRenderTarget() to release the reference to the target after use.

Returns:
The current color target
const MRenderTarget * getCurrentDepthRenderTarget ( ) const

Get current depth render target.

Calling code is responsible for invoking MRenderTargetManager::releaseRenderTarget() to release the reference to the target after use.

Returns:
The current depth target
unsigned int getDisplayStyle ( ) const

Get the current display style as a bit field.

Returns:
Current display style
Examples:
footPrintNode.cpp.
MFrameContext::LightingMode getLightingMode ( ) const

Get the current light mode.

Returns:
Lighting mode
unsigned int getLightLimit ( ) const

Get the current light limit.

Returns:
Light limit
bool getPostEffectEnabled ( PostEffectType  postEffectType) const

Returns if a given post effect is currently enabled.

Parameters:
[in]postEffectTypeType of post effect to query
Returns:
true if effect is enabled
MFrameContext::TransparencyAlgorithm getTransparencyAlgorithm ( ) const

Get the current transparency algoritm.

See the TransparencyAlgorithm enum for possible return values.

Returns:
Transparency algorithm
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.

Reimplemented in MDrawContext.


MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext
MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext MFrameContext