1 #ifndef COIN_SOLAZYELEMENT_H 2 #define COIN_SOLAZYELEMENT_H 36 #include <Inventor/elements/SoElement.h> 37 #include <Inventor/elements/SoSubElement.h> 38 #include <Inventor/SbColor.h> 45 #define SO_LAZY_SHINY_THRESHOLD 0.005f 77 LIGHT_MODEL_MASK = 1 << LIGHT_MODEL_CASE,
78 COLOR_MATERIAL_MASK = 1 << COLOR_MATERIAL_CASE,
79 DIFFUSE_MASK = 1 << DIFFUSE_CASE,
80 AMBIENT_MASK = 1 << AMBIENT_CASE,
81 EMISSIVE_MASK = 1<<EMISSIVE_CASE,
82 SPECULAR_MASK = 1 << SPECULAR_CASE,
83 SHININESS_MASK = 1 << SHININESS_CASE,
84 TRANSPARENCY_MASK = 1 << TRANSPARENCY_CASE,
85 BLENDING_MASK = 1 << BLENDING_CASE,
86 VERTEXORDERING_MASK = 1 << VERTEXORDERING_CASE,
87 TWOSIDE_MASK = 1 << TWOSIDE_CASE,
88 CULLING_MASK = 1 << CULLING_CASE,
89 SHADE_MODEL_MASK = 1 << SHADE_MODEL_CASE,
90 ALPHATEST_MASK = 1 << ALPHATEST_CASE,
91 GLIMAGE_MASK = 1 << GLIMAGE_CASE,
92 ALL_MASK = (1 << LAZYCASES_LAST)-1
96 OTHER_COLOR_MASK = AMBIENT_MASK|EMISSIVE_MASK|SPECULAR_MASK|SHININESS_MASK,
97 ALL_COLOR_MASK = OTHER_COLOR_MASK|DIFFUSE_MASK,
98 NO_COLOR_MASK = ALL_MASK & (~ALL_COLOR_MASK),
99 ALL_BUT_DIFFUSE_MASK = ALL_MASK &(~ DIFFUSE_MASK),
100 DIFFUSE_ONLY_MASK = ALL_MASK &(~ OTHER_COLOR_MASK)
108 enum VertexOrdering {
118 static void setToDefault(
SoState * state);
119 static void setDiffuse(
SoState * state,
SoNode * node, int32_t numcolors,
121 static void setTransparency(
SoState *state,
SoNode *node, int32_t numvalues,
124 int32_t numcolors,
const uint32_t * colors,
125 const SbBool packedtransparency = FALSE);
127 int32_t numindices,
const int32_t *indices);
131 static void setShininess(
SoState *state,
float value);
132 static void setColorMaterial(
SoState *state, SbBool value);
133 static void enableBlending(
SoState *state,
136 static void enableSeparateBlending(
SoState *state,
142 static void disableBlending(
SoState * state);
143 static void setLightModel(
SoState *state,
const int32_t model);
144 static void setVertexOrdering(
SoState * state, VertexOrdering ordering);
145 static void setBackfaceCulling(
SoState * state, SbBool onoff);
146 static void setTwosideLighting(
SoState * state, SbBool onoff);
147 static void setShadeModel(
SoState * state, SbBool flatshading);
148 static void setAlphaTest(
SoState * state,
int func,
float value);
151 static float getTransparency(
SoState*,
int index);
152 static const uint32_t * getPackedColors(
SoState*);
153 static const int32_t * getColorIndices(
SoState*);
154 static int32_t getColorIndex(
SoState*,
int num);
158 static float getShininess(
SoState*);
159 static SbBool getColorMaterial(
SoState*);
160 static SbBool getBlending(
SoState *,
161 int & sfactor,
int & dfactor);
162 static SbBool getAlphaBlending(
SoState *,
163 int & sfactor,
int & dfactor);
165 static int32_t getLightModel(
SoState*);
166 static int getAlphaTest(
SoState * state,
float & value);
167 static SbBool getTwoSidedLighting(
SoState * state);
169 int32_t getNumDiffuse(
void)
const;
170 int32_t getNumTransparencies(
void)
const;
171 int32_t getNumColorIndices(
void)
const;
172 SbBool isPacked(
void)
const;
173 SbBool isTransparent(
void)
const;
175 static float getDefaultAmbientIntensity(
void);
177 static SbColor getDefaultDiffuse(
void);
178 static SbColor getDefaultAmbient(
void);
179 static SbColor getDefaultSpecular(
void);
180 static SbColor getDefaultEmissive(
void);
181 static float getDefaultShininess(
void);
182 static uint32_t getDefaultPacked(
void);
183 static float getDefaultTransparency(
void);
184 static int32_t getDefaultLightModel(
void);
185 static int32_t getDefaultColorIndex(
void);
187 static void setMaterials(
SoState * state,
SoNode *node, uint32_t bitmask,
190 const int numdiffuse,
191 const float * transp,
196 const float shininess,
197 const SbBool istransparent);
201 const uint32_t * getPackedPointer(
void)
const;
202 const SbColor * getDiffusePointer(
void)
const;
203 const int32_t * getColorIndexPointer(
void)
const;
205 const float * getTransparencyPointer(
void)
const;
206 static void setTransparencyType(
SoState * state, int32_t type);
218 int alpha_blend_sfactor;
219 int alpha_blend_dfactor;
221 SbBool packeddiffuse;
225 const uint32_t * packedarray;
226 const float * transparray;
227 const int32_t * colorindexarray;
229 SbBool istransparent;
230 SbUniqueId diffusenodeid;
231 SbUniqueId transpnodeid;
233 VertexOrdering vertexordering;
238 float alphatestvalue;
242 virtual void lazyDidSet(uint32_t mask);
243 virtual void lazyDidntSet(uint32_t mask);
245 virtual void setDiffuseElt(
SoNode*, int32_t numcolors,
247 virtual void setPackedElt(
SoNode * node, int32_t numcolors,
248 const uint32_t * colors,
const SbBool packedtransparency);
249 virtual void setColorIndexElt(
SoNode * node, int32_t numindices,
250 const int32_t * indices);
251 virtual void setTranspElt(
SoNode * node, int32_t numtransp,
254 virtual void setTranspTypeElt(int32_t type);
255 virtual void setAmbientElt(
const SbColor* color);
256 virtual void setEmissiveElt(
const SbColor* color);
257 virtual void setSpecularElt(
const SbColor* color);
258 virtual void setShininessElt(
float value);
259 virtual void setColorMaterialElt(SbBool value);
260 virtual void enableBlendingElt(
int sfactor,
int dfactor,
int alpha_sfactor,
int alpha_dfactor);
261 virtual void disableBlendingElt(
void);
262 virtual void setLightModelElt(
SoState *state, int32_t model);
263 virtual void setMaterialElt(
SoNode * node, uint32_t bitmask,
265 const SbColor * diffuse,
const int numdiffuse,
266 const float * transp,
const int numtransp,
270 const float shininess,
271 const SbBool istransparent);
272 virtual void setVertexOrderingElt(VertexOrdering ordering);
273 virtual void setBackfaceCullingElt(SbBool onoff);
274 virtual void setTwosideLightingElt(SbBool onoff);
275 virtual void setShadeModelElt(SbBool flatshading);
276 virtual void setAlphaTestElt(
int func,
float value);
279 SoLazyElementP * pimpl;
288 uint32_t * getPackedColors(
void)
const {
291 SbBool diffuseMatch(
const SbUniqueId nodeid)
const {
292 return nodeid == this->diffuseid;
294 SbBool transpMatch(
const SbUniqueId nodeid)
const {
295 return nodeid == this->transpid;
297 void setNodeIds(
const SbUniqueId diffuse,
const SbUniqueId transp) {
298 this->diffuseid = diffuse;
299 this->transpid = transp;
301 int32_t getSize(
void)
const {
302 return this->arraysize;
304 void reallocate(
const int32_t size);
306 SbUniqueId getDiffuseId(
void)
const {
307 return this->diffuseid;
309 SbUniqueId getTranspId(
void)
const {
310 return this->transpid;
314 SbUniqueId diffuseid;
319 #endif // !COIN_SOLAZYELEMENT_H The SoMFFloat class is a container for floating point values.
Definition: SoMFFloat.h:39
The SbColor class contains the red, green and blue components which make up a color value...
Definition: SbColor.h:39
The SoMFColor class is a container for SbColor values.
Definition: SoMFColor.h:40
static void initClass(void)
Definition: SoElement.cpp:506
virtual SbBool matches(const SoElement *element) const =0
Definition: SoElement.cpp:608
virtual void push(SoState *state)
Definition: SoElement.cpp:569
The SoNode class is the base class for nodes used in scene graphs.
Definition: SoNode.h:56
SoElement is the abstract base class for all elements.
Definition: SoElement.h:43
The SoState class manages the Coin scenegraph traversal state data.
Definition: SoState.h:44
virtual void init(SoState *state)
Definition: SoElement.cpp:552
Definition: SoLazyElement.h:210
virtual SoElement * copyMatchInfo(void) const =0
Definition: SoLazyElement.h:283
The SoLazyElement class is used to handle material and shape properties.
Definition: SoLazyElement.h:48