Man Linux: Main Page and Category List

NAME

       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.

SYNOPSIS

       #include <Inventor/elements/SoLazyElement.h>

       Inherits SoElement.

       Inherited by SoGLLazyElement.

   Public Types
       enum cases { LIGHT_MODEL_CASE =  0, COLOR_MATERIAL_CASE, DIFFUSE_CASE,
           AMBIENT_CASE, EMISSIVE_CASE, SPECULAR_CASE, SHININESS_CASE,
           BLENDING_CASE, TRANSPARENCY_CASE, VERTEXORDERING_CASE,
           TWOSIDE_CASE, CULLING_CASE, SHADE_MODEL_CASE, GLIMAGE_CASE,
           ALPHATEST_CASE, LAZYCASES_LAST }
       enum masks { LIGHT_MODEL_MASK =  1 << LIGHT_MODEL_CASE,
           COLOR_MATERIAL_MASK =  1 << COLOR_MATERIAL_CASE, DIFFUSE_MASK =  1
           << DIFFUSE_CASE, AMBIENT_MASK =  1 << AMBIENT_CASE, EMISSIVE_MASK =
           1<<EMISSIVE_CASE, SPECULAR_MASK =  1 << SPECULAR_CASE,
           SHININESS_MASK =  1 << SHININESS_CASE, TRANSPARENCY_MASK =  1 <<
           TRANSPARENCY_CASE, BLENDING_MASK =  1 << BLENDING_CASE,
           VERTEXORDERING_MASK =  1 << VERTEXORDERING_CASE, TWOSIDE_MASK =  1
           << TWOSIDE_CASE, CULLING_MASK =  1 << CULLING_CASE,
           SHADE_MODEL_MASK =  1 << SHADE_MODEL_CASE, GLIMAGE_MASK =  1 <<
           GLIMAGE_CASE, ALPHATEST_MASK =  1 << ALPHATEST_CASE, ALL_MASK =  (1
           << LAZYCASES_LAST)-1 }
       enum internalMasks { OTHER_COLOR_MASK =
           AMBIENT_MASK|EMISSIVE_MASK|SPECULAR_MASK|SHININESS_MASK,
           ALL_COLOR_MASK =  OTHER_COLOR_MASK|DIFFUSE_MASK, NO_COLOR_MASK =
           ALL_MASK & (~ALL_COLOR_MASK), ALL_BUT_DIFFUSE_MASK =  ALL_MASK &(~
           DIFFUSE_MASK), DIFFUSE_ONLY_MASK =  ALL_MASK &(~ OTHER_COLOR_MASK)
           }
       enum LightModel { BASE_COLOR, PHONG }
       enum VertexOrdering { CW, CCW }

   Public Member Functions
       virtual void init (SoState *state)
       virtual void push (SoState *state)
       virtual SbBool matches (const SoElement *) const
       virtual SoElement * copyMatchInfo (void) const
       int32_t getNumDiffuse (void) const
       int32_t getNumTransparencies (void) const
       int32_t getNumColorIndices (void) const
       SbBool isPacked (void) const
       SbBool isTransparent (void) const
       const uint32_t * getPackedPointer (void) const
       const SbColor * getDiffusePointer (void) const
       const int32_t * getColorIndexPointer (void) const
       const float * getTransparencyPointer (void) const

   Static Public Member Functions
       static void initClass ()
       static void setToDefault (SoState *state)
       static void setDiffuse (SoState *state, SoNode *node, int32_t
           numcolors, const SbColor *colors, SoColorPacker *packer)
       static void setTransparency (SoState *state, SoNode *node, int32_t
           numvalues, const float *transparency, SoColorPacker *packer)
       static void setPacked (SoState *state, SoNode *node, int32_t numcolors,
           const uint32_t *colors, const SbBool packedtransparency=0)
       static void setColorIndices (SoState *state, SoNode *node, int32_t
           numindices, const int32_t *indices)
       static void setAmbient (SoState *state, const SbColor *color)
       static void setEmissive (SoState *state, const SbColor *color)
       static void setSpecular (SoState *state, const SbColor *color)
       static void setShininess (SoState *state, float value)
       static void setColorMaterial (SoState *state, SbBool value)
       static void enableBlending (SoState *state, int sfactor, int dfactor)
       static void enableSeparateBlending (SoState *state, int sfactor, int
           dfactor, int alpha_sfactor, int alpha_dfactor)
       static void disableBlending (SoState *state)
       static void setLightModel (SoState *state, const int32_t model)
       static void setVertexOrdering (SoState *state, VertexOrdering ordering)
       static void setBackfaceCulling (SoState *state, SbBool onoff)
       static void setTwosideLighting (SoState *state, SbBool onoff)
       static void setShadeModel (SoState *state, SbBool flatshading)
       static void setGLImageId (SoState *state, uint32_t glimageid, SbBool
           alphatest)
       static void setAlphaTest (SoState *state, SbBool onoff)
       static const SbColor & getDiffuse (SoState *state, int index)
       static float getTransparency (SoState *, int index)
       static const uint32_t * getPackedColors (SoState *)
       static const int32_t * getColorIndices (SoState *)
       static int32_t getColorIndex (SoState *, int num)
       static const SbColor & getAmbient (SoState *)
       static const SbColor & getEmissive (SoState *)
       static const SbColor & getSpecular (SoState *)
       static float getShininess (SoState *)
       static SbBool getColorMaterial (SoState *)
       static SbBool getBlending (SoState *, int &sfactor, int &dfactor)
       static SbBool getAlphaBlending (SoState *, int &sfactor, int &dfactor)
       static int32_t getLightModel (SoState *)
       static SbBool getAlphaTest (SoState *state)
       static SoLazyElement * getInstance (SoState *state)
       static float getDefaultAmbientIntensity (void)
       static SbColor getDefaultDiffuse (void)
       static SbColor getDefaultAmbient (void)
       static SbColor getDefaultSpecular (void)
       static SbColor getDefaultEmissive (void)
       static float getDefaultShininess (void)
       static uint32_t getDefaultPacked (void)
       static float getDefaultTransparency (void)
       static int32_t getDefaultLightModel (void)
       static int32_t getDefaultColorIndex (void)
       static void setMaterials (SoState *state, SoNode *node, uint32_t
           bitmask, SoColorPacker *cPacker, const SbColor *diffuse, const int
           numdiffuse, const float *transp, const int numtransp, const SbColor
           &ambient, const SbColor &emissive, const SbColor &specular, const
           float shininess, const SbBool istransparent)
       static SoLazyElement * getWInstance (SoState *state)
       static void setTransparencyType (SoState *state, int32_t type)

   Protected Member Functions
       virtual void lazyDidSet (uint32_t mask)
       virtual void lazyDidntSet (uint32_t mask)
       virtual void setDiffuseElt (SoNode *, int32_t numcolors, const SbColor
           *colors, SoColorPacker *packer)
       virtual void setPackedElt (SoNode *node, int32_t numcolors, const
           uint32_t *colors, const SbBool packedtransparency)
       virtual void setColorIndexElt (SoNode *node, int32_t numindices, const
           int32_t *indices)
       virtual void setTranspElt (SoNode *node, int32_t numtransp, const float
           *transp, SoColorPacker *packer)
       virtual void setTranspTypeElt (int32_t type)
       virtual void setAmbientElt (const SbColor *color)
       virtual void setEmissiveElt (const SbColor *color)
       virtual void setSpecularElt (const SbColor *color)
       virtual void setShininessElt (float value)
       virtual void setColorMaterialElt (SbBool value)
       virtual void enableBlendingElt (int sfactor, int dfactor, int
           alpha_sfactor, int alpha_dfactor)
       virtual void disableBlendingElt (void)
       virtual void setLightModelElt (SoState *state, int32_t model)
       virtual void setMaterialElt (SoNode *node, uint32_t bitmask,
           SoColorPacker *packer, const SbColor *diffuse, const int
           numdiffuse, const float *transp, const int numtransp, const SbColor
           &ambient, const SbColor &emissive, const SbColor &specular, const
           float shininess, const SbBool istransparent)
       virtual void setVertexOrderingElt (VertexOrdering ordering)
       virtual void setBackfaceCullingElt (SbBool onoff)
       virtual void setTwosideLightingElt (SbBool onoff)
       virtual void setShadeModelElt (SbBool flatshading)
       virtual void setGLImageIdElt (uint32_t glimageid, SbBool alphatest)
       virtual void setAlphaTestElt (SbBool onoff)

   Protected Attributes
       struct SoLazyElement::CoinState coinstate

Detailed Description

       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.

       When creating a new shape node in Coin, it’s a common operation to
       modify the OpenGL diffuse color. There are several ways you can send
       the color to OpenGL. If you’re not going to use the color outside your
       node, you can just as well send it using plain OpenGL. You can also set
       the color in the element, and then force a send by using
       SoGLLazyElement::send(state, SoLazyElement::DIFFUSE_MASK).

       However, when creating an extension shape node, it’s always recommended
       to create an instance of SoMaterialBundle on the stack. If this
       instance is created after you update SoLazyElement with a new color,
       the new color will be sent to OpenGL when you call
       SoMaterialBundle::sendFirst(). This call will also update all other
       lazy OpenGL state, and it’s actually required to either use
       SoMaterialBundle::sendFirst() or call SoGLLazyElement::send(state,
       SoLazyElement::ALL_MASK) when creating a shape node.

       If you decide to send the color to OpenGL using glColor*(), you should
       notify SoGLLazyElement about this by calling
       SoGLLazyElement::reset(state, SoLazyElement::DIFFUSE_MASK). This will
       notify SoGLLazyElement that the current OpenGL diffuse color is
       unknown.

Member Function Documentation

   void SoLazyElement::initClass (void) [static] This static method
       initializes static data for the SoDiffuseColorElement class.
       Reimplemented from SoElement.

       Reimplemented in SoGLLazyElement.

   SoElement * SoLazyElement::copyMatchInfo (void) const [virtual] Just
       returns NULL in Coin.
       Implements SoElement.

   void SoLazyElement::setToDefault (SoState * state) [static] Internal
       function used for resetting the OpenGL state before FBO rendering.

Author

       Generated automatically by Doxygen for Coin from the source code.