#include <MRenderCallback.h>
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.
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 *) |
MRenderCallback::MRenderCallback | ( | ) |
Default Constructor
MRenderCallback::~MRenderCallback | ( | ) | [virtual] |
Default Destructor
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.
[in] | data | data and functions related to the current shadow map |
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.
[in] | data | data and functions related to the current frame |
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.
[in] | data | data and functions related to the current frame |
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.
[in] | callback | object to add to the list of callbacks to invoke |
[in] | priority | priority for this callback, lower priorities are invoked first |
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.
[in] | callback | object to remove from the list of callbacks |
Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |