.TH "SoMaterialBinding" 3 "Thu May 29 2014" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoMaterialBinding \- .PP The \fBSoMaterialBinding\fP class is a node for setting up how materials are mapped to shapes\&. .PP The material binding specified in nodes of this type decides how the material values of \fBSoMaterial\fP nodes are mapped on the builtin geometry shape nodes\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBSoNode\fP\&. .SS "Public Types" .in +1c .ti -1c .RI "enum \fBBinding\fP { \fBOVERALL\fP = SoMaterialBindingElement::OVERALL, \fBPER_PART\fP = SoMaterialBindingElement::PER_PART, \fBPER_PART_INDEXED\fP = SoMaterialBindingElement::PER_PART_INDEXED, \fBPER_FACE\fP = SoMaterialBindingElement::PER_FACE, \fBPER_FACE_INDEXED\fP = SoMaterialBindingElement::PER_FACE_INDEXED, \fBPER_VERTEX\fP = SoMaterialBindingElement::PER_VERTEX, \fBPER_VERTEX_INDEXED\fP = SoMaterialBindingElement::PER_VERTEX_INDEXED, \fBDEFAULT\fP = OVERALL, \fBNONE\fP = OVERALL }" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "virtual \fBSoType\fP \fBgetTypeId\fP (void) const " .br .RI "\fIReturns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. \fP" .ti -1c .RI "\fBSoMaterialBinding\fP (void)" .br .ti -1c .RI "virtual void \fBdoAction\fP (\fBSoAction\fP *action)" .br .ti -1c .RI "virtual void \fBGLRender\fP (\fBSoGLRenderAction\fP *action)" .br .ti -1c .RI "virtual void \fBcallback\fP (\fBSoCallbackAction\fP *action)" .br .ti -1c .RI "virtual void \fBpick\fP (\fBSoPickAction\fP *action)" .br .ti -1c .RI "virtual void \fBgetPrimitiveCount\fP (\fBSoGetPrimitiveCountAction\fP *action)" .br .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static \fBSoType\fP \fBgetClassTypeId\fP (void)" .br .ti -1c .RI "static void \fBinitClass\fP (void)" .br .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "\fBSoSFEnum\fP \fBvalue\fP" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "virtual const \fBSoFieldData\fP * \fBgetFieldData\fP (void) const " .br .ti -1c .RI "virtual \fB~SoMaterialBinding\fP ()" .br .in -1c .SS "Static Protected Member Functions" .in +1c .ti -1c .RI "static const \fBSoFieldData\fP ** \fBgetFieldDataPtr\fP (void)" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP The \fBSoMaterialBinding\fP class is a node for setting up how materials are mapped to shapes\&. .PP The material binding specified in nodes of this type decides how the material values of \fBSoMaterial\fP nodes are mapped on the builtin geometry shape nodes\&. The exact meaning of a binding depends on what particular shape type a material or a set of materials are applied to\&. .PP Here is a very simple usage example: .PP .PP .nf #Inventor V2.1 ascii Separator { Coordinate3 { point [ 0 0 0, 1 0 0, 1 1 0 ] } Material { diffuseColor [ 1 0 0, 1 1 0, 0 0 1 ] } MaterialBinding { value PER_VERTEX_INDEXED } IndexedFaceSet { coordIndex [ 0, 1, 2, -1 ] materialIndex [ 0, 1, 0 ] } } .fi .PP .PP With \fBSoMaterialBinding::value\fP set to \fCPER_VERTEX_INDEXED\fP above, the material indices will be taken from the \fBSoIndexedFaceSet::materialIndex\fP field when rendering\&. .PP If \fBSoMaterialBinding::value\fP was set to \fCPER_VERTEX_INDEXED\fP as above, and the \fBSoIndexedFaceSet::materialIndex\fP was undefined or empty, indices would implicitly be taken from the \fBSoIndexedFaceSet::coordIndex\fP field\&. .PP If \fBSoMaterialBinding::value\fP is set to \fCPER_VERTEX\fP, colors will be fetched in a monotonically increasing manner from the \fBSoMaterial::diffuseColor\fP field, starting at index 0\&. .PP \fBFILE FORMAT/DEFAULTS:\fP .PP .nf MaterialBinding { value OVERALL } .fi .PP .PP \fBSee also:\fP .RS 4 \fBSoMaterial\fP .RE .PP .SH "Member Enumeration Documentation" .PP .SS "enum \fBSoMaterialBinding::Binding\fP" Enumeration of available types of material binding\&. .PP \fBEnumerator\fP .in +1c .TP \fB\fIOVERALL \fP\fP Apply the same material to the complete shape\&. .TP \fB\fIPER_PART \fP\fP Get a new material from the pool of material values for each \fIpart\fP of the shape, where the definition of a \fIpart\fP depends on the shape type\&. .PP Materials are fetched from index 0 and onwards, incrementing the index into the material pool by 1 for each new part in the order defined by the particular shape type\&. .PP Important portability note: it was previously allowed with the SGI Inventor library to supply too few colors versus the number of parts of the subsequent shapes in the scene graph\&. Coloring would then cycle through the available colors\&. .PP Since SGI Open Inventor v2\&.1, this was disallowed, though -- enough colors for all parts must be supplied, or behavior will be unspecified (likely to cause a crash, in fact)\&. Note that the «Inventor Mentor» book contains a description of the \fIold\fP, \fIinvalid\fP behavior in Chapter 5, section 'Binding Nodes' (middle of page 128 in the 10th printing)\&. .TP \fB\fIPER_PART_INDEXED \fP\fP Get a new material from the pool of material values for each \fIpart\fP of the shape, where the definition of a \fIpart\fP depends on the shape type\&. .PP Materials are fetched by the index value settings of the shape\&. .TP \fB\fIPER_FACE \fP\fP Get a new material from the pool of material values for each polygon \fIface\fP of the shape\&. .PP Materials are fetched from index 0 and onwards, incrementing the index into the material pool by 1 for each new face of the shape node\&. .PP Note that individual faces after tessellation of complex shapes (like \fBSoCylinder\fP nodes) are \fInot\fP considered to be separate entities, and so this binding will be treated in the same manner as \fBSoMaterialBinding::PER_PART\fP for those\&. .TP \fB\fIPER_FACE_INDEXED \fP\fP Get a new material from the pool of material values for each polygon \fIface\fP of the shape\&. .PP Materials are fetched by the index value settings of the shape\&. .PP Note that individual faces after tessellation of complex shapes (like \fBSoCylinder\fP nodes) are \fInot\fP considered to be separate entities, and so this binding will be treated in the same manner as \fBSoMaterialBinding::PER_PART_INDEXED\fP for those\&. .TP \fB\fIPER_VERTEX \fP\fP Get a new material from the pool of material values for each polygon, line or point \fIvertex\fP of the shape\&. .PP Materials are fetched from index 0 and onwards, incrementing the index into the material pool by 1 for each new vertex of the shape node\&. .TP \fB\fIPER_VERTEX_INDEXED \fP\fP Get a new material from the pool of material values for each polygon, line or point \fIvertex\fP of the shape\&. .PP Materials are fetched by the index value settings of the shape\&. .TP \fB\fIDEFAULT \fP\fP Obsolete\&. Don't use this value\&. .TP \fB\fINONE \fP\fP Obsolete\&. Don't use this value\&. .SH "Constructor & Destructor Documentation" .PP .SS "SoMaterialBinding::SoMaterialBinding (void)" Constructor\&. .SS "SoMaterialBinding::~SoMaterialBinding ()\fC [protected]\fP, \fC [virtual]\fP" Destructor\&. .SH "Member Function Documentation" .PP .SS "\fBSoType\fP SoMaterialBinding::getTypeId (void) const\fC [virtual]\fP" .PP Returns the type identification of an object derived from a class inheriting \fBSoBase\fP\&. This is used for run-time type checking and 'downward' casting\&. Usage example: .PP .PP .nf void foo(SoNode * node) { if (node->getTypeId() == SoFile::getClassTypeId()) { SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type } } .fi .PP .PP For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in \fIall\fP subclasses\&. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance \fBInventor/nodes/SoSubNode\&.h\fP (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine\&.h (for engine classes) and so on\&. .PP For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups\&. .PP Implements \fBSoBase\fP\&. .SS "const \fBSoFieldData\fP * SoMaterialBinding::getFieldData (void) const\fC [protected]\fP, \fC [virtual]\fP" Returns a pointer to the class-wide field data storage object for this instance\&. If no fields are present, returns \fCNULL\fP\&. .PP Reimplemented from \fBSoFieldContainer\fP\&. .SS "void SoMaterialBinding::doAction (\fBSoAction\fP *action)\fC [virtual]\fP" This function performs the typical operation of a node for any action\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoMaterialBinding::GLRender (\fBSoGLRenderAction\fP *action)\fC [virtual]\fP" Action method for the \fBSoGLRenderAction\fP\&. .PP This is called during rendering traversals\&. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoMaterialBinding::callback (\fBSoCallbackAction\fP *action)\fC [virtual]\fP" Action method for \fBSoCallbackAction\fP\&. .PP Simply updates the state according to how the node behaves for the render action, so the application programmer can use the \fBSoCallbackAction\fP for extracting information about the scene graph\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoMaterialBinding::pick (\fBSoPickAction\fP *action)\fC [virtual]\fP" Action method for \fBSoPickAction\fP\&. .PP Does common processing for \fBSoPickAction\fP \fIaction\fP instances\&. .PP Reimplemented from \fBSoNode\fP\&. .SS "void SoMaterialBinding::getPrimitiveCount (\fBSoGetPrimitiveCountAction\fP *action)\fC [virtual]\fP" Action method for the \fBSoGetPrimitiveCountAction\fP\&. .PP Calculates the number of triangle, line segment and point primitives for the node and adds these to the counters of the \fIaction\fP\&. .PP Nodes influencing how geometry nodes calculates their primitive count also overrides this method to change the relevant state variables\&. .PP Reimplemented from \fBSoNode\fP\&. .SH "Member Data Documentation" .PP .SS "\fBSoSFEnum\fP SoMaterialBinding::value" The material binding to use for subsequent shape nodes in the scene graph\&. The default binding is \fBSoMaterialBinding::OVERALL\fP\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.