51#ifndef _SO_LAZY_ELEMENT
52#define _SO_LAZY_ELEMENT
70#define SO_LAZY_SHINY_THRESHOLD 0.005
75#define SO_LAZY_NUM_COMPONENTS 12
121 LIGHT_MODEL_CASE = 0,
123 COLOR_MATERIAL_CASE = 1,
137 TRANSPARENCY_CASE = 8,
149 LIGHT_MODEL_MASK = 1 << LIGHT_MODEL_CASE,
151 COLOR_MATERIAL_MASK = 1 << COLOR_MATERIAL_CASE,
153 DIFFUSE_MASK = 1 << DIFFUSE_CASE,
155 AMBIENT_MASK = 1 << AMBIENT_CASE,
157 EMISSIVE_MASK = 1 << EMISSIVE_CASE,
159 SPECULAR_MASK = 1 << SPECULAR_CASE,
161 SHININESS_MASK = 1 << SHININESS_CASE,
163 TRANSPARENCY_MASK = 1 << TRANSPARENCY_CASE,
165 BLENDING_MASK = 1 << BLENDING_CASE,
167 SMOOTHING_MASK = 1 << SMOOTHING_CASE,
171 PATTERN_MASK = 1 << PATTERN_CASE,
173 LINE_WIDTH_MASK = 1 << LINE_WIDTH_CASE
208 const uint32_t *colors);
218 const int32_t *indices);
227 { setAmbient(state, node, *color); }SoDEPRECATED
233 { setEmissive(state, node, *color); }SoDEPRECATED
239 { setSpecular(state, node, *color); }
289 return ivState.numDiffuseColors;
295 return ivState.numTransparencies;
301 return (ivState.colorIndices ? ivState.numDiffuseColors : 0);
307 return ivState.packed;
338 return SbColor(0.8F, 0.8F, 0.8F);
344 return SbColor(0.2F, 0.2F, 0.2F);
350 return SbColor(0.0F, 0.0F, 0.0F);
356 return SbColor(0.0F, 0.0F, 0.0F);
407 virtual void commonInit();
425 virtual SoElement* copyMatchInfo()
const;
430 static void setMaterials(
SoState *state,
442 static void setMaterials(
SoState *state,
459 static void initClass();
460 static void exitClass();
466 const uint32_t *getPackedPointer()
const {
467 return ivState.packedColors.empty() ? NULL : &ivState.packedColors[0];
469 const SbColor *getDiffusePointer()
const {
470 return ivState.diffuseColors;
472 const int32_t *getColorIndexPointer()
const {
473 return ivState.colorIndices;
475 const float *getTransparencyPointer()
const {
476 return ivState.transparencies;
479 static void setHasTransparency(
SoState* state,
int hasTransparency );
483 static void setTransparencyType(
SoState *state, int32_t type);
488 static bool shouldSendMaterial(
SoState *state);
496 static void setLineWidth(
SoState *state,
float width);
499 OTHER_COLOR_MASK = AMBIENT_MASK|EMISSIVE_MASK|SPECULAR_MASK|SHININESS_MASK,
500 ALL_COLOR_MASK = OTHER_COLOR_MASK|DIFFUSE_MASK,
501 NO_COLOR_MASK = ALL_MASK & (~ALL_COLOR_MASK),
502 ALL_BUT_DIFFUSE_MASK = ALL_MASK &(~ DIFFUSE_MASK),
503 DIFFUSE_ONLY_MASK = ALL_MASK &(~ OTHER_COLOR_MASK)
508 virtual void registerGetDependence(
SoState *, uint32_t);
517 virtual void registerRedundantSet(
SoState *, uint32_t);
525 , ambientColor(0,0,0)
526 , emissiveColor(0,0,0)
527 , specularColor(0,0,0)
535 , packedTransparent(false)
536 , numDiffuseColors(0)
537 , numTransparencies(0)
542 , cacheLevelSetBits(0)
543 , cacheLevelSendBits(0)
544 , patternStippleNum(0)
550 uint64_t diffuseNodeId;
554 uint64_t transpNodeId;
562 int32_t colorMaterial;
572 int32_t numDiffuseColors;
573 int32_t numTransparencies;
575 const float *transparencies;
576 std::vector<uint32_t> packedColors;
577 std::vector<uint32_t> packedColors2;
578 const int32_t *colorIndices;
580 uint32_t cacheLevelSetBits;
581 uint32_t cacheLevelSendBits;
582 int32_t patternStippleNum;
591 uint32_t invalidBits;
595 static SbColor *defaultDiffuseColor;
596 static float *defaultTransparency;
597 static int32_t *defaultColorIndices;
598 static uint32_t *defaultPackedColor;
602 static int getNumPatterns() {
606 int m_hasTransparency;
610 virtual void setDiffuseElt(
SoNode *,
614 virtual void setPackedElt(
SoNode *,
616 const uint32_t *colors,
618 virtual void setColorIndexElt(
SoNode *,
620 const int32_t *indices);
621 virtual void setTranspElt(
SoNode *,
625 virtual void setPatternFlagElt(
SbBool flag);
626 virtual void setTranspTypeElt(int32_t type);
627 virtual void setAmbientElt(
const SbColor *color);
628 virtual void setEmissiveElt(
const SbColor *color);
629 virtual void setSpecularElt(
const SbColor *color);
630 virtual void setShininessElt(
float value);
631 virtual void setColorMaterialElt(
SbBool value);
632 virtual void setBlendingElt(
SbBool value);
633 virtual void setSmoothingElt(
SbBool value);
634 virtual void setLightModelElt(
SoState *state, int32_t model);
635 virtual void setLineWidthElt(
float lineWidth);
636 virtual void setMaterialElt(
SoNode *,
645 virtual void setMaterialElt(
SoNode *,
static int getClassStackIndex()
Returns the stack id for this element.
#define SO_LAZY_NUM_COMPONENTS
Number of components (subelements) in this element:
#define SO_ELEMENT_HEADER(className)
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
Abstract base class for all state elements.
Manages several properties that need to be lazily tracked for OpenGL.
static float getDefaultLineWidth()
Specify Open Inventor defaults for colors, etc.
static const int32_t * getColorIndices(SoState *state)
static void setPacked(SoState *state, SoNode *node, SoColorPacker *cPacker, int32_t numColors, const uint32_t *colors)
Static set method.
static int32_t getColorIndex(SoState *, int num)
static void setColorMaterial(SoState *state, SoNode *node, SbBool value)
static void setShininess(SoState *state, SoNode *node, float value)
static float getTransparency(SoState *, int index)
get() methods get value from Inventor state.
cases
Following masks and cases define the components of the lazy element.
static const uint32_t * getPackedColors(SoState *state)
int32_t getNumDiffuse() const
Method to inquire about current colors.
static SbColor getDefaultEmissive()
Specify Open Inventor defaults for colors, etc.
static SoDEPRECATED void setEmissive(SoState *state, SoNode *node, const SbColor *color)
static SbColor getDefaultSpecular()
Specify Open Inventor defaults for colors, etc.
static SbColor getDefaultAmbient()
Specify Open Inventor defaults for colors, etc.
static void setEmissive(SoState *state, SoNode *node, const SbColor &color)
static SoLazyElement * getInstance(SoState *state)
Returns the top (current) instance of the element in the state Note that the cache dependencies assoc...
static uint32_t getDefaultPacked()
Specify Open Inventor defaults for colors, etc.
static SoType getClassTypeId()
Returns the type identifier for this class.
static void setSpecular(SoState *state, SoNode *node, const SbColor &color)
static void setLightModel(SoState *state, const int32_t model)
static void setSmoothing(SoState *state, SbBool value)
static SbBool getColorMaterial(SoState *)
static void setColorIndices(SoState *state, SoNode *node, int32_t numIndices, const int32_t *indices)
Static set method.
SbBool isTransparent() const
Method to inquire about current colors.
static void setBlending(SoState *state, SbBool value)
static uint32_t getDefaultPackedInternal()
Specify Open Inventor defaults for colors, etc.
static void setTransparency(SoState *state, SoNode *node, int32_t numTransp, const float *transp, SoColorPacker *cPacker)
Static set method.
static float getDefaultShininess()
Specify Open Inventor defaults for colors, etc.
static SbColor getDiffuse(SoState *state, int index)
get() methods get value from Inventor state.
static SbColor getSpecular(SoState *)
static void setAmbient(SoState *state, SoNode *node, const SbColor &color)
virtual void print(FILE *fp) const
Prints element (for debugging).
static int32_t getDefaultLightModel()
Specify Open Inventor defaults for colors, etc.
SbBool isPacked() const
Method to inquire about current colors.
int32_t getNumColorIndices() const
Method to inquire about current colors.
static float getDefaultAmbientIntensity()
Specify Open Inventor defaults for colors, etc.
virtual void push(SoState *state)
push (for non-GL elements)
static SbBool getSmoothing(SoState *)
static SbColor getAmbient(SoState *)
static void setDiffuse(SoState *state, SoNode *node, int32_t numColors, const SbColor *colors, SoColorPacker *cPacker)
Static set method.
static SbBool getBlending(SoState *)
static int32_t getDefaultColorIndex()
Specify Open Inventor defaults for colors, etc.
static SbColor getEmissive(SoState *)
static float getDefaultTransparency()
Specify Open Inventor defaults for colors, etc.
static SoDEPRECATED void setAmbient(SoState *state, SoNode *node, const SbColor *color)
int32_t getNumTransparencies() const
Method to inquire about current colors.
static int32_t getLightModel(SoState *)
static SoDEPRECATED void setSpecular(SoState *state, SoNode *node, const SbColor *color)
static SbColor getDefaultDiffuse()
Specify Open Inventor defaults for colors, etc.
static float getShininess(SoState *)
@ PER_VERTEX_PHONG
Per-vertex Phong lighting.
Multiple-value field containing any number of RGB colors stored as three floats.
Multiple-value field containing any number of floating point values.
Abstract base class for all database nodes.
T * getElement()
Returns a writable instance of the element on the top of the stack with the given type.