Detailed Description

Main interface class to the Viewport 2.0 renderer.

Examples:

footPrintNode.cpp, and hwPhongShader.cpp.

#include <MViewport2Renderer.h>

List of all members.

Public Member Functions

MHWRender::DrawAPI drawAPI () const
 Returns the current drawing API.
bool drawAPIIsOpenGL () const
 Method will indicate whether the current drawing API is OpenGL or not.
unsigned int drawAPIVersion () const
 Method will return the version of drawing API.
void * GPUDeviceHandle () const
 Method will return a pointer to the GPU "device".
const MShaderManagergetShaderManager () const
 Access the shader manager.
const MRenderTargetManagergetRenderTargetManager () const
 Access the render target manager.
bool copyTargetToScreen (const MRenderTarget *renderTarget)
 Copy render target to screen.
MTextureManagergetTextureManager () const
 Access the texture manager.
MStatus registerOverride (const MRenderOverride *roverride)
 Register the override as being usable by the renderer.
MStatus deregisterOverride (const MRenderOverride *roverride)
 Deregister an existing render override on the renderer.
const MRenderOverridefindRenderOverride (const MString &name)
 Return a reference to an existing render override registered with the renderer.
const MString activeRenderOverride () const
 Get the name of the active override.
unsigned int renderOverrideCount ()
 Get the number of registered render overrides.
MStatus setRenderOverrideName (const MString &name)
 Set the name of a render override (MHWRender::MRenderOverride) for batch rendering.
MString renderOverrideName (MStatus *ReturnStatus=NULL) const
 Get the current render override name used for batch rendering.

Static Public Member Functions

static void setGeometryDrawDirty (MObject obj, bool topologyChanged=true)
 Notify the Viewport 2.0 renderer that something about obj has changed, causing the object to be updated in the viewport.

Member Function Documentation

MHWRender::DrawAPI drawAPI ( ) const

Returns the current drawing API.

Returns 'kNone' if the renderer is not initialized.

Returns:
The current drawing API
bool drawAPIIsOpenGL ( ) const

Method will indicate whether the current drawing API is OpenGL or not.

Returns:
True if the API is OpenGL.
Examples:
footPrintNode.cpp, and hwPhongShader.cpp.
unsigned int drawAPIVersion ( ) const

Method will return the version of drawing API.

Returns:
Draw API version, or 0 if the renderer is not initialized properly.
void * GPUDeviceHandle ( ) const

Method will return a pointer to the GPU "device".

In the case that the drawing API is OpenGL then the "device" is a handle to an OpenGL context. In the case that the drawing API is DirectX then the "device" is a pointer to a DirectX device.

It is imperative that when a programmer makes any modifications to the device or context that the pre-modified state always be restored after the changes are no longer required. If this is not done then Maya's internal state tracking system will become inconsistent. This can result in unpredictable rendering behaviour.

Returns:
A void pointer to the device or context. The pointer must be cast to the correct data type depending on the draw API. For example a cast to an HGLRC would be required to get an OpenGL context on Windows platforms.

If the renderer has not been initialized a NULL pointer will be returned.

Examples:
footPrintNode.cpp.
const MShaderManager * getShaderManager ( ) const

Access the shader manager.

The shader manager can be used to produce MShaderInstance objects which may be assigned to MRenderItem objects by implementations of MPxGeometryOverride.

Returns:
A pointer to the shader manager of NULL if the renderer is not initialized properly.
Examples:
hwPhongShader.cpp.
const MRenderTargetManager * getRenderTargetManager ( ) const

Access the render target manager.

The render target manager can be used to produce MRenderTarget objects which may be assigned to MRenderOperation objects as output target overrides.

Returns:
A pointer to the manager of NULL if the renderer is not initialized properly.
bool copyTargetToScreen ( const MRenderTarget renderTarget)

Copy render target to screen.

When target has not the same dimensions as the screen the copy will still perform, and the target will be stretched up or down to fill the entire screen space.

Parameters:
[in]renderTargetRender target to copy.
Returns:
True if copy was successful.
MTextureManager * getTextureManager ( ) const

Access the texture manager.

The texture manager can be used to acquire texture

Returns:
A pointer to the texture manager of NULL if the renderer is not initialized properly.
Examples:
hwPhongShader.cpp.
MStatus registerOverride ( const MRenderOverride roverride)

Register the override as being usable by the renderer.

If the override is already registered it will not be registered again.

Parameters:
[in]roverrideRendering override to be registered.
Returns:
Status code
Status Codes:
MStatus deregisterOverride ( const MRenderOverride roverride)

Deregister an existing render override on the renderer.

The renderer will remove this override from it's list of registered overrides.

Parameters:
[in]roverrideRendering override to be deregistered.
Returns:
Status code
Status Codes:
const MRenderOverride * findRenderOverride ( const MString name)

Return a reference to an existing render override registered with the renderer.

Parameters:
[in]nameName of override to find
Returns:
Status code
Status Codes:
const MString activeRenderOverride ( ) const

Get the name of the active override.

There can only be on active override at any given time and that override must exist be registered with the renderer.

Returns:
Name of active override. If none an empty string will be returned.
unsigned int renderOverrideCount ( )

Get the number of registered render overrides.

Returns:
Number of registered overrides
MStatus setRenderOverrideName ( const MString name)

Set the name of a render override (MHWRender::MRenderOverride) for batch rendering.

Parameters:
[in]nameName of the override.
Returns:
Status code
Status Codes:
MString renderOverrideName ( MStatus ReturnStatus = NULL) const

Get the current render override name used for batch rendering.

If there is no override then an empty string will be returned

Parameters:
[out]ReturnStatusreturn status.
Returns:
Override name.
Status Codes: Currently always returns MS::kSuccess.
void setGeometryDrawDirty ( MObject  obj,
bool  topologyChanged = true 
) [static]

Notify the Viewport 2.0 renderer that something about obj has changed, causing the object to be updated in the viewport.

Note that this method does NOT perform any DG evaluation when it is called. This method is an extention of the dirty propagation system. It adds obj to the list of objects which must be updated before the next frame is rendered. The actual evaluation does not occur until the next viewport refresh.

Parameters:
[in]objDAG object which has been modified.
[in]topologyChangedhas the object topology changed
Examples:
apiMeshShape.cpp.

MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer
MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer MRenderer