#include <RslPlugin.h>
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). |
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);
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.
|
Per-frame cleanup function (possibly NULL).
|
|
Pointer to entry function.
|
|
Per-frame initialization function (possibly NULL).
|
|
RSL function prototype.
|