Open Inventor Reference
|
Element that manages several properties such as colors, that need to be lazily tracked by GL. More...
#include <Inventor/elements/SoLazyElement.h>
Classes | |
struct | ivStateStruct |
Struct to hold the inventor state: More... | |
Public Types | |
enum | cases { LIGHT_MODEL_CASE = 0 , COLOR_MATERIAL_CASE = 1 , DIFFUSE_CASE = 2 , AMBIENT_CASE = 3 , EMISSIVE_CASE = 4 , SPECULAR_CASE = 5 , SHININESS_CASE = 6 , BLENDING_CASE = 7 , TRANSPARENCY_CASE = 8 } |
Following masks and cases define the components of the lazy element. More... | |
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 , ALL_MASK = (1<<SO_LAZY_NUM_COMPONENTS)-1 } |
enum | LightModel { BASE_COLOR = 0 , PHONG = 1 } |
Enum values to be used in setting/getting light model: More... | |
enum | VertexAttribs { ATTRIB_VERTEX = 0 , ATTRIB_NORMAL = 1 , ATTRIB_COLOR = 2 , ATTRIB_TEXCOORD = 3 } |
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) } |
Public Member Functions | |
virtual void | init (SoState *state) |
Initializes element. | |
int32_t | getNumDiffuse () const |
Methods to inquire about current colors: | |
int32_t | getNumTransparencies () const |
bool | isPacked () const |
bool | isTransparent () const |
virtual void | push (SoState *state) |
push (for non-GL elements) | |
virtual bool | matches (const SoElement *) const |
note: matches, copyMatchinfo not used by this element. | |
virtual SoElement * | copyMatchInfo () const |
Create a copy that we can put in a cache used list and call matches() on later. | |
virtual void | print (FILE *fp) const |
Prints element (for debugging) | |
const uint32_t * | getPackedPointer () const |
Following SoINTERNAL get() methods do NOT cause cache dependency, should only be invoked by nodes that use the reallySend method on SoGLLazyElement to establish correct cache dependencies by tracking what was actually sent to GL. | |
const SbColor * | getDiffusePointer () const |
const float * | getTransparencyPointer () const |
Public Member Functions inherited from SoElement | |
virtual void | init (SoState *state) |
Initializes element. | |
virtual void | push (SoState *state) |
Pushes/pops element. | |
virtual void | pop (SoState *state, const SoElement *prevTopElement) |
virtual void | print (FILE *fp) const |
Prints element (for debugging) | |
virtual bool | matches (const SoElement *elt) const =0 |
Returns TRUE if the element matches another element (of the same class, presumably) with respect to cache validity. | |
virtual SoElement * | copyMatchInfo () const =0 |
Create a copy that we can put in a cache used list and call matches() on later. | |
SoType | getTypeId () const |
Returns type identifier for element instance. | |
int | getStackIndex () const |
Returns the stack index for an element instance. | |
void | setDepth (int dpth) |
Sets stuff in an element instance. | |
void | setNext (SoElement *nxt) |
void | setNextInStack (SoElement *nxt) |
void | setNextFree (SoElement *nxt) |
int | getDepth () const |
Returns stuff from element instance. | |
SoElement * | getNext () const |
virtual | ~SoElement () |
Destructor. | |
Static Public Member Functions | |
static void | setDiffuse (SoState *state, SoNode *node, int32_t numColors, const SbColor *colors, SoColorPacker *cPacker) |
static set methods: | |
static void | setTransparency (SoState *state, SoNode *node, int32_t numTransp, const float *transp, SoColorPacker *cPacker) |
static void | setPacked (SoState *state, SoNode *node, int32_t numColors, const uint32_t *colors) |
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, bool value) |
static void | setBlending (SoState *state, bool value) |
static void | setOverrideBlending (SoState *state, bool flag) |
This method allows to enable overriding of the blending mode. | |
static void | setLightModel (SoState *state, const int32_t model) |
static const SbColor & | getDiffuse (SoState *state, int index) |
get() methods get value from Inventor state. | |
static float | getTransparency (SoState *, int index) |
static const uint32_t * | getPackedColors (SoState *) |
static const SbColor & | getAmbient (SoState *) |
static const SbColor & | getEmissive (SoState *) |
static const SbColor & | getSpecular (SoState *) |
static float | getShininess (SoState *) |
static bool | getColorMaterial (SoState *) |
static bool | getBlending (SoState *) |
static int32_t | getLightModel (SoState *) |
static SoLazyElement * | getInstance (SoState *state) |
Returns the top (current) instance of the element in the state Note that the cache dependencies associated with this element are managed differently from other elements: this replaces the SoElement::getConstElement that is used by standard elements, but which causes cache dependency. | |
static SbColor | getDefaultDiffuse () |
Specify inventor defaults for colors, etc. | |
static SbColor | getDefaultAmbient () |
static SbColor | getDefaultSpecular () |
static SbColor | getDefaultEmissive () |
static float | getDefaultShininess () |
static uint32_t | getDefaultPacked () |
static float | getDefaultTransparency () |
static int32_t | getDefaultLightModel () |
static void | setMaterials (SoState *state, SoNode *node, uint32_t bitmask, SoColorPacker *cPacker, const SoMFColor &diffuse, const SoMFFloat &transp, const SoMFColor &ambient, const SoMFColor &emissive, const SoMFColor &specular, const SoMFFloat &shininess) |
set method for use in SoMaterial nodes: | |
static SoLazyElement * | getWInstance (SoState *state) |
Get a Writable instance, so will force a push if needed: | |
static void | initClass () |
Initializes the SoLazyElement class. | |
static void | setTransparencyType (SoState *state, int32_t type) |
set method for transparency type is SoINTERNAL, because it should only be invoked by SoGLRenderAction | |
static void | setDrawElementsCallback (SoState *state, SoDrawElementsCallback *cb, void *userData) |
Set a callback for drawElements(). | |
static void | setUseVertexAttributes (SoState *state, bool flag) |
Sets if vertex attributes should be used instead of old style glVertexPointer/glNormalPointer etc. | |
static bool | shouldUseVertexAttributes (SoState *state) |
Returns if vertex attributes should be used instead of old style glVertexPointer/glNormalPointer etc. | |
static void | setDrawArraysCallback (SoState *state, SoDrawArraysCallback *cb, void *userData) |
Set a callback for drawElements(). | |
static void | drawArrays (SoState *state, GLenum mode, GLint first, GLsizei count) |
Draws the given data using glDrawArrays() or via a callback if one has been set. | |
static void | drawElements (SoState *state, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) |
Draws the given data using glDrawElements() or via a callback if one has been set. | |
Static Public Member Functions inherited from SoElement | |
static SoType | getClassTypeId () |
Returns type identifier for SoElement class. | |
static void | initElements () |
Initialize ALL Inventor element classes. | |
static void | initClass () |
Initializes the SoElement class. | |
static int | getNumStackIndices () |
Returns the number of stack indices allocated. | |
static SoType | getIdFromStackIndex (int stackIndex) |
Returns the id for the element with the given stack index. | |
Protected Member Functions | |
virtual void | registerRedundantSet (SoState *, uint32_t) |
method to tell the cache that a redundant set was issued. | |
virtual void | registerGetDependence (SoState *, uint32_t) |
method to register dependence due to get(). | |
virtual | ~SoLazyElement () |
Protected Member Functions inherited from SoElement | |
SoElement () | |
Constructor; use typeId.createInstance to create elements. | |
void | capture (SoState *state) const |
Does whatever is necessary in state to capture this element for caching purposes. | |
virtual void | captureThis (SoState *state) const |
Really captures this element, once it has been determined that a cache is open to capture it. | |
void | setTypeId (SoType id) |
Sets typeId in instance. | |
void | setStackIndex (int index) |
Sets stackIndex in instance. | |
SoElement * | getNextInStack () const |
Returns next instance in specific element stack. | |
SoElement * | getNextFree () const |
Returns next free element in a specific element stack. | |
Static Protected Member Functions | |
static int | getNumPatterns () |
Returns number of transparency levels supported with stipple patterns. | |
Static Protected Member Functions inherited from SoElement | |
static SoElement * | getElement (SoState *state, int stackIndex) |
Returns an instance of an element from the stack with the given index in the given state. | |
static const SoElement * | getConstElement (SoState *state, int stackIndex) |
Returns a read-only pointer to the top instance in the given element stack. | |
static int | createStackIndex (SoType id) |
Creates and returns a new stack index. | |
Protected Attributes | |
ivStateStruct | ivState |
uint32_t | invalidBits |
This is more convenient here, but might logically be kept with SoGLLazyElement. | |
Static Protected Attributes | |
static SbColor * | defaultDiffuseColor |
store pointers to the default color, transp so that we can set point to them if no other color or transp has been set. | |
static float * | defaultTransparency |
static uint32_t * | defaultPackedColor |
Static Protected Attributes inherited from SoElement | |
static int | classStackIndex |
Stack index for SoElement class. | |
Also includes: Transparencies GLColorMaterial GLBlendEnablement PolygonStipple Light model Color index
defines used in this element:
Definition at line 99 of file SoLazyElement.h.
enum SoLazyElement::cases |
Masks are needed by SoEXTENDER apps that need to use SoGLLazyElement::reset(bitmask) to invalidate GL values of particular components. NOTE: the order of these cases should not be changed without careful consideration of dependencies in the reallySend method.
Enumerator | |
---|---|
LIGHT_MODEL_CASE | |
COLOR_MATERIAL_CASE | |
DIFFUSE_CASE | |
AMBIENT_CASE | |
EMISSIVE_CASE | |
SPECULAR_CASE | |
SHININESS_CASE | |
BLENDING_CASE | |
TRANSPARENCY_CASE |
Definition at line 110 of file SoLazyElement.h.
Enumerator | |
---|---|
OTHER_COLOR_MASK | |
ALL_COLOR_MASK | |
NO_COLOR_MASK | |
ALL_BUT_DIFFUSE_MASK | |
DIFFUSE_ONLY_MASK |
Definition at line 292 of file SoLazyElement.h.
Enumerator | |
---|---|
BASE_COLOR | |
PHONG |
Definition at line 135 of file SoLazyElement.h.
enum SoLazyElement::masks |
Enumerator | |
---|---|
LIGHT_MODEL_MASK | |
COLOR_MATERIAL_MASK | |
DIFFUSE_MASK | |
AMBIENT_MASK | |
EMISSIVE_MASK | |
SPECULAR_MASK | |
SHININESS_MASK | |
TRANSPARENCY_MASK | |
BLENDING_MASK | |
ALL_MASK |
Definition at line 121 of file SoLazyElement.h.
Enumerator | |
---|---|
ATTRIB_VERTEX | |
ATTRIB_NORMAL | |
ATTRIB_COLOR | |
ATTRIB_TEXCOORD |
Definition at line 270 of file SoLazyElement.h.
|
protectedvirtual |
|
virtual |
Implements SoElement.
Reimplemented in SoGLLazyElement.
|
static |
|
static |
Referenced by SoAmbientColorElement::get().
|
static |
|
static |
|
inlinestatic |
Definition at line 204 of file SoLazyElement.h.
Referenced by SoAmbientColorElement::getDefault().
|
inlinestatic |
Definition at line 202 of file SoLazyElement.h.
|
inlinestatic |
Definition at line 208 of file SoLazyElement.h.
Referenced by SoEmissiveColorElement::getDefault().
|
inlinestatic |
Definition at line 216 of file SoLazyElement.h.
Referenced by SoLightModelElement::getDefault().
|
inlinestatic |
Definition at line 212 of file SoLazyElement.h.
|
inlinestatic |
Definition at line 210 of file SoLazyElement.h.
Referenced by SoShininessElement::getDefault().
|
inlinestatic |
Definition at line 206 of file SoLazyElement.h.
Referenced by SoSpecularColorElement::getDefault().
|
inlinestatic |
Definition at line 214 of file SoLazyElement.h.
The public methods are static, they get an instance of the element. If there is a cache, the appropriate virtual registerGetDependence is called.
|
inline |
Definition at line 256 of file SoLazyElement.h.
Referenced by SoEmissiveColorElement::get().
|
inlinestatic |
Note that this element is not const; however modifications to it can cause problems. SoEXTENDER apps should use only SoEXTENDER methods on this element.
Definition at line 197 of file SoLazyElement.h.
References SoState::getElementNoPush().
Referenced by SoGLLazyElement::sendAllMaterial(), SoGLLazyElement::sendNoMaterial(), and SoGLLazyElement::sendOnlyDiffuseColor().
Referenced by SoLightModelElement::get().
|
inline |
Definition at line 178 of file SoLazyElement.h.
|
inlinestaticprotected |
(Add one - solid - that is not included in this number.)
Definition at line 372 of file SoLazyElement.h.
|
inline |
Definition at line 180 of file SoLazyElement.h.
|
inline |
Definition at line 253 of file SoLazyElement.h.
|
static |
Referenced by SoShininessElement::get().
Referenced by SoSpecularColorElement::get().
|
static |
|
inline |
Definition at line 259 of file SoLazyElement.h.
|
inlinestatic |
Definition at line 239 of file SoLazyElement.h.
References SoState::getElement().
|
virtual |
Reimplemented from SoElement.
Reimplemented in SoGLLazyElement.
|
static |
|
inline |
Definition at line 182 of file SoLazyElement.h.
|
inline |
Definition at line 184 of file SoLazyElement.h.
|
virtual |
they are replaced by lazyMatches, copyLazyMatchInfo, on SoGLLazyElement.
Implements SoElement.
Reimplemented in SoGLLazyElement.
|
virtual |
Reimplemented from SoElement.
|
virtual |
Reimplemented from SoElement.
Reimplemented in SoGLLazyElement.
only the GL version does any work
only the GL version does any work.
Referenced by SoAmbientColorElement::set().
|
static |
|
static |
|
static |
|
static |
|
static |
Referenced by SoEmissiveColorElement::set().
Referenced by SoLightModelElement::set().
|
static |
|
static |
When this method is called with flag == true, any further call to setBlending() will have no effect. This can be turned off again with flag == false.
|
static |
|
static |
Referenced by SoShininessElement::set().
Referenced by SoSpecularColorElement::set().
|
static |
|
static |
|
static |
|
staticprotected |
Definition at line 366 of file SoLazyElement.h.
|
staticprotected |
Definition at line 368 of file SoLazyElement.h.
|
staticprotected |
Definition at line 367 of file SoLazyElement.h.
|
protected |
This is a bitmask indicating what components have not been sent to GL.
Definition at line 360 of file SoLazyElement.h.
Referenced by SoGLLazyElement::sendAllMaterial(), SoGLLazyElement::sendNoMaterial(), and SoGLLazyElement::sendOnlyDiffuseColor().
|
protected |
Definition at line 353 of file SoLazyElement.h.
Referenced by SoGLLazyElement::lazyMatches().