Open Inventor Reference
|
Element that manages the GL state for the SoLazyElement. More...
#include <Inventor/elements/SoGLLazyElement.h>
Classes | |
struct | GLLazyState |
provide a public typedef for GLLazyState, so that GLRenderCache can use it: More... | |
Public Member Functions | |
virtual void | init (SoState *state) |
Initializes element. | |
virtual void | push (SoState *state) |
Override push() and pop() methods to maintain GL state. | |
virtual void | pop (SoState *state, const SoElement *prevTopElement) |
void | sendDiffuseByIndex (int index) const |
Send diffuse color and transparency, by index Included for compatibility with SoMaterialBundle To be used by a shape to send additional colors after first send() Should NEVER be the first send of a shape! | |
void | reset (SoState *state, uint32_t bitmask) const |
Destroy knowledge of GL state. | |
void | send (const SoState *state, uint32_t mask) const |
Sends indicated component(s) to GL: Only sends if value is not already in GL. | |
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. | |
bool | lazyMatches (uint32_t checkGLFlag, uint32_t checkIVFlag, const SoGLLazyElement *eltInState) |
Replace matches() for this element: matches "this" element GL or IV state with values in eltInState. | |
SoGLLazyElement * | copyLazyMatchInfo (SoState *state) |
Replaces copyMatchInfo for this element: makes a GLLazyElement with some initialization. | |
void | getCopyGL (SoGLLazyElement *cacheLazyElement, SoGLLazyElement::GLLazyState &cacheGLState) |
method that makes a copy of GL state at cache close(). | |
void | copyBackGL (SoGLLazyElement *cacheLazyElement, SoGLLazyElement::GLLazyState &cacheGLState) |
method that copies GL state back into "this" element after cache has been called. | |
void | sendVPPacked (SoState *state, const unsigned char *pcolor) |
Send a packed color (not in state). | |
virtual | ~SoGLLazyElement () |
Note: destructor is public, so cache can delete its copy. | |
void | mergeCacheInfo (SoGLRenderCache *childCache, SoGLRenderCache *parentCache, uint32_t doSendFlag, uint32_t checkIVFlag, uint32_t checkGLFlag) |
void | updateColorVBO (SoState *state, SoVBO *vbo) |
Update the passed VBO with the packed colors if the diffuse/transparency node ids do not match. | |
Public Member Functions inherited from SoLazyElement | |
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 | sendAllMaterial (SoState *state) |
Static sends, always send top-of-stack. Intended for extender use. | |
static void | sendNoMaterial (SoState *state) |
static void | sendOnlyDiffuseColor (SoState *state) |
static SoGLLazyElement * | getInstance (const SoState *state) |
Return the top (current) instance of the element in the state Note it does NOT cause cache dependency! It also casts away the const. | |
static void | initClass () |
Initializes the SoGLLazyElement class. | |
Static Public Member Functions inherited from SoLazyElement | |
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. | |
Additional Inherited Members | |
Public Types inherited from SoLazyElement | |
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) } |
Protected Member Functions inherited from SoLazyElement | |
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 inherited from SoLazyElement | |
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 inherited from SoLazyElement | |
ivStateStruct | ivState |
uint32_t | invalidBits |
This is more convenient here, but might logically be kept with SoGLLazyElement. | |
Static Protected Attributes inherited from SoLazyElement | |
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. | |
Note that this class relies on SoLazyElement to store the inventor color(s), etc. in the instance. This element keeps GL shadow copies of colors
Definition at line 76 of file SoGLLazyElement.h.
|
virtual |
|
inline |
only copies if bit in bitmask is set. also sets invalidBits to FALSE for these components.
Definition at line 178 of file SoGLLazyElement.h.
SoGLLazyElement * SoGLLazyElement::copyLazyMatchInfo | ( | SoState * | state | ) |
also initializes cacheSetBits to zero.
|
inlinevirtual |
Reimplemented from SoLazyElement.
Definition at line 136 of file SoGLLazyElement.h.
void SoGLLazyElement::getCopyGL | ( | SoGLLazyElement * | cacheLazyElement, |
SoGLLazyElement::GLLazyState & | cacheGLState | ||
) |
goes from state="this" to cacheGLState only copies if bitmask (GLSend of cache lazy element) is set.
|
inlinestatic |
|
virtual |
Reimplemented from SoLazyElement.
|
static |
|
inline |
Definition at line 141 of file SoGLLazyElement.h.
References SoLazyElement::ivState, SoLazyElement::ivStateStruct::transpType, and TRUE.
|
inlinevirtual |
they are replaced by lazyMatches, copyLazyMatchInfo
Reimplemented from SoLazyElement.
Definition at line 134 of file SoGLLazyElement.h.
References FALSE.
void SoGLLazyElement::mergeCacheInfo | ( | SoGLRenderCache * | childCache, |
SoGLRenderCache * | parentCache, | ||
uint32_t | doSendFlag, | ||
uint32_t | checkIVFlag, | ||
uint32_t | checkGLFlag | ||
) |
Reimplemented from SoElement.
|
virtual |
Reimplemented from SoLazyElement.
note: has side effects, cannot really be const. however will not necessarily cause cache dependency.
Definition at line 128 of file SoGLLazyElement.h.
References SoState::isCacheOpen().
|
inlinestatic |
Definition at line 89 of file SoGLLazyElement.h.
References SoLazyElement::getInstance(), SoLazyElement::invalidBits, and SoState::isCacheOpen().
void SoGLLazyElement::sendDiffuseByIndex | ( | int | index | ) | const |
|
inlinestatic |
Definition at line 94 of file SoGLLazyElement.h.
References SoLazyElement::getInstance(), SoLazyElement::invalidBits, and SoState::isCacheOpen().
|
inlinestatic |
Definition at line 99 of file SoGLLazyElement.h.
References SoLazyElement::getInstance(), SoLazyElement::invalidBits, and SoState::isCacheOpen().
void SoGLLazyElement::sendVPPacked | ( | SoState * | state, |
const unsigned char * | pcolor | ||
) |
Send transparency as stipple if necessary.