|
#include <RifPlugin.h>
#include <RifFilter.h>
class Blobby2Volume : public RifPlugin {
public:
Blobby2Volume();
virtual ~Blobby2Volume() { }
virtual RifFilter &GetFilter() { return m_filter; }
private:
RifFilter m_filter;
static RtVoid blobbyV(RtInt nleaf, RtInt ncode, RtInt code[],
RtInt nfloats, RtFloat floats[], RtInt nstr, RtToken str[],
RtInt paramNum, RtToken paramNames[], RtPointer paramVals[]);
};
RifPlugin *RifPluginManufacture(int argc, char **argv) {
return new Blobby2Volume();
}
// Constructor
Blobby2Volume::Blobby2Volume() {
m_filter.BlobbyV = blobbyV; // install our custom callback
m_filter.Filtering = RifFilter::k_Continue;
}
RtVoid Blobby2Volume::blobbyV(RtInt nleaf, RtInt ncode, RtInt code[],
RtInt nfloats, RtFloat floats[], RtInt nstr, RtToken str[],
RtInt paramNum, RtToken paramNames[], RtPointer paramVals[]) {
RtInt newcode[ncode + 1];
// Begin a new array of opcode starting with "8" then add
// the original opcodes.
newcode[0] = 8;
for(int n = 0; n < ncode; n++)
newcode[n+1] = code[n];
if(paramNum == 0)
RiBlobby(nleaf, ncode + 1, newcode, nfloats, floats, nstr, str, RI_NULL);
else
RiBlobbyV(nleaf, ncode + 1, newcode, nfloats, floats, nstr, str, paramNum, paramNames, paramVals);
}
|