RslFunction Struct Reference

Each plugin must define an RSL function table, which requires two steps. More...

#include <RslPlugin.h>

List of all members.

Public Attributes

const char * m_prototype
 RSL function prototype.
RslEntryFunc m_entry
 Pointer to entry function.
RslVoidFunc m_initFunc
 Per-frame initialization function (possibly NULL).
RslVoidFunc m_cleanupFunc
 Per-frame cleanup function (possibly NULL).


Detailed Description

Each plugin must define an RSL function table, which requires two steps.

First, a array of RslFunction structs is defined:

        static RslFunction myfunctions[] = {
            { "float sqr(float)", sqr_f, NULL, NULL },
            { "color sqr(color)", sqr_c, NULL, NULL },
            { "point mynoise(point)", mynoise, noiseinit, noisedelete },
            NULL
        };

Each RslFunction specifies the prototype(s) of a shadeop, along a pointer to its entry function. Overloaded shadeops have multiple entries with different prototypes (which might share the same entry point since colors, points, and vectors have the same representation). The last entry of the array should be NULL.

Each RslFunction can also have an optional associated init and cleanup function. The init function is called once per frame in a thread safe way for EACH function it is associated with. Likewise each cleanup function is called once at the end of frame for EACH associated function. The cleanup function will ONLY be called for a function with an associated init function.

Next, the RslFunctionTable is constructed. It must be called "RslPublicFunctions" and it should be exported. In addition to specifying the array of entry functions, an optional initialization and cleanup function may be provided.

        RSLEXPORT RslFunctionTable RslPublicFunctions(myfunctions, myinit, mycleanup);
The initialization function is executed the first time any function in the pluginis called in a given frame, and the cleanup function is called at the end of the frame.

Note that the plugin table must be declared with RSLEXPORT under Windows. This declaration has no effect on other platforms, so it's a good idea to always include it for portability.


Member Data Documentation

RslVoidFunc RslFunction::m_cleanupFunc
 

Per-frame cleanup function (possibly NULL).

RslEntryFunc RslFunction::m_entry
 

Pointer to entry function.

RslVoidFunc RslFunction::m_initFunc
 

Per-frame initialization function (possibly NULL).

const char* RslFunction::m_prototype
 

RSL function prototype.


The documentation for this struct was generated from the following file:
Generated on Wed May 10 15:56:09 2006 for PRManHeaders by  doxygen 1.4.6