Public Member Functions | Static Public Member Functions

MRenderCallback Class Reference

Search for all occurrences

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.

#include <MRenderCallback.h>

List of all members.

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.
virtual bool renderCallback (const MRenderData &data)
 Method to override for plugging into image rendering.
virtual bool postProcessCallback (const MRenderData &data)
 Method to override for plugging into the post-process.

Static Public Member Functions

static void addCallback (MRenderCallback *, int priority=0)
 Static procedure to add a rendering callback.
static void removeCallback (MRenderCallback *)
 Static procedure to remove a rendering callback.

Member Function Documentation

bool 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]datadata and functions related to the current shadow map
Returns:
True if the operation was successful and false otherwise.
Examples:
renderAccessNode.cpp.
bool 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]datadata and functions related to the current frame
Returns:
True if the operation was successful and false otherwise.
Examples:
renderAccessNode.cpp.
bool 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]datadata and functions related to the current frame
Returns:
True if the operation was successful and false otherwise.
Examples:
renderAccessNode.cpp.
void 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]callbackobject to add to the list of callbacks to invoke
[in]prioritypriority for this callback, lower priorities are invoked first
Examples:
renderAccessNode.cpp.
void 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]callbackobject to remove from the list of callbacks
Examples:
renderAccessNode.cpp.

MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback
MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback MRenderCallback