Open Inventor Reference
SoOverrideElement.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1995-96 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.1.1.1 $
45 |
46 | Description:
47 | This file defines the SoOverrideElement class.
48 |
49 | Author(s) : Roger Chickering, Gavin Bell
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55#ifndef _SO_OVERRIDE_ELEMENT
56#define _SO_OVERRIDE_ELEMENT
57
59
65#define SO_GET_OVERRIDE(flag) \
66 const SoOverrideElement *elt; \
67 elt = (const SoOverrideElement *) \
68 getConstElement(state, classStackIndex); \
69 return (elt->flags & flag) != 0;
70
74#define SO_SET_OVERRIDE(flag) \
75 SoOverrideElement *elt; \
76 elt = (SoOverrideElement *)getElement(state, classStackIndex); \
77 if (override) \
78 elt->flags |= flag; \
79 else \
80 elt->flags &= ~flag;
81
93
95
97
98 enum {
99 AMBIENT_COLOR = 0x1,
100// COLOR_INDEX = 0x2,
101 COMPLEXITY = 0x4,
102 COMPLEXITY_TYPE = 0x8,
103 CREASE_ANGLE = 0x10,
104 DIFFUSE_COLOR = 0x20,
105 TRANSPARENCY = 0x20,
106 DRAW_STYLE = 0x40,
107 EMISSIVE_COLOR = 0x80,
108 FONT_NAME = 0x100,
109 FONT_SIZE = 0x200,
110 LIGHT_MODEL = 0x400,
111 LINE_PATTERN = 0x800,
112 LINE_WIDTH = 0x1000,
113 MATERIAL_BINDING= 0x2000,
114 POINT_SIZE = 0x4000,
115 PICK_STYLE = 0x8000,
116 SHAPE_HINTS = 0x10000,
117 SHININESS = 0x20000,
118 SPECULAR_COLOR = 0x40000,
119 POLYGON_OFFSET = 0x80000
120 };
121
122 public:
124 virtual void init(SoState *state);
125
127 virtual bool matches(const SoElement *elt) const;
128
131 virtual void push(SoState *state);
132
136
139 { SO_GET_OVERRIDE(AMBIENT_COLOR); }
140
142 static bool getComplexityOverride(SoState *state)
143 { SO_GET_OVERRIDE(COMPLEXITY); }
144
147 { SO_GET_OVERRIDE(COMPLEXITY_TYPE); }
148
150 static bool getCreaseAngleOverride(SoState *state)
151 { SO_GET_OVERRIDE(CREASE_ANGLE); }
152
155 { SO_GET_OVERRIDE(DIFFUSE_COLOR); }
156
158 static bool getDrawStyleOverride(SoState *state)
159 { SO_GET_OVERRIDE(DRAW_STYLE); }
160
163 { SO_GET_OVERRIDE(EMISSIVE_COLOR); }
164
166 static bool getFontNameOverride(SoState *state)
167 { SO_GET_OVERRIDE(FONT_NAME); }
168
170 static bool getFontSizeOverride(SoState *state)
171 { SO_GET_OVERRIDE(FONT_SIZE); }
172
174 static bool getLightModelOverride(SoState *state)
175 { SO_GET_OVERRIDE(LIGHT_MODEL); }
176
178 static bool getLinePatternOverride(SoState *state)
179 { SO_GET_OVERRIDE(LINE_PATTERN); }
180
182 static bool getLineWidthOverride(SoState *state)
183 { SO_GET_OVERRIDE(LINE_WIDTH); }
184
187 { SO_GET_OVERRIDE(MATERIAL_BINDING); }
188
190 static bool getPointSizeOverride(SoState *state)
191 { SO_GET_OVERRIDE(POINT_SIZE); }
192
194 static bool getPickStyleOverride(SoState *state)
195 { SO_GET_OVERRIDE(PICK_STYLE); }
196
198 static bool getShapeHintsOverride(SoState *state)
199 { SO_GET_OVERRIDE(SHAPE_HINTS); }
200
202 static bool getShininessOverride(SoState *state)
203 { SO_GET_OVERRIDE(SHININESS); }
204
207 { SO_GET_OVERRIDE(SPECULAR_COLOR); }
208
211 { SO_GET_OVERRIDE(TRANSPARENCY); }
212
215 { SO_GET_OVERRIDE(POLYGON_OFFSET); }
216
220
223 bool override)
224 { SO_SET_OVERRIDE(AMBIENT_COLOR); }
225
227 static void setComplexityOverride(SoState *state, SoNode *,
228 bool override)
229 { SO_SET_OVERRIDE(COMPLEXITY); }
230
233 bool override)
234 { SO_SET_OVERRIDE(COMPLEXITY_TYPE); }
235
237 static void setCreaseAngleOverride(SoState *state, SoNode *,
238 bool override)
239 { SO_SET_OVERRIDE(CREASE_ANGLE); }
240
243 bool override);
244
246 static void setDrawStyleOverride(SoState *state, SoNode *,
247 bool override)
248 { SO_SET_OVERRIDE(DRAW_STYLE); }
249
252 bool override)
253 { SO_SET_OVERRIDE(EMISSIVE_COLOR); }
254
256 static void setFontNameOverride(SoState *state, SoNode *,
257 bool override)
258 { SO_SET_OVERRIDE(FONT_NAME); }
259
261 static void setFontSizeOverride(SoState *state, SoNode *,
262 bool override)
263 { SO_SET_OVERRIDE(FONT_SIZE); }
264
266 static void setLightModelOverride(SoState *state, SoNode *,
267 bool override)
268 { SO_SET_OVERRIDE(LIGHT_MODEL); }
269
271 static void setLinePatternOverride(SoState *state, SoNode *,
272 bool override)
273 { SO_SET_OVERRIDE(LINE_PATTERN); }
274
276 static void setLineWidthOverride(SoState *state, SoNode *,
277 bool override)
278 { SO_SET_OVERRIDE(LINE_WIDTH); }
279
282 bool override);
283
285 static void setPickStyleOverride(SoState *state, SoNode *,
286 bool override)
287 { SO_SET_OVERRIDE(PICK_STYLE); }
288
290 static void setPointSizeOverride(SoState *state, SoNode *,
291 bool override)
292 { SO_SET_OVERRIDE(POINT_SIZE); }
293
295 static void setShapeHintsOverride(SoState *state, SoNode *,
296 bool override)
297 { SO_SET_OVERRIDE(SHAPE_HINTS); }
298
300 static void setShininessOverride(SoState *state, SoNode *,
301 bool override)
302 { SO_SET_OVERRIDE(SHININESS); }
303
306 bool override)
307 { SO_SET_OVERRIDE(SPECULAR_COLOR); }
308
311 bool override);
312
315 bool override)
316 { SO_SET_OVERRIDE(POLYGON_OFFSET); }
317
319 virtual void print(FILE *fp) const;
320
321 SoINTERNAL public:
323 static void initClass();
324
326 virtual SoElement *copyMatchInfo() const;
327
328 private:
330 void pFlag(FILE *, const char *, int) const;
331
332 uint32_t flags;
333};
334
335#endif /* _SO_OVERRIDE_ELEMENT */
336
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition SbBasic.h:154
#define SoINTERNAL
Definition SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
unsigned int uint32_t
Definition SbTypeDefs.h:44
#define SO_GET_OVERRIDE(flag)
Macro to implement get*Override inline methods.
#define SO_SET_OVERRIDE(flag)
Implement set*Override methods.
#define SO_ELEMENT_HEADER(className)
This one is for non-abstract element classes.
This is the abstract base class for all state elements.
Definition SoElement.h:96
Abstract base class for all database nodes.
Definition SoNode.h:103
Element that stores a flag for each type of element which can be overridden.
static bool getDiffuseColorOverride(SoState *state)
Returns TRUE if SoDiffuseColorElement is overridden.
static void setComplexityOverride(SoState *state, SoNode *, bool override)
set override flag for SoComplexityElement.
static void setPointSizeOverride(SoState *state, SoNode *, bool override)
set override flag for SoPointSizeElement.
static bool getFontNameOverride(SoState *state)
Returns TRUE if SoFontNameElement is overridden.
static bool getTransparencyOverride(SoState *state)
Returns TRUE if SoTransparencyElement is overridden.
static bool getComplexityTypeOverride(SoState *state)
Returns TRUE if SoComplexityTypeElement is overridden.
static void setLineWidthOverride(SoState *state, SoNode *, bool override)
set override flag for SoLineWidthElement.
static bool getShapeHintsOverride(SoState *state)
Returns TRUE if SoShapeHintsElement is overridden.
virtual bool matches(const SoElement *elt) const
Comparison based on value of int32_ts.
static bool getEmissiveColorOverride(SoState *state)
Returns TRUE if SoEmissiveColorElement is overridden.
static void setFontSizeOverride(SoState *state, SoNode *, bool override)
set override flag for SoFontSizeElement.
static void initClass()
Initializes the SoOverrideElement class.
static bool getAmbientColorOverride(SoState *state)
"get" methods for each element which can be overridden.
static void setSpecularColorOverride(SoState *state, SoNode *, bool override)
set override flag for SoSpecularColorElement.
static void setLinePatternOverride(SoState *state, SoNode *, bool override)
set override flag for SoLinePatternElement.
static void setAmbientColorOverride(SoState *state, SoNode *, bool override)
"set" methods for each element which can be overridden.
static bool getComplexityOverride(SoState *state)
Returns TRUE if SoComplexityElement is overridden.
static void setTransparencyOverride(SoState *state, SoNode *, bool override)
set override flag for SoTransparencyElement.
static void setFontNameOverride(SoState *state, SoNode *, bool override)
set override flag for SoFontNameElement.
static void setComplexityTypeOverride(SoState *state, SoNode *, bool override)
set override flag for SoComplexityTypeElement.
virtual void init(SoState *state)
Initializes element.
static bool getPickStyleOverride(SoState *state)
Returns TRUE if SoPickStyleElement is overridden.
static void setShininessOverride(SoState *state, SoNode *, bool override)
set override flag for SoShininessElement.
static void setPickStyleOverride(SoState *state, SoNode *, bool override)
set override flag for SoPickStyleElement.
static bool getPointSizeOverride(SoState *state)
Returns TRUE if SoPointSizeElement is overridden.
static void setLightModelOverride(SoState *state, SoNode *, bool override)
set override flag for SoLightModelElement.
static bool getShininessOverride(SoState *state)
Returns TRUE if SoShininessElement is overridden.
virtual void push(SoState *state)
Overrides push() method to copy values from next instance in the stack, and set up cache dependencies...
virtual SoElement * copyMatchInfo() const
Copy method, copies flags.
static void setShapeHintsOverride(SoState *state, SoNode *, bool override)
set override flag for SoShapeHintsElement.
static void setMaterialBindingOverride(SoState *state, SoNode *, bool override)
set override flag for SoMaterialBinding.
static bool getDrawStyleOverride(SoState *state)
Returns TRUE if SoDrawStyleElement is overridden.
static bool getLineWidthOverride(SoState *state)
Returns TRUE if SoLineWidthElement is overridden.
static bool getLightModelOverride(SoState *state)
Returns TRUE if SoLightModelElement is overridden.
static bool getLinePatternOverride(SoState *state)
Returns TRUE if SoLinePatternElement is overridden.
static bool getCreaseAngleOverride(SoState *state)
Returns TRUE if SoCreaseAngleElement is overridden.
static void setPolygonOffsetOverride(SoState *state, SoNode *, bool override)
set override flag for SoPolygonOffsetElement.
static void setDiffuseColorOverride(SoState *state, SoNode *, bool override)
set override flag for SoDiffuseColorElement.
static void setDrawStyleOverride(SoState *state, SoNode *, bool override)
set override flag for SoDrawStyleElement.
static bool getPolygonOffsetOverride(SoState *state)
Returns TRUE if SoPolygonOffsetElement is overridden.
static bool getFontSizeOverride(SoState *state)
Returns TRUE if SoFontSizeElement is overridden.
static bool getMaterialBindingOverride(SoState *state)
Returns TRUE if SoMaterialBindingElement is overridden.
static void setCreaseAngleOverride(SoState *state, SoNode *, bool override)
set override flag for SoCreaseAngleElement.
static bool getSpecularColorOverride(SoState *state)
Returns TRUE if SoSpecularColorElement is overridden.
virtual void print(FILE *fp) const
Prints element (for debugging)
static void setEmissiveColorOverride(SoState *state, SoNode *, bool override)
set override flag for SoEmissiveColorElement.
An SoState collects and holds state while traversing a scene graph.
Definition SoState.h:82