MRenderCallback Class Reference
[OpenMayaRender - API module for rendering]

#include <MRenderCallback.h>

List of all members.


Detailed Description

Rendering Callbacks.

This class is used to register callbacks to gain access to Maya's rendering information during software rendering. You can modify Maya's shadow maps, RGB pixmap, and depth map to composite your own rendering effects into Maya's rendering.

To register callbacks, inherit from this class and override renderCallback(), shadowCastCallback(), or postProcessCallback(). Any number of these methods can be overridden by the callback. Then register the callbacks by calling the addCallback() method.

Each of the callback method gets passed a MRenderData which contains the information. MRenderData also provides utility methods for converting between world space and screen space. In the case of shadowCastCallback, MRenderShadowData is provided and it also has utility methods for converting between world space and shadow map space.

If there are callbacks registered, prior to shadow maps being written out, shadowCastCallback() will be invoked with light information and a pointer to the shadow map passed in. Then immediately after software rendering completes, renderCallback() will be invoked with the rendering's dimension info and image passed in. Lastly, during post-processing, postProcessCallback() will be invoked with the rendering's dimension and pointers to the rgb pixmap and depthmap passed in.

If multiple callbacks need to be registered, the order of invocation can be set by adding each callback with a priority number, 0 being the highest priority.

Examples:

renderAccessNode.cpp.


Public Member Functions

  MRenderCallback ()
virtual  ~MRenderCallback ()
virtual bool  shadowCastCallback (const MRenderShadowData &data)
virtual bool  renderCallback (const MRenderData &data)
virtual bool  postProcessCallback (const MRenderData &data)

Static Public Member Functions

static void  addCallback (MRenderCallback *, int priority=0)
static void  removeCallback (MRenderCallback *)

Constructor & Destructor Documentation

MRenderCallback::MRenderCallback (  ) 

Default Constructor

MRenderCallback::~MRenderCallback (  )  [virtual]

Default Destructor


Member Function Documentation

bool MRenderCallback::shadowCastCallback ( const MRenderShadowData data  )  [virtual]

Method to override for plugging into shadow map creation. The argument provides information about the light and shadow map currently being processed. If false is returned, the renderer will abort and no image will be generated.

Parameters:
[in]  data  data and functions related to the current shadow map
Returns:
True if the operation was successful and false otherwise.
Examples:

bool MRenderCallback::renderCallback ( const MRenderData data  )  [virtual]

Method to override for plugging into image rendering. This method will be invoked following the software render (but before the post process) of each frame. The data argument provides information about the image and camera projection; these are useful in transforming to and from world and image space. If false is returned, the renderer will abort and no image will be generated.

Parameters:
[in]  data  data and functions related to the current frame
Returns:
True if the operation was successful and false otherwise.
Examples:

bool MRenderCallback::postProcessCallback ( const MRenderData data  )  [virtual]

Method to override for plugging into the post-process. This method will be invoked following the post process rendering (shader glow, optical effects, 2D motion blur). The data argument provides information about the image and camera projection; these are useful in transforming to and from world and image space. If false is returned, the renderer will abort and no image will be generated.

Parameters:
[in]  data  data and functions related to the current frame
Returns:
True if the operation was successful and false otherwise.
Examples:

void MRenderCallback::addCallback ( MRenderCallback callback,
int  priority = 0  
) [static]

Static procedure to add a rendering callback. The callbacks are stored internally in a sorted list and are invoked following the shadow map generation, software render, or post process depending on which methods are overridden. Adding the same callback more than once will have no effect.

Parameters:
[in]  callback  object to add to the list of callbacks to invoke
[in]  priority  priority for this callback, lower priorities are invoked first
Examples:

void MRenderCallback::removeCallback ( MRenderCallback callback  )  [static]

Static procedure to remove a rendering callback. The callback will be removed from the list of callbacks, but its up to the client to actually delete the object. Unstability may result if a callback is deleted and not removed from the callback list.Removing an un-installed callback will have no effect.

Parameters:
[in]  callback  object to remove from the list of callbacks
Examples:

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6