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 | ivStateStructName |
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 | 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 |
int32_t | getNumColorIndices () const |
SbBool | isPacked () const |
SbBool | isTransparent () const |
virtual void | push (SoState *state) |
push (for non-GL elements) | |
virtual SbBool | 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 int32_t * | getColorIndexPointer () const |
const float * | getTransparencyPointer () const |
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 | 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 | setBlending (SoState *state, SbBool value) |
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 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 *) |
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 int32_t | getDefaultColorIndex () |
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 | |
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 () |
Static Protected Member Functions | |
static int | getNumPatterns () |
Returns number of transparency levels supported with stipple patterns. | |
Protected Attributes | |
struct SoLazyElement::ivStateStructName | 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 int32_t * | defaultColorIndices |
static uint32_t * | defaultPackedColor |
Also includes: Transparencies GLColorMaterial GLBlendEnablement PolygonStipple Light model Color index
defines used in this element:
Definition at line 89 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.
LIGHT_MODEL_CASE | |
COLOR_MATERIAL_CASE | |
DIFFUSE_CASE | |
AMBIENT_CASE | |
EMISSIVE_CASE | |
SPECULAR_CASE | |
SHININESS_CASE | |
BLENDING_CASE | |
TRANSPARENCY_CASE |
Definition at line 100 of file SoLazyElement.h.
Definition at line 265 of file SoLazyElement.h.
Definition at line 125 of file SoLazyElement.h.
enum SoLazyElement::masks |
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 111 of file SoLazyElement.h.
virtual SoLazyElement::~SoLazyElement | ( | ) | [protected, virtual] |
virtual SoElement* SoLazyElement::copyMatchInfo | ( | ) | const [virtual] |
Implements SoElement.
Reimplemented in SoGLLazyElement.
Referenced by SoAmbientColorElement::get().
Referenced by SoGLColorIndexElement::get().
const int32_t* SoLazyElement::getColorIndexPointer | ( | ) | const [inline] |
Definition at line 255 of file SoLazyElement.h.
static SbColor SoLazyElement::getDefaultAmbient | ( | ) | [inline, static] |
Definition at line 198 of file SoLazyElement.h.
Referenced by SoAmbientColorElement::getDefault().
static int32_t SoLazyElement::getDefaultColorIndex | ( | ) | [inline, static] |
Definition at line 212 of file SoLazyElement.h.
Referenced by SoGLColorIndexElement::getDefault().
static SbColor SoLazyElement::getDefaultDiffuse | ( | ) | [inline, static] |
Definition at line 196 of file SoLazyElement.h.
static SbColor SoLazyElement::getDefaultEmissive | ( | ) | [inline, static] |
Definition at line 202 of file SoLazyElement.h.
Referenced by SoEmissiveColorElement::getDefault().
static int32_t SoLazyElement::getDefaultLightModel | ( | ) | [inline, static] |
Definition at line 210 of file SoLazyElement.h.
Referenced by SoLightModelElement::getDefault().
static uint32_t SoLazyElement::getDefaultPacked | ( | ) | [inline, static] |
Definition at line 206 of file SoLazyElement.h.
static float SoLazyElement::getDefaultShininess | ( | ) | [inline, static] |
Definition at line 204 of file SoLazyElement.h.
Referenced by SoShininessElement::getDefault().
static SbColor SoLazyElement::getDefaultSpecular | ( | ) | [inline, static] |
Definition at line 200 of file SoLazyElement.h.
Referenced by SoSpecularColorElement::getDefault().
static float SoLazyElement::getDefaultTransparency | ( | ) | [inline, static] |
Definition at line 208 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.
const SbColor* SoLazyElement::getDiffusePointer | ( | ) | const [inline] |
Definition at line 252 of file SoLazyElement.h.
Referenced by SoEmissiveColorElement::get().
static SoLazyElement* SoLazyElement::getInstance | ( | SoState * | state | ) | [inline, static] |
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 191 of file SoLazyElement.h.
References SoState::getElementNoPush().
Referenced by SoGLColorIndexElement::getNum(), SoGLLazyElement::isColorIndex(), SoGLLazyElement::sendAllMaterial(), SoGLLazyElement::sendNoMaterial(), and SoGLLazyElement::sendOnlyDiffuseColor().
Referenced by SoLightModelElement::get().
int32_t SoLazyElement::getNumColorIndices | ( | ) | const [inline] |
Definition at line 172 of file SoLazyElement.h.
int32_t SoLazyElement::getNumDiffuse | ( | ) | const [inline] |
Definition at line 168 of file SoLazyElement.h.
static int SoLazyElement::getNumPatterns | ( | ) | [inline, static, protected] |
(Add one - solid - that is not included in this number.)
Definition at line 341 of file SoLazyElement.h.
int32_t SoLazyElement::getNumTransparencies | ( | ) | const [inline] |
Definition at line 170 of file SoLazyElement.h.
const uint32_t* SoLazyElement::getPackedPointer | ( | ) | const [inline] |
Definition at line 249 of file SoLazyElement.h.
static float SoLazyElement::getShininess | ( | SoState * | ) | [static] |
Referenced by SoShininessElement::get().
Referenced by SoSpecularColorElement::get().
static float SoLazyElement::getTransparency | ( | SoState * | , |
int | index | ||
) | [static] |
const float* SoLazyElement::getTransparencyPointer | ( | ) | const [inline] |
Definition at line 258 of file SoLazyElement.h.
static SoLazyElement* SoLazyElement::getWInstance | ( | SoState * | state | ) | [inline, static] |
Definition at line 235 of file SoLazyElement.h.
References SoState::getElement().
virtual void SoLazyElement::init | ( | SoState * | state | ) | [virtual] |
Reimplemented from SoElement.
Reimplemented in SoGLLazyElement.
static void SoLazyElement::initClass | ( | ) | [static] |
Reimplemented from SoElement.
Reimplemented in SoGLLazyElement.
SbBool SoLazyElement::isPacked | ( | ) | const [inline] |
Definition at line 176 of file SoLazyElement.h.
SbBool SoLazyElement::isTransparent | ( | ) | const [inline] |
Definition at line 178 of file SoLazyElement.h.
they are replaced by lazyMatches, copyLazyMatchInfo, on SoGLLazyElement.
Implements SoElement.
Reimplemented in SoGLLazyElement.
virtual void SoLazyElement::print | ( | FILE * | fp | ) | const [virtual] |
Reimplemented from SoElement.
virtual void SoLazyElement::push | ( | SoState * | state | ) | [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 void SoLazyElement::setColorIndices | ( | SoState * | state, |
SoNode * | node, | ||
int32_t | numIndices, | ||
const int32_t * | indices | ||
) | [static] |
Referenced by SoGLColorIndexElement::set().
static void SoLazyElement::setDiffuse | ( | SoState * | state, |
SoNode * | node, | ||
int32_t | numColors, | ||
const SbColor * | colors, | ||
SoColorPacker * | cPacker | ||
) | [static] |
Referenced by SoEmissiveColorElement::set().
Referenced by SoLightModelElement::set().
static void SoLazyElement::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 | ||
) | [static] |
static void SoLazyElement::setPacked | ( | SoState * | state, |
SoNode * | node, | ||
int32_t | numColors, | ||
const uint32_t * | colors | ||
) | [static] |
static void SoLazyElement::setShininess | ( | SoState * | state, |
float | value | ||
) | [static] |
Referenced by SoShininessElement::set().
Referenced by SoSpecularColorElement::set().
static void SoLazyElement::setTransparency | ( | SoState * | state, |
SoNode * | node, | ||
int32_t | numTransp, | ||
const float * | transp, | ||
SoColorPacker * | cPacker | ||
) | [static] |
int32_t* SoLazyElement::defaultColorIndices [static, protected] |
Definition at line 336 of file SoLazyElement.h.
SbColor* SoLazyElement::defaultDiffuseColor [static, protected] |
Definition at line 334 of file SoLazyElement.h.
uint32_t* SoLazyElement::defaultPackedColor [static, protected] |
Definition at line 337 of file SoLazyElement.h.
float* SoLazyElement::defaultTransparency [static, protected] |
Definition at line 335 of file SoLazyElement.h.
uint32_t SoLazyElement::invalidBits [protected] |
This is a bitmask indicating what components have not been sent to GL.
Definition at line 328 of file SoLazyElement.h.
Referenced by SoGLLazyElement::sendAllMaterial(), SoGLLazyElement::sendNoMaterial(), and SoGLLazyElement::sendOnlyDiffuseColor().
struct SoLazyElement::ivStateStructName SoLazyElement::ivState [protected] |
Referenced by SoGLLazyElement::lazyMatches().