- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions

# MFrameContext Class Reference
OpenMayaRender - API module for rendering

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.

Search for all occurrences

## 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:
[legend]

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 MRenderTarget * | getCurrentColorRenderTarget () const
| Get current color render target.
const MRenderTarget * | getCurrentDepthRenderTarget () 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

Search for all occurrences

Matrices that can be accessed.

Enumerator:

  kWorldMtx | Object to world matrix. Search for all occurrences
  kWorldTransposeMtx | Object to world matrix transpose. Search for all occurrences
  kWorldInverseMtx | Object to world matrix inverse. Search for all occurrences
  kWorldTranspInverseMtx | Object to world matrix transpose inverse (adjoint) Search for all occurrences
  kViewMtx | World to view matrix. Search for all occurrences
  kViewTransposeMtx | World to view matrix tranpose. Search for all occurrences
  kViewInverseMtx | World to view matrix inverse. Search for all occurrences
  kViewTranspInverseMtx | World to view matrix transpose inverse (adjoint) Search for all occurrences
  kProjectionMtx | Projection matrix. Search for all occurrences
  kProjectionTranposeMtx | Projection matrix tranpose. Search for all occurrences
  kProjectionInverseMtx | Projection matrix inverse. Search for all occurrences
  kProjectionTranspInverseMtx | Projection matrix tranpose inverse (adjoint) Search for all occurrences
  kViewProjMtx | View * projection matrix. Search for all occurrences
  kViewProjTranposeMtx | View * projection matrix tranpose. Search for all occurrences
  kViewProjInverseMtx | View * projection matrix inverse. Search for all occurrences
  kViewProjTranspInverseMtx | View * projection matrix tranpose inverse (adjoint) Search for all occurrences
  kWorldViewMtx | World * view matrix. Search for all occurrences
  kWorldViewTransposeMtx | World * view matrix transpose. Search for all occurrences
  kWorldViewInverseMtx | World * view matrix inverse. Search for all occurrences
  kWorldViewTranspInverseMtx | World * view matrix transpose inverse (adjoint) Search for all occurrences
  kWorldViewProjMtx | World * view * projection matrix. Search for all occurrences
  kWorldViewProjTransposeMtx | World * view * projection matrix transpose. Search for all occurrences
  kWorldViewProjInverseMtx | World * view * projection matrix inverse. Search for all occurrences
  kWorldViewProjTranspInverseMtx | World * view * projection matrix tranpose inverse (adjoint) Search for all occurrences

enum TupleType

Search for all occurrences

Vectors or positions that can be accessed.

Enumerator:

  kViewPosition | View position. Search for all occurrences
  kViewDirection | View direction. Search for all occurrences
  kViewUp | View up vector. Search for all occurrences
  kViewRight | View right vector. Search for all occurrences
  kViewportPixelSize | Viewport size in pixels. Search for all occurrences

enum DisplayStyle

Search for all occurrences

Display styles.

Enumerator:

  kGouraudShaded | Shaded display. Search for all occurrences
  kWireFrame | Wire frame display. Search for all occurrences
  kBoundingBox | Bounding box display. Search for all occurrences
  kTextured | Textured display. Search for all occurrences
  kDefaultMaterial | Default material display. Search for all occurrences
  kXrayJoint | X-ray joint display. Search for all occurrences
  kXray | X-ray display. Search for all occurrences
  kTwoSidedLighting | Two-sided lighting enabled. Search for all occurrences

enum LightingMode

Search for all occurrences

Lighting modes.

Enumerator:

  kAmbientLight | Use global ambient light. Search for all occurrences
  kLightDefault | Use default light. Search for all occurrences
  kSelectedLights | Use lights which are selected. Search for all occurrences
  kSceneLights | Use all lights in the scene. Search for all occurrences

enum PostEffectType

Search for all occurrences

Types of post effects which may be enabled during rendering.

Enumerator:

  kAmbientOcclusion | Screen-space ambient occlusion. Search for all occurrences
  kMotionBlur | 2D Motion blur Search for all occurrences
  kGammaCorrection | Gamma correction. Search for all occurrences
  kDepthOfField | Depth of field. Search for all occurrences
  kAntiAliasing | Hardware multi-sampling. Search for all occurrences

enum TransparencyAlgorithm

Search for all occurrences

Options for transparency algorithm.

Enumerator:

  kUnsorted | Unsorted transparent object drawing. Search for all occurrences
  kObjectSorting | Object sorting of transparent objects. Search for all occurrences
  kWeightedAverage | Weight average transparency. Search for all occurrences
  kDepthPeeling | Depth-peel transparency. Search for all occurrences

## Member Function Documentation

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

Search for all occurrences

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] | value | Semantic name
  [out] | ReturnStatus | return status

Returns:
  Matrix type enumeration

Status Codes:
  - MS::kSuccess A valid enumeration could be returned
  - MS::kFailure The semantic is invalid so no valid enumeration could be returned. In this case MFrameContext::kWorldMtx is the return value.

MMatrix getMatrix | ( | MFrameContext::MatrixType | mtype,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const`[virtual]`

Search for all occurrences

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] | mtype | Type of matrix to return
  [out] | ReturnStatus | Return status

Returns:
  The requested matrix

Status Codes:
  - MS::kSuccess Method succeeded
  - MS::kNotImplemented Matrix type not available from MFrameContext
  - MS::kUnknownParameter Unknown matrix type

Reimplemented in MDrawContext.

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

Search for all occurrences

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] | value | Semantic name
  [out] | ReturnStatus | Return status

Returns:
  Tuple type enumeration

Status Codes:
  - MS::kSuccess A valid enumeration could be returned
  - MS::kFailure The semantic is invalid so no valid enumeration could be returned. In this case MFrameContext::kViewPosition is the return value.

MDoubleArray getTuple | ( | MFrameContext::TupleType | ttype,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | const`[virtual]`

Search for all occurrences

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

Parameters:

  [in] | ttype | Type of vector or position to return
  [out] | ReturnStatus | Return status

Returns:
  The requested tuple

Status Codes:
  - MS::kSuccess Method succeeded
  - MS::kUnknownParameter Unknown tuple type

Reimplemented in MDrawContext.

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

Search for all occurrences

Get the viewport dimensions.

The origin is the upper left corner of the viewport.

Parameters:

  [out] | originX | X coordinate of the viewport origin
  [out] | originY | Y coordinate of the viewport origin
  [out] | width | Width of the viewport
  [out] | height | Height of the viewport

Returns:
  Status code

Status Codes:
  - MS::kSuccess method succeeded
  - MS::kFailure method does not have a valid object

Reimplemented in MDrawContext.

float getGlobalLineWidth | ( |  | ) | const`[virtual]`

Search for all occurrences

Get global line width.

Returns:
  The current global line width

const MRenderTarget * getCurrentColorRenderTarget | ( |  | ) | const

Search for all occurrences

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

Search for all occurrences

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

Search for all occurrences

Get the current display style as a bit field.

Returns:
  Current display style

Examples:
  footPrintNode.cpp.

MFrameContext::LightingMode getLightingMode | ( |  | ) | const

Search for all occurrences

Get the current light mode.

Returns:
  Lighting mode

unsigned int getLightLimit | ( |  | ) | const

Search for all occurrences

Get the current light limit.

Returns:
  Light limit

bool getPostEffectEnabled | ( | PostEffectType | postEffectType | ) | const

Search for all occurrences

Returns if a given post effect is currently enabled.

Parameters:

  [in] | postEffectType | Type of post effect to query

Returns:
  true if effect is enabled

MFrameContext::TransparencyAlgorithm getTransparencyAlgorithm | ( |  | ) | const

Search for all occurrences

Get the current transparency algoritm.

See the TransparencyAlgorithm enum for possible return values.

Returns:
  Transparency algorithm

const char * className | ( |  | ) | `[static]`

Search for all occurrences

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