The somaterialbinding class is a node for setting up how materials are mapped to shapes. the material binding specified in nodes of this type decides how the material values of somaterial nodes are mapped on the builtin geometry shape nodes.
#include <Inventor/nodes/SoMaterialBinding.h>
Inherits SoNode.
enum Binding { OVERALL = SoMaterialBindingElement::OVERALL, PER_PART = SoMaterialBindingElement::PER_PART, PER_PART_INDEXED = SoMaterialBindingElement::PER_PART_INDEXED, PER_FACE = SoMaterialBindingElement::PER_FACE, PER_FACE_INDEXED = SoMaterialBindingElement::PER_FACE_INDEXED, PER_VERTEX = SoMaterialBindingElement::PER_VERTEX, PER_VERTEX_INDEXED = SoMaterialBindingElement::PER_VERTEX_INDEXED, DEFAULT = OVERALL, NONE = OVERALL }
virtual SoType getTypeId (void) const
Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting. SoMaterialBinding (void)
virtual void doAction (SoAction *action)
virtual void GLRender (SoGLRenderAction *action)
virtual void callback (SoCallbackAction *action)
virtual void pick (SoPickAction *action)
virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)
static SoType getClassTypeId (void)
static void initClass (void)
SoSFEnum value
virtual const SoFieldData * getFieldData (void) const
virtual ~SoMaterialBinding ()
static const SoFieldData ** getFieldDataPtr (void)
The SoMaterialBinding class is a node for setting up how materials are mapped to shapes.
The material binding specified in nodes of this type decides how the material values of SoMaterial 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.
Here is a very simple usage example:
#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 ] } }
With SoMaterialBinding::value set to PER_VERTEX_INDEXED above, the material indices will be taken from the SoIndexedFaceSet::materialIndex field when rendering.
If SoMaterialBinding::value was set to PER_VERTEX_INDEXED as above, and the SoIndexedFaceSet::materialIndex was undefined or empty, indices would implicitly be taken from the SoIndexedFaceSet::coordIndex field.
If SoMaterialBinding::value is set to PER_VERTEX, colors will be fetched in a monotonically increasing manner from the SoMaterial::diffuseColor field, starting at index 0.
FILE FORMAT/DEFAULTS:
MaterialBinding { value OVERALL }
See also:
SoMaterial
Enumeration of available types of material binding.
Enumerator
OVERALL
Apply the same material to the complete shape.
PER_PART
Get a new material from the pool of material values for each part of the shape, where the definition of a part depends on the shape type.
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.
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.
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 old, invalid behavior in Chapter 5, section 'Binding Nodes' (middle of page 128 in the 10th printing).
PER_PART_INDEXED
Get a new material from the pool of material values for each part of the shape, where the definition of a part depends on the shape type.
Materials are fetched by the index value settings of the shape.
PER_FACE
Get a new material from the pool of material values for each polygon face of the shape.
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.
Note that individual faces after tessellation of complex shapes (like SoCylinder nodes) are not considered to be separate entities, and so this binding will be treated in the same manner as SoMaterialBinding::PER_PART for those.
PER_FACE_INDEXED
Get a new material from the pool of material values for each polygon face of the shape.
Materials are fetched by the index value settings of the shape.
Note that individual faces after tessellation of complex shapes (like SoCylinder nodes) are not considered to be separate entities, and so this binding will be treated in the same manner as SoMaterialBinding::PER_PART_INDEXED for those.
PER_VERTEX
Get a new material from the pool of material values for each polygon, line or point vertex of the shape.
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.
PER_VERTEX_INDEXED
Get a new material from the pool of material values for each polygon, line or point vertex of the shape.
Materials are fetched by the index value settings of the shape.
DEFAULT
Obsolete. Don't use this value.
NONE
Obsolete. Don't use this value.
Constructor.
Destructor.
Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting. Usage example:
void foo(SoNode * node) { if (node->getTypeId() == SoFile::getClassTypeId()) { SoFile * filenode = (SoFile *)node; // safe downward cast, knows the type } }
For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all 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 Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.
For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.
Implements SoBase.
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.
Reimplemented from SoFieldContainer.
This function performs the typical operation of a node for any action.
Reimplemented from SoNode.
Action method for the SoGLRenderAction.
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.
Reimplemented from SoNode.
Action method for SoCallbackAction.
Simply updates the state according to how the node behaves for the render action, so the application programmer can use the SoCallbackAction for extracting information about the scene graph.
Reimplemented from SoNode.
Action method for SoPickAction.
Does common processing for SoPickAction action instances.
Reimplemented from SoNode.
Action method for the SoGetPrimitiveCountAction.
Calculates the number of triangle, line segment and point primitives for the node and adds these to the counters of the action.
Nodes influencing how geometry nodes calculates their primitive count also overrides this method to change the relevant state variables.
Reimplemented from SoNode.
The material binding to use for subsequent shape nodes in the scene graph. The default binding is SoMaterialBinding::OVERALL.
Generated automatically by Doxygen for Coin from the source code.