25#ifndef _SO_MATERIAL_ELEMENT
26#define _SO_MATERIAL_ELEMENT
107 const float *transp);
115 const uint32_t *colors);
126 const int32_t *indices);
175 return m_materialProperties.numDiffuseColors;
186 return (m_materialProperties.colorIndices ? m_materialProperties.numDiffuseColors : 0);
205 return SbColor(0.8F, 0.8F, 0.8F);
211 return SbColor(0.2F, 0.2F, 0.2F);
217 return SbColor(0.0F, 0.0F, 0.0F);
223 return SbColor(0.0F, 0.0F, 0.0F);
252 virtual void commonInit();
270 virtual SoElement* copyMatchInfo()
const;
275 static void setMaterials(
SoState *state,
286 virtual void print(FILE *fp)
const;
289 static void initClass();
290 static void exitClass();
293 const SbColor* getDiffusePointer()
const;
295 static const int32_t* getColorIndexPointer(
SoState* state );
296 static const float* getTransparencyPointer(
SoState* state );
297 const float* getTransparencyPointer()
const;
299 static void setHasTransparency(
SoState* state,
SoNode* node,
int hasTransparency );
310 bool isPacked()
const
312 return m_materialProperties.packedColors.ptr() !=
nullptr;
324 memset(
this, 0,
sizeof(Material));
325 dirtyPackedColor =
true;
326 packedColorExplicitelySet =
false;
330 const float *transparencies;
331 const int32_t *colorIndices;
337 int32_t colorMaterial;
339 int32_t numDiffuseColors;
340 int32_t numTransparencies;
343 bool dirtyPackedColor : 1;
345 bool packedColorExplicitelySet : 1;
347 Material m_materialProperties;
353 static SbColor defaultDiffuseColor;
354 static float defaultTransparency;
355 static int32_t defaultColorIndices;
359 int m_hasTransparency;
371 void setDiffuseElt(int32_t numColors,
const SbColor *colors);
372 void setColorIndexElt(int32_t numIndices,
const int32_t *indices);
373 void setTranspElt(int32_t numTrans,
const float *trans);
374 void setAmbientElt(
const SbColor *color);
375 void setEmissiveElt(
const SbColor *color);
376 void setSpecularElt(
const SbColor *color);
377 void setShininessElt(
float value);
378 void setColorMaterialElt(
SbBool value);
383 static const float S_SHINY_THRESHOLD;
#define SoEXTENDER_Documented
#define SO_ELEMENT_HEADER(className)
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Portable mutex c...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> CPU buffer objec...
Abstract base class for all state elements.
Multiple-value field containing any number of RGB colors stored as three floats.
Multiple-value field containing any number of floating point values.
Manages several properties that need to be lazily tracked for rendering.
static SbColor getDefaultEmissive()
Specify Open Inventor defaults for colors, etc.
static size_t getNumDiffuse(SoState *state)
Return number of diffuse colors.
static void setColorMaterial(SoState *state, SoNode *node, SbBool value)
static SbColor getDefaultDiffuse()
Specify Open Inventor defaults for colors, etc.
static void setAmbient(SoState *state, SoNode *node, const SbColor &color)
static size_t getNumColorIndices(SoState *state)
Method to inquire about current colors.
virtual void pop(SoState *state, const SoElement *prevTopElement)
Unref buffer object of the popped element.
static int32_t getColorIndex(SoState *, int num)
static bool isTransparent(SoState *state)
Method to inquire about current colors.
static SoCpuBufferObject * getPackedColors(SoState *state)
Return packed colors if any.
static SbColor getDefaultSpecular()
Specify Open Inventor defaults for colors, etc.
static const SbColor & getAmbient(SoState *)
static void setDiffuse(SoState *state, SoNode *node, int32_t numColors, const SbColor *colors)
Static set method.
static void setEmissive(SoState *state, SoNode *node, const SbColor &color)
static float getDefaultShininess()
Specify Open Inventor defaults for colors, etc.
static SbColor getDefaultAmbient()
Specify Open Inventor defaults for colors, etc.
static SbColor getDiffuse(SoState *state, int index)
get() methods get value from Inventor state.
static void setPacked(SoState *state, SoNode *node, int32_t numColors, const uint32_t *colors)
static void setTransparency(SoState *state, SoNode *node, int32_t numTransp, const float *transp)
Static set method.
int32_t getNumColorIndices() const
Method to inquire about current colors.
static float getDefaultTransparency()
Specify Open Inventor defaults for colors, etc.
@ DIFFUSE_MASK
Diffuse mask.
@ AMBIENT_MASK
Ambient mask.
@ EMISSIVE_MASK
Emissive mask.
@ SPECULAR_MASK
Specular mask.
@ TRANSPARENCY_MASK
Transparency mask.
@ COLOR_MATERIAL_MASK
Color mask.
@ SHININESS_MASK
Shininess mask.
static float getTransparency(SoState *, int index)
get() methods get value from Inventor state.
static SbBool getColorMaterial(SoState *)
static const int32_t * getColorIndices(SoState *state)
virtual void push(SoState *state)
Copy current material into the pushed element.
static const SbColor & getEmissive(SoState *)
static void setColorIndices(SoState *state, SoNode *node, int32_t numIndices, const int32_t *indices)
Static set method.
static void setShininess(SoState *state, SoNode *node, float value)
static int32_t getDefaultColorIndex()
Specify Open Inventor defaults for colors, etc.
int32_t getNumDiffuse() const
Method to inquire about current colors.
static const SbColor & getSpecular(SoState *)
static int32_t getNumTransparencies(SoState *state)
Method to inquire about current colors.
static float getDefaultAmbientIntensity()
Specify Open Inventor defaults for colors, etc.
static void setSpecular(SoState *state, SoNode *node, const SbColor &color)
static float getShininess(SoState *)
Abstract base class for all database nodes.
Smart pointer for any class inheriting SoRefCounter.
Abstract base class for each state element whose value is replaced whenever it is set.