Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

RixPattern.h defines the interface that all pattern plugins must implement. RixPattern is a subclass of RixShadingPlugin, and therefore shares the same initializationsynchronization, and parameter table logic as other shading plugins. Because a  RixPattern  is expected to be a lightweight object that may be created many times over the course of the render,  RixPattern  is expected to take advantage of the lightweight instancing services  provided by  RixShadingPlugin Therefore to start developing your own pattern, you can #include "RixPattern.h" and make sure your pattern class implements the required methods inherited from the RixShadingPlugin interface: Init(), Finalize()Synchronize(), GetParamTable(), and CreateInstanceData().

The RIX_PATTERNCREATE() macro defines the CreateRixPattern() method, which is called by the renderer to create an instance of the pattern plugin. Generally, the implementation of this method should simply return a new allocated copy of your pattern class. Similarly, the RIX_PATTERNDESTROY() method is  macro defines the DestroyRixPattern()  method called by the renderer to delete an instance of the pattern plugin; a typical implementation of this method is to delete the passed in pattern pointer:

...

    RIX_PATTERNDESTROY
{
delete ((MyPattern*)pattern);
}

...

Computing Pattern Output

ComputeOutputParams()   is the heart of a pattern plugin: it evaluates the input parameters, and computes the pattern output. It is called once per graph execution, and all outputs must be computed during this single invocation. The number and type of outputs should match the number and type of outputs declared in the parameter table. The domain of evaluation of this function is a shading context, which is of type RixShadingContext, defined in RixShading.h

...