Provided by: libcoin80-doc_3.1.4~abc9f50-4ubuntu2_all
NAME
Element Classes - Classes class SoGLClipPlaneElement The SoGLClipPlaneElement class is yet to be documented. FIXME: write doc. " class SoGLColorIndexElement The SoGLColorIndexElement class sets the current OpenGL color. This element is only used when the OpenGL canvas is in colorindex mode, ie where colors for individual pixels are fetched from a color lookup table ('CLUT'). The usual thing to do is to set up a canvas in RGBA truecolor mode. " class SoGLCoordinateElement The SoGLCoordinateElement class is yet to be documented. FIXME: write doc. " class SoGLDepthBufferElement The SoGLDepthBufferElement controls the OpenGL depth buffer. class SoGLDisplayList The SoGLDisplayList class stores and manages OpenGL display lists. The TEXTURE_OBJECT type is not directly supported in Coin. We handle textures differently in a more flexible class called SoGLImage, which also stores some information about the texture used when rendering. Old code which use this element should not stop working though. The texture object extension will just not be used, and the texture will be stored in a display list instead. " class SoGLDrawStyleElement The SoGLDrawStyleElement updates the current draw style in OpenGL. class SoGLEnvironmentElement The SoGLEnvironmentElement class is for setting GL fog etc. class SoGLLazyElement The SoGLLazyElement class is meant to optimize GL rendering. This is just a wrap-around implementation for compatibility. It should (hopefully) work in the same way as the Inventor class though. " class SoGLLightIdElement The SoGLLightIdElement class is yet to be documented. FIXME: write doc. " class SoGLLinePatternElement The SoGLLinePatternElement class is yet to be documented. FIXME: write doc. " class SoGLLineWidthElement The SoGLLineWidthElement class changes the linewidth setting of the OpenGL render state. Requests from the scenegraph to change the linewidth when rendering OpenGL line primitives will be made through this element, which forwards it to the appropriate native OpenGL call. " class SoGLModelMatrixElement The SoGLModelMatrixElement class is yet to be documented. FIXME: write doc. " class SoGLMultiTextureCoordinateElement The SoGLMultiTextureCoordinateElement class stores the current gltexture coordinates for several units. class SoGLMultiTextureImageElement The SoGLMultiTextureImageElement is used to control the current GL texture for texture units. class SoGLMultiTextureMatrixElement The SoGLMultiTextureMatrixElement class is used to update the OpenGL texture matrix. Since (for some weird reason) most OpenGL implementations have a very small texture matrix stack, and since the matrix stack also is broken on many OpenGL implementations, the texture matrix is always loaded into OpenGL. We do not push() and pop() matrices. " class SoGLNormalElement The SoGLNormalElement class is yet to be documented. FIXME: write doc. " class SoGLPointSizeElement The SoGLPointSizeElement class changes the pointsize setting of the OpenGL render state. Requests from the scenegraph to change the pointsize when rendering point primitives will be made through this element, which forwards it to the appropriate native OpenGL call. " class SoGLPolygonOffsetElement The SoGLPolygonOffsetElement class is yet to be documented. FIXME: write doc. " class SoGLProjectionMatrixElement The SoGLProjectionMatrixElement class is yet to be documented. FIXME: write doc. " class SoGLRenderPassElement The SoGLRenderPassElement class is yet to be documented. FIXME: write doc. " class SoGLShapeHintsElement The SoGLShapeHintsElement class is yet to be documented. FIXME: write doc. " class SoGLUpdateAreaElement The SoGLUpdateAreaElement class is yet to be documented. FIXME: write doc. " class SoGLVBOElement The SoGLVBOElement class is used to store VBO state. FIXME: write doc. " class SoGLViewingMatrixElement The SoGLViewingMatrixElement class is used to store the current viewing matrix. The viewing matrix contains the inverse camera coordinate system matrix. The camera coordinate system is built from the field values in the current SoCamera (currently either SoPerspectiveCamera or SoOrthographicCamera) and any transformations prior to the camera in the scene graph. " class SoGLViewportRegionElement The SoGLViewportRegionElement class is yet to be documented. FIXME: write doc. " class SoAccumulatedElement The SoAccumulatedElement class is an abstract class for storing accumulated state. This is the superclass of elements where new element data accumulates with older data. " class SoAmbientColorElement The SoAmbientColorElement class is yet to be documented. class SoAnnoText3CharOrientElement The SoAnnoText3CharOrientElement class is yet to be documented. FIXME: write doc. " class SoAnnoText3FontSizeHintElement The SoAnnoText3FontSizeHintElement class is yet to be documented. FIXME: write doc. " class SoAnnoText3RenderPrintElement The SoAnnoText3RenderPrintElement class is yet to be documented. FIXME: write doc. " class SoBBoxModelMatrixElement The SoBBoxModelMatrixElement class keeps track of the current model matrix during a scene graph traversal. It is used by amongst others the SoGetBoundingBoxAction class. class SoBumpMapCoordinateElement The SoBumpMapCoordinateElement class is yet to be documented. FIXME: write doc. " class SoBumpMapMatrixElement The SoBumpMapMatrixElement class is used to manage the bump map matrix stack. The bump map matrix is used to transform bump map coordinates before being used to map bump maps onto polygons. " class SoCacheElement The SoCacheElement class stores and manages the open caches. class SoClipPlaneElement The SoClipPlaneElement class is used to manage the clip plane stack. class SoComplexityElement The SoComplexityElement class contains the current shape complexity for a graph traverser. class SoComplexityTypeElement The SoComplexityTypeElement class is yet to be documented. FIXME: write doc. " class SoCoordinateElement The SoCoordinateElement class is yet to be documented. FIXME: write doc. " class SoCreaseAngleElement The SoCreaseAngleElement class stores the crease angle during a scene graph traversal. class SoCullElement The SoCullElement class is used internally for render and pick culling. The element holds all planes the geometry should be inside, and keeps a bitflag to signal which planes need to be tested. " class SoDecimationPercentageElement The SoDecimationPercentageElement class is yet to be documented. FIXME: write doc. " class SoDecimationTypeElement The SoDecimationTypeElement class is yet to be documented. FIXME: write doc. " class SoDepthBufferElement The SoDepthBufferElement controls the depth buffer settings. class SoDiffuseColorElement The SoDiffuseColorElement class is yet to be documented. FIXME: write doc. " class SoDrawStyleElement The SoDrawStyleElement class is yet to be documented. FIXME: write doc. " class SoElement SoElement is the abstract base class for all elements. class SoEmissiveColorElement The SoEmissiveColorElement class is yet to be documented. FIXME: write doc. " class SoEnvironmentElement The SoEnvironmentElement class is yet to be documented. FIXME: write doc. " class SoFloatElement SoFloatElement is an abstract base class for elements that consists of a single float value. This is the superclass of elements where the new element data replaces the old data, and where the data the element stores is a simple single precision floating point value. " class SoFocalDistanceElement The SoFocalDistanceElement class is yet to be documented. FIXME: write doc. " class SoFontNameElement The SoFontNameElement class is yet to be documented. FIXME: write doc. " class SoFontSizeElement The SoFontSizeElement class is yet to be documented. FIXME: write doc. " class SoInt32Element The SoInt32Element class is the base class for elements that simply store a 32-bit integer. This is the superclass of elements where the new element data replaces the old data, and where the data the element stores is a simple 32-bit integer value. " class SoLazyElement The SoLazyElement class is used to handle material and shape properties. So[GL]LazyElement is, as the name implies, an element that is lazy about sending things to OpenGL. The changes are not sent to OpenGL until SoGLLazyElement::send() is called. This means that you can change the state of certain attributes several times, but the state will only be sent to OpenGL once. " class SoLightAttenuationElement The SoLightAttenuationElement class is yet to be documented. FIXME: write doc. " class SoLightElement The SoLightElement class manages the currently active light sources. class SoLightModelElement The SoLightModelElement class is yet to be documented. FIXME: write doc. " class SoLinePatternElement The SoLinePatternElement class is yet to be documented. FIXME: write doc. " class SoLineWidthElement The SoLineWidthElement class changes the linewidth setting of the render state. Requests from the scenegraph to change the linewidth when rendering line primitives will be made through this element, which forwards it to the appropriate native call in the underlying rendering library. " class SoListenerDopplerElement The SoListenerDopplerElement holds the doppler velocity and factor of the current listener. The dopplerVelocity and dopplerFactor is set by SoListener nodes during audio rendering. The SoListenerDopplerElement is used when the SoVRMLSound nodes render themselves. " class SoListenerGainElement The SoListenerGainElement class stores the SoListener gain during a scene graph traversal. This gain is set by SoListener nodes during audio rendering. The SoListenerGainElement is used when the SoVRMLSound nodes render themselves. " class SoListenerOrientationElement The SoListenerOrientationElement holds the orientation of the current listener. This orientation is set by SoListener nodes and SoCamera Nodes during audio rendering. When a SoListener is visited by the SoAudioRenderAction, it will add a new SoListenerOrientationElement to the state, holding it's orientation and with the setbylistener flag set. When a SoCamera is visited by SoAudioRenderAction, it will add a new SoListenerOrientationElement only if there are no previous elements with the setbylistener flag set. " class SoListenerPositionElement The SoListenerPositionElement holds the position of the current listener. This position is set by SoListener nodes and SoCamera Nodes during audio rendering. When a SoListener is visited by the SoAudioRenderAction, it will add a new SoListenerPositionElement to the state, holding it's position and with the setbylistener flag set. When a SoCamera is visited by SoAudioRenderAction, it will add a new SoListenerPositionElement only if there are no previous elements with the setbylistener flag set. " class SoLocalBBoxMatrixElement The SoLocalBBoxMatrixElement class is yet to be documented. FIXME: write doc. " class SoMaterialBindingElement The SoMaterialBindingElement class is yet to be documented. FIXME: write doc. " class SoModelMatrixElement The SoModelMatrixElement class is used to manage the current transformation. SoModelMatrixElement contains the object-to-world matrix. " class SoMultiTextureEnabledElement The SoMultiTextureEnabledElement class is an element which stores whether texturing is enabled or not. Be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API. " class SoMultiTextureImageElement The SoMultiTextureImageElement class is yet to be documented. FIXME: write doc. " class SoMultiTextureMatrixElement The SoMultiTextureMatrixElement class is used to manage the texture matrix stack for texture units > 0. The texture matrix is used to transform texture coordinates before being used to map textures onto polygons. " class SoNormalBindingElement The SoNormalBindingElement is yet to be documented. FIXME: write doc. " class SoNormalElement The SoNormalElement class is yet to be documented. FIXME: write doc. " class SoOverrideElement The SoOverrideElement maintains a list of overridable elements and a list over which elements should be overridden. Only certain elements can be overridden. " class SoPickRayElement The SoPickRayElement class is yet to be documented. FIXME: write doc. " class SoPickStyleElement The SoPickStyleElement is yet to be documented. FIXME: write doc. " class SoPointSizeElement The SoPointSizeElement changes the pointsize setting of the render state. Requests from the scenegraph to change the pointsize when rendering point primitives will be made through this element. " class SoPolygonOffsetElement The SoPolygonOffsetElement class is yet to be documented. FIXME: write doc. " class SoProfileCoordinateElement The SoProfileCoordinateElement class is yet to be documented. FIXME: write doc. " class SoProfileElement The SoProfileElement class is yet to be documented. FIXME: write doc. " class SoReplacedElement The SoReplacedElement class is an abstract element superclass. This is the superclass of all elements where the new element data replaces the old data, and where the data the element stores is not just a simple float or integer value. " class SoShapeStyleElement The SoShapeStyleElement class is yet to be documented. FIXME: write doc. " class SoShininessElement The SoShininessElement class is yet to be documented. FIXME: write doc. " class SoSoundElement The SoSoundElement is used for optimizing audio rendering and for turning off inactive SoVRMLSound nodes. class SoSpecularColorElement The SoSpecularColorElement is yet to be documented. FIXME: write doc. " class SoSwitchElement The SoSwitchElement class is yet to be documented. FIXME: write doc. " class SoTextOutlineEnabledElement The SoTextOutlineEnabledElement class is yet to be documented. FIXME: write doc. " class SoTextureCombineElement The SoTextureCombineElement class is yet to be documented. FIXME: write doc. " class SoTextureCoordinateBindingElement The SoTextureCoordinateBindingElement class is yet to be documented. FIXME: write doc. " class SoTextureOverrideElement The SoTextureOverrideElement makes it possible to override texture elements. class SoTextureQualityElement The SoTextureQualityElement is yet to be documented. FIXME: write doc. " class SoTextureUnitElement The SoTextureUnitElement class is yet to be documented. class SoTransparencyElement The SoTransparencyElement is yet to be documented. FIXME: write doc. " class SoUnitsElement The SoUnitsElement class is yet to be documented. FIXME: write doc. " class SoVertexAttributeBindingElement The SoVertexAttributeBindingElement class is yet to be documented. FIXME: write doc. " class SoViewingMatrixElement The SoViewingMatrixElement class stores the world-to-camera transformation. class SoViewportRegionElement The SoViewportRegionElement class is yet to be documented. FIXME: write doc. " class SoViewVolumeElement The SoViewVolumeElement class is yet to be documented. FIXME: write doc. " class SoWindowElement The SoWindowElement class is used to store current window attributes. In Coin, this element is not API-compatible with SGI Inventor, since it contains platform specific stuff, which we want to avoid. " class SoGeoElement The SoGeoElement class is yet to be documented. FIXME: write doc. " class SoGLShadowCullingElement The SoGLShadowCullingElement class is yet to be documented. FIXME: write doc. " class SoShadowStyleElement The SoShadowStyleElement class is yet to be documented. FIXME: write doc. "
Detailed Description
The element classes in Coin are the containers of state information during action traversals of scene graphs. One element usually corresponts to one item of information, or sometimes a group of related information values. The elements work like a stack that is pushed and popped as the action traverses in and out of SoSeparator nodes, and the action will always just inspect the top of the stack when it needs to know a value. Elements are internal implementation details of the workings of nodes and actions, and is not something one needs to worry about before writing ones own extension nodes. Writing extension elements is even more removed from plain Open Inventor usage, but is fully possible for the experienced Open Inventor developer. The Element Classes Elements are mostly internal to Coin, unless you create new extension nodes over Coin. Then you will probably need to know about them. Elements are part of the design for scenegraph traversal in Coin. It works like this: any traversal action instantiates and keeps a single SoState instance during traversal. The SoState instance uses SoElement objects as 'memory units' to keep track of the current state for any feature of the scenegraph nodes. As an example, consider the SoPointSize node: when the SoPointSize node is traversed by for instance a SoGLRenderAction, it will itself push a SoPointSizeElement onto the SoGLRenderAction's SoState stack. Later, when a SoPointSet node occurs in the scenegraph, it will request the current pointsize value from the SoState by reading off the value of it's SoPointSizeElement. SoSeparator nodes will push and pop elements on and off the state stack, so anything that changes state below a SoSeparator node will not influence anything above the SoSeparator. For more information on the theoretical underpinnings of this traversal design, you should consider reading available literature on the so-called 'Visitor pattern'. We recommend 'Design Patterns', by Gamma, Helm, Johnson, Vlissides (aka the 'Gang Of Four'). This book actually uses the Inventor API traversal mechanism as the case study for explaining the Visitor pattern. For extending the Coin library with your own classes, we strongly recommend that you make yourself acquainted with the excellent «The Inventor Toolmaker» book (ISBN 0-201-62493-1), which describes the tasks involved in detail. This book was written by the original SGI Inventor designers and explains many of the underlying design ideas, aswell as having lots of hands-on examples on how to extend the Coin toolkit in ways that are true to the fundamental design ideas. («The Inventor Toolmaker» is also available at SGI's online library, at no cost. See Download The Inventor Toolmaker.) Reading the sourcecode of the built-in classes in Coin should also provide very helpful. The following is a complete example on how to extend Coin with your own traversal elements. First, the class declaration of the new element (ie the header include file): // [texturefilenameelement.h] #ifndef TEXTUREFILENAMEELEMENT_H #define TEXTUREFILENAMEELEMENT_H #include <Inventor/elements/SoReplacedElement.h> #include <Inventor/SbString.h> class TextureFilenameElement : public SoReplacedElement { typedef SoReplacedElement inherited; SO_ELEMENT_HEADER(TextureFilenameElement); public: static void initClass(void); virtual void init(SoState * state); static void set(SoState * const state, SoNode * const node, const SbString & filename); static const SbString & get(SoState * const state); static const TextureFilenameElement * getInstance(SoState * state); protected: virtual ~TextureFilenameElement(); virtual void setElt(const SbString & filename); private: SbString filename; }; #endif // !TEXTUREFILENAMEELEMENT_H The implementation of the element: // [texturefilenameelement.cpp] // // The purpose of the code in this file is to demonstrate how you can // make your own elements for scene graph traversals. // // Code by Peder Blekken <pederb@sim.no>. Copyright (C) // Kongsberg Oil & Gas Technologies. #include "texturefilenameelement.h" SO_ELEMENT_SOURCE(TextureFilenameElement); void TextureFilenameElement::initClass(void) { SO_ELEMENT_INIT_CLASS(TextureFilenameElement, inherited); } void TextureFilenameElement::init(SoState * state) { this->filename = "<none>"; } TextureFilenameElement::~TextureFilenameElement() { } void TextureFilenameElement::set(SoState * const state, SoNode * const node, const SbString & filename) { TextureFilenameElement * elem = (TextureFilenameElement *) SoReplacedElement::getElement(state, classStackIndex, node); elem->setElt(filename); } const SbString & TextureFilenameElement::get(SoState * const state) { return TextureFilenameElement::getInstance(state)->filename; } void TextureFilenameElement::setElt(const SbString & filename) { this->filename = filename; } const TextureFilenameElement * TextureFilenameElement::getInstance(SoState * state) { return (const TextureFilenameElement *) SoElement::getConstElement(state, classStackIndex); } And a small, stand-alone test application putting the new element to use: // [lstextures.cpp] // // The purpose of this file is to make a small wrapper "tool" around // the TextureFilenameElement extension element, just for showing // example code on how to make use of a user-defined custom element. // // The code goes like this: // // We initialize the element, enable it for the SoCallbackAction, read // a scene graph file, set callbacks on SoTexture2 and all shape nodes // and applies the SoCallbackAction. The callbacks will then print out // the texture filename information from the TextureFilenameElement // each time an interesting node is hit. // // // Code by Peder Blekken <pederb@sim.no>. Cleaned up, integrated in // Coin distribution and commented by Morten Eriksen // <mortene@sim.no>. Copyright (C) Kongsberg Oil & Gas Technologies. #include <Inventor/SoDB.h> #include <Inventor/SoInput.h> #include <Inventor/actions/SoCallbackAction.h> #include <Inventor/nodes/SoSeparator.h> #include <Inventor/nodes/SoTexture2.h> #include <Inventor/nodes/SoShape.h> #include <Inventor/misc/SoState.h> #include <cstdio> #include "texturefilenameelement.h" SoCallbackAction::Response pre_tex2_cb(void * data, SoCallbackAction * action, const SoNode * node) { const SbString & filename = ((SoTexture2 *)node)->filename.getValue(); TextureFilenameElement::set(action->getState(), (SoNode *)node, filename); (void)fprintf(stdout, "=> New texture: %s0, filename.getLength() == 0 ? "<inlined>" : filename.getString()); return SoCallbackAction::CONTINUE; } SoCallbackAction::Response pre_shape_cb(void * data, SoCallbackAction * action, const SoNode * node) { const SbString & filename = TextureFilenameElement::get(action->getState()); (void)fprintf(stdout, " Texturemap on %s: %s0, node->getTypeId().getName().getString(), filename.getLength() == 0 ? "<inlined>" : filename.getString()); return SoCallbackAction::CONTINUE; } void usage(const char * appname) { (void)fprintf(stderr, "Usage: %s <modelfile.iv>0, appname); (void)fprintf(stderr, "Lists all texture filenames in the model file,0 "and on which shape nodes they are used.0 "The purpose of this example utility is simply to0 "show how to create and use an extension element for0 "scene graph traversal.0); } int main(int argc, char ** argv) { if (argc != 2) { usage(argv[0]); exit(1); } SoDB::init(); TextureFilenameElement::initClass(); SO_ENABLE(SoCallbackAction, TextureFilenameElement); SoInput input; if (!input.openFile(argv[1])) { (void)fprintf(stderr, "ERROR: couldn't open file ``%s''.0, argv[1]); exit(1); } SoSeparator * root = SoDB::readAll(&input); if (root) { root->ref(); SoCallbackAction cbaction; cbaction.addPreCallback(SoTexture2::getClassTypeId(), pre_tex2_cb, NULL); cbaction.addPreCallback(SoShape::getClassTypeId(), pre_shape_cb, NULL); cbaction.apply(root); root->unref(); return 0; } return 1; }
Author
Generated automatically by Doxygen for Coin from the source code.