A data class for creating material plugins.
- See also
- ShaderData
Use RegisterMaterialPlugin() to register a material plugin.
General notes
Here are some general comments on the material API:
- Coordinate Systems: if there is no further note, all elements like points, normals etc. are always given in global coordinates.
- Angle Systems: all angle values are always given in radians. Use maxon::RadToDeg macro for conversion if needed.
- Vectors: all normals and ray vectors must be normalized. Also, all normals and ray vectors received from Cinema 4D are normalized.
- Functions: no OS calls are allowed for CalcSurface, CalcVolumetric, Displace, ChangeNormal, CalcTransparency, and CalcAlpha. (These can be called within MP thread contexts.)
- Radiosity: Cinema 4D automatically handles radiosity for shaders, but a description interface for the radiosity IDs must be provided manually. Please refer to the SimpleShader SDK example. Note that this means that IDs in the 1000 range are reserved, so start the material IDs above 2000.
Optimization
CalcSurface, CalcVolumetric, ChangeNormal, CalcTransparency and CalcAlpha are the speed critical routines; concentrate efforts optimizing them.
Do not allocate new classes in those routines; only if absolutely necessary! Most of classes can be pre-allocated in InitRender::
Avoid ANY function calls there. For instance to access the global render settings store the pointer in InitRender for later use. This can save a tremendous amount of time.
|
virtual Bool | Draw (BaseMaterial *mat, BaseObject *op, BaseTag *tag, BaseDraw *bd, BaseDrawHelp *bh) |
|
virtual VOLUMEINFO | GetRenderInfo (BaseMaterial *mat) |
|
virtual INITRENDERRESULT | InitRender (BaseMaterial *mat, const InitRenderStruct &irs) |
|
virtual void | FreeRender (BaseMaterial *mat) |
|
virtual void | InitCalculation (BaseMaterial *mat, VolumeData *vd, INITCALCULATION type) |
|
virtual void | Displace (BaseMaterial *mat, VolumeData *vd) |
|
virtual void | ChangeNormal (BaseMaterial *mat, VolumeData *vd) |
|
virtual void | CalcSurface (BaseMaterial *mat, VolumeData *vd) |
|
virtual void | CalcTransparency (BaseMaterial *mat, VolumeData *vd) |
|
virtual void | CalcAlpha (BaseMaterial *mat, VolumeData *vd) |
|
virtual void | CalcVolumetric (BaseMaterial *mat, VolumeData *vd) |
|
virtual Bool | InitGLImage (BaseMaterial *mat, BaseDocument *doc, BaseThread *th, BaseBitmap *bmp, Int32 doccolorspace, Bool linearworkflow) |
|
virtual UInt32 | GlMessageDummy (BaseMaterial *mat, Int32 type, void *data) |
|
virtual Bool | HasEditorTransparency (BaseMaterial *mat) |
|
| NodeData () |
|
GeListNode * | Get () const |
|
virtual Bool | Message (GeListNode *node, Int32 type, void *data) |
|
virtual void | GetBubbleHelp (GeListNode *node, maxon::String &str) |
|
virtual BaseDocument * | GetDocument (GeListNode *node) |
|
virtual Int32 | GetBranchInfo (GeListNode *node, BranchInfo *info, Int32 max, GETBRANCHINFO flags) |
|
virtual Bool | IsInstanceOf (const GeListNode *node, Int32 type) const |
|
virtual Bool | IsDocumentRelated (const GeListNode *node, Bool &docrelated) const |
|
virtual Bool | Init (GeListNode *node) |
|
virtual void | Free (GeListNode *node) |
|
virtual Bool | Read (GeListNode *node, HyperFile *hf, Int32 level) |
|
virtual Bool | Write (GeListNode *node, HyperFile *hf) |
|
virtual Bool | CopyTo (NodeData *dest, GeListNode *snode, GeListNode *dnode, COPYFLAGS flags, AliasTrans *trn) |
|
virtual Bool | GetDDescription (GeListNode *node, Description *description, DESCFLAGS_DESC &flags) |
|
virtual Bool | GetDParameter (GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) |
|
virtual Bool | SetDParameter (GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags) |
|
virtual Bool | GetDEnabling (GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc) |
|
virtual Bool | TranslateDescID (GeListNode *node, const DescID &id, DescID &res_id, C4DAtom *&res_at) |
|
| BaseData () |
|
virtual | ~BaseData () |
|
void | Destructor () |
|