#include <MRenderCallback.h>
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.
Public Member Functions | |
MRenderCallback () | |
Default Constructor. | |
virtual | ~MRenderCallback () |
Default Destructor. | |
virtual bool | shadowCastCallback (const MRenderShadowData &data) |
Method to override for plugging into shadow map creation. More... | |
virtual bool | renderCallback (const MRenderData &data) |
Method to override for plugging into image rendering. More... | |
virtual bool | postProcessCallback (const MRenderData &data) |
Method to override for plugging into the post-process. More... | |
Static Public Member Functions | |
static void | addCallback (MRenderCallback *, int priority=0) |
Static procedure to add a rendering callback. More... | |
static void | removeCallback (MRenderCallback *) |
Static procedure to remove a rendering callback. More... | |
static MCallbackId | addRenderTileCallback (MMessage::MRenderTileFunction func, MStatus *ReturnStatus) |
Static procedure to add a callback to receive tiles as they get rendered and before they get displayed in the Render View Window. More... | |
static const char * | className () |
Returns the name of this class. More... | |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
static |
Static procedure to add a callback to receive tiles as they get rendered and before they get displayed in the Render View Window.
The user is provided with the co-ordinates of the origin of the tile, its dimensions, as well as a read only copy of the image being rendered.
NOTE: This callback can only serve one client at a time.
[in] | func | callback function, please check MMessage for more information. |
[out] | ReturnStatus | success status of callback registration. |
|
static |
Returns the name of this class.