25#ifndef _SO_MATERIAL_ELEMENT
26#define _SO_MATERIAL_ELEMENT
28#include <Inventor/SbBasic.h>
29#include <Inventor/SbColor.h>
30#include <Inventor/elements/SoReplacedElement.h>
31#include <Inventor/elements/SoSubElement.h>
32#include <Inventor/devices/SoCpuBufferObject.h>
105 const uint32_t *colors);
116 const int32_t *indices);
176 return m_materialProperties.numDiffuseColors;
187 return (m_materialProperties.colorIndices ? m_materialProperties.numDiffuseColors : 0);
206 return SbColor(0.8F, 0.8F, 0.8F);
212 return SbColor(0.2F, 0.2F, 0.2F);
218 return SbColor(0.0F, 0.0F, 0.0F);
224 return SbColor(0.0F, 0.0F, 0.0F);
271 virtual void commonInit();
274 virtual void init(
SoState *state);
289 virtual SoElement* copyMatchInfo()
const;
294 static void setMaterials(
SoState *state,
305 virtual void print(FILE *fp)
const;
308 static void initClass();
309 static void exitClass();
312 const SbColor* getDiffusePointer()
const;
314 static const int32_t* getColorIndexPointer(
SoState* state );
315 static const float* getTransparencyPointer(
SoState* state );
316 const float* getTransparencyPointer()
const;
318 static void setHasTransparency(
SoState* state,
SoNode* node,
int hasTransparency );
335 bool isPacked()
const
337 return m_materialProperties.packedColors.ptr() !=
nullptr;
349 memset(
this, 0,
sizeof(Material));
350 dirtyPackedColor =
true;
351 packedColorExplicitelySet =
false;
355 const float *transparencies;
356 const int32_t *colorIndices;
362 int32_t colorMaterial;
365 float specularFactor;
369 int32_t numDiffuseColors;
370 int32_t numTransparencies;
373 bool dirtyPackedColor : 1;
375 bool packedColorExplicitelySet : 1;
377 Material m_materialProperties;
383 static SbColor defaultDiffuseColor;
384 static float defaultTransparency;
385 static int32_t defaultColorIndices;
389 int m_hasTransparency;
401 void setDiffuseElt(int32_t numColors,
const SbColor *colors);
402 void setColorIndexElt(int32_t numIndices,
const int32_t *indices);
403 void setTranspElt(int32_t numTrans,
const float *trans);
404 void setAmbientElt(
const SbColor *color);
405 void setEmissiveElt(
const SbColor *color);
406 void setSpecularElt(
const SbColor *color);
407 void setShininessElt(
float value);
408 void setColorMaterialElt(
SbBool value);
414 void setSpecularFactorElt(
float value);
415 void setRoughnessElt(
float value);
416 void setMetallicElt(
float value);
418 static const float S_SHINY_THRESHOLD;
<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.
Store in the state the material properties set by some property nodes.
static SbColor getDefaultEmissive()
Specify Open Inventor defaults for colors, etc.
static size_t getNumDiffuse(SoState *state)
Return number of diffuse colors.
static float getDefaultSpecularFactor()
static float getRoughness(SoState *state)
static float getDefaultRoughness()
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 void setSpecularFactor(SoState *state, SoNode *node, float value)
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 float getMetallic(SoState *state)
static float getDefaultMetallic()
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 float getSpecularFactor(SoState *state)
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 void setRoughness(SoState *state, SoNode *node, float value)
static float getDefaultAmbientIntensity()
Specify Open Inventor defaults for colors, etc.
static void setSpecular(SoState *state, SoNode *node, const SbColor &color)
static void setMetallic(SoState *state, SoNode *node, float value)
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.