Coin
4.0.3
Coin3D core library
|
The SoLazyElement class is used to handle material and shape properties. More...
#include <Inventor/elements/SoLazyElement.h>
Classes | |
struct | CoinState |
Public Member Functions | |
virtual SoElement * | copyMatchInfo (void) const |
const int32_t * | getColorIndexPointer (void) const |
const SbColor * | getDiffusePointer (void) const |
int32_t | getNumColorIndices (void) const |
int32_t | getNumDiffuse (void) const |
int32_t | getNumTransparencies (void) const |
const uint32_t * | getPackedPointer (void) const |
const float * | getTransparencyPointer (void) const |
virtual void | init (SoState *state) |
SbBool | isPacked (void) const |
SbBool | isTransparent (void) const |
virtual SbBool | matches (const SoElement *) const |
virtual void | push (SoState *state) |
Public Member Functions inherited from SoElement | |
virtual | ~SoElement () |
int | getDepth (void) const |
int | getStackIndex (void) const |
const SoType | getTypeId (void) const |
virtual void | pop (SoState *state, const SoElement *prevTopElement) |
virtual void | print (FILE *file=stdout) const |
void | setDepth (const int depth) |
Static Public Member Functions | |
static void * | createInstance (void) |
static void | disableBlending (SoState *state) |
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 SbBool | getAlphaBlending (SoState *, int &sfactor, int &dfactor) |
static int | getAlphaTest (SoState *state, float &value) |
static const SbColor & | getAmbient (SoState *) |
static SbBool | getBlending (SoState *, int &sfactor, int &dfactor) |
static int | getClassStackIndex (void) |
static SoType | getClassTypeId (void) |
static int32_t | getColorIndex (SoState *, int num) |
static const int32_t * | getColorIndices (SoState *) |
static SbBool | getColorMaterial (SoState *) |
static SbColor | getDefaultAmbient (void) |
static float | getDefaultAmbientIntensity (void) |
static int32_t | getDefaultColorIndex (void) |
static SbColor | getDefaultDiffuse (void) |
static SbColor | getDefaultEmissive (void) |
static int32_t | getDefaultLightModel (void) |
static uint32_t | getDefaultPacked (void) |
static float | getDefaultShininess (void) |
static SbColor | getDefaultSpecular (void) |
static float | getDefaultTransparency (void) |
static const SbColor & | getDiffuse (SoState *state, int index) |
static const SbColor & | getEmissive (SoState *) |
static SoLazyElement * | getInstance (SoState *state) |
static int32_t | getLightModel (SoState *) |
static const uint32_t * | getPackedColors (SoState *) |
static float | getShininess (SoState *) |
static const SbColor & | getSpecular (SoState *) |
static float | getTransparency (SoState *, int index) |
static SbBool | getTwoSidedLighting (SoState *state) |
static SoLazyElement * | getWInstance (SoState *state) |
static void | initClass () |
static void | setAlphaTest (SoState *state, int func, float value) |
static void | setAmbient (SoState *state, const SbColor *color) |
static void | setBackfaceCulling (SoState *state, SbBool onoff) |
static void | setColorIndices (SoState *state, SoNode *node, int32_t numindices, const int32_t *indices) |
static void | setColorMaterial (SoState *state, SbBool value) |
static void | setDiffuse (SoState *state, SoNode *node, int32_t numcolors, const SbColor *colors, SoColorPacker *packer) |
static void | setEmissive (SoState *state, const SbColor *color) |
static void | setLightModel (SoState *state, const int32_t model) |
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 void | setPacked (SoState *state, SoNode *node, int32_t numcolors, const uint32_t *colors, const SbBool packedtransparency=FALSE) |
static void | setShadeModel (SoState *state, SbBool flatshading) |
static void | setShininess (SoState *state, float value) |
static void | setSpecular (SoState *state, const SbColor *color) |
static void | setToDefault (SoState *state) |
static void | setTransparency (SoState *state, SoNode *node, int32_t numvalues, const float *transparency, SoColorPacker *packer) |
static void | setTransparencyType (SoState *state, int32_t type) |
static void | setTwosideLighting (SoState *state, SbBool onoff) |
static void | setVertexOrdering (SoState *state, VertexOrdering ordering) |
Static Public Member Functions inherited from SoElement | |
static int | getClassStackIndex (void) |
static SoType | getClassTypeId (void) |
static SoType | getIdFromStackIndex (const int stackIndex) |
static int | getNumStackIndices (void) |
static void | initClass (void) |
static void | initElements (void) |
Protected Member Functions | |
~SoLazyElement () | |
virtual void | disableBlendingElt (void) |
virtual void | enableBlendingElt (int sfactor, int dfactor, int alpha_sfactor, int alpha_dfactor) |
virtual void | lazyDidntSet (uint32_t mask) |
virtual void | lazyDidSet (uint32_t mask) |
virtual void | setAlphaTestElt (int func, float value) |
virtual void | setAmbientElt (const SbColor *color) |
virtual void | setBackfaceCullingElt (SbBool onoff) |
virtual void | setColorIndexElt (SoNode *node, int32_t numindices, const int32_t *indices) |
virtual void | setColorMaterialElt (SbBool value) |
virtual void | setDiffuseElt (SoNode *, int32_t numcolors, const SbColor *colors, SoColorPacker *packer) |
virtual void | setEmissiveElt (const SbColor *color) |
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 | setPackedElt (SoNode *node, int32_t numcolors, const uint32_t *colors, const SbBool packedtransparency) |
virtual void | setShadeModelElt (SbBool flatshading) |
virtual void | setShininessElt (float value) |
virtual void | setSpecularElt (const SbColor *color) |
virtual void | setTranspElt (SoNode *node, int32_t numtransp, const float *transp, SoColorPacker *packer) |
virtual void | setTranspTypeElt (int32_t type) |
virtual void | setTwosideLightingElt (SbBool onoff) |
virtual void | setVertexOrderingElt (VertexOrdering ordering) |
Protected Member Functions inherited from SoElement | |
SoElement (void) | |
void | capture (SoState *const state) const |
virtual void | captureThis (SoState *state) const |
SoElement * | getNextFree (void) const |
SoElement * | getNextInStack (void) const |
void | setStackIndex (const int index) |
void | setTypeId (const SoType typeId) |
Protected Attributes | |
struct SoLazyElement::CoinState | coinstate |
Protected Attributes inherited from SoElement | |
int | depth |
int | stackIndex |
SoType | typeId |
Additional Inherited Members | |
Static Protected Member Functions inherited from SoElement | |
static int | createStackIndex (const SoType id) |
static const SoElement * | getConstElement (SoState *const state, const int stackIndex) |
static SoElement * | getElement (SoState *const state, const int stackIndex) |
Static Protected Attributes inherited from SoElement | |
static int | classStackIndex |
static SoTypeList * | stackToType |
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 is 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.
|
protected |
Destructor.
Just returns NULL in Coin.
Implements SoElement.
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Creates a new instance of the class type corresponding to the SoType object.
|
static |
This static method returns the state stack index for the class.
This static method returns the SoType object associated with objects of this class.
This function initializes the element type in the given SoState. It is called for the first element of each enabled element type in SoState objects.
Reimplemented from SoElement.
Reimplemented in SoGLLazyElement.
Initialize relevant common data for all instances, like the type system.
Will always return TRUE in Coin.
Implements SoElement.
This method is called every time a new element is required in one of the stacks. This happens when a writable element is requested, using SoState::getElement() or indirectly SoElement::getElement(), and the depth of the current element is less than the state depth.
Override this method if your element needs to copy data from the previous top of stack. The push() method is called on the new element, and the previous element can be found using SoElement::getNextInStack().
Reimplemented from SoElement.
Reimplemented in SoGLLazyElement.
Internal function used for resetting the OpenGL state before FBO rendering.