00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef _SO_OVERRIDE_ELEMENT
00052 #define _SO_OVERRIDE_ELEMENT
00053
00054 #include <Inventor/elements/SoSubElement.h>
00055 #include <Inventor/STL/bitset>
00056
00057
00058
00059
00060
00061 #define SO_GET_OVERRIDE(flag) \
00062 const SoOverrideElement *elt; \
00063 elt = SoElement::getConstElement<SoOverrideElement>(state); \
00064 return (elt->m_flags.test(flag));
00065
00066
00067
00068
00069 #define SO_SET_OVERRIDE(flag) \
00070 SoOverrideElement *elt; \
00071 elt = SoElement::getElement<SoOverrideElement>(state); \
00072 if (override) \
00073 elt->m_flags.set(flag); \
00074 else \
00075 elt->m_flags.reset(flag);
00076
00092 SoEXTENDER_Documented class SoOverrideElement : public SoElement {
00093
00094 SO_ELEMENT_HEADER(SoOverrideElement);
00095
00096 public:
00097
00102 virtual void push(SoState *state);
00103
00104
00105
00106
00107
00111 static SbBool getAmbientColorOverride(SoState *state)
00112 { SO_GET_OVERRIDE(AMBIENT_COLOR); }
00113
00117 static SbBool getColorIndexOverride(SoState *state)
00118 { SO_GET_OVERRIDE(COLOR_INDEX); }
00119
00123 static SbBool getComplexityOverride(SoState *state)
00124 { SO_GET_OVERRIDE(COMPLEXITY); }
00125
00129 static SbBool getComplexityTypeOverride(SoState *state)
00130 { SO_GET_OVERRIDE(COMPLEXITY_TYPE); }
00131
00135 static SbBool getCreaseAngleOverride(SoState *state)
00136 { SO_GET_OVERRIDE(CREASE_ANGLE); }
00137
00141 static SbBool getNeighborToleranceOverride(SoState *state)
00142 { SO_GET_OVERRIDE(NEIGHBOR_TOLERANCE); }
00143
00147 static SbBool getDiffuseColorOverride(SoState *state)
00148 { SO_GET_OVERRIDE(DIFFUSE_COLOR); }
00149
00153 static SbBool getDrawStyleOverride(SoState *state)
00154 { SO_GET_OVERRIDE(DRAW_STYLE); }
00155
00159 static SbBool getEmissiveColorOverride(SoState *state)
00160 { SO_GET_OVERRIDE(EMISSIVE_COLOR); }
00161
00165 static SbBool getFontNameOverride(SoState *state)
00166 { SO_GET_OVERRIDE(FONT_NAME); }
00167
00171 static SbBool getFontSizeOverride(SoState *state)
00172 { SO_GET_OVERRIDE(FONT_SIZE); }
00173
00177 static SbBool getFontRenderStyleOverride(SoState *state)
00178 { SO_GET_OVERRIDE(FONT_RENDERSTYLE); }
00179
00183 static SbBool getLightModelOverride(SoState *state)
00184 { SO_GET_OVERRIDE(LIGHT_MODEL); }
00185
00189 static SbBool getLinePatternOverride(SoState *state)
00190 { SO_GET_OVERRIDE(LINE_PATTERN); }
00191
00195 static SbBool getLineWidthOverride(SoState *state)
00196 { SO_GET_OVERRIDE(LINE_WIDTH); }
00197
00201 static SbBool getMaterialBindingOverride(SoState *state)
00202 { SO_GET_OVERRIDE(MATERIAL_BINDING); }
00203
00207 static SbBool getPointSizeOverride(SoState *state)
00208 { SO_GET_OVERRIDE(POINT_SIZE); }
00209
00213 static SbBool getPickStyleOverride(SoState *state)
00214 { SO_GET_OVERRIDE(PICK_STYLE); }
00215
00219 static SbBool getShapeHintsOverride(SoState *state)
00220 { SO_GET_OVERRIDE(SHAPE_HINTS); }
00221
00225 static SbBool getShininessOverride(SoState *state)
00226 { SO_GET_OVERRIDE(SHININESS); }
00227
00231 static SbBool getSpecularColorOverride(SoState *state)
00232 { SO_GET_OVERRIDE(SPECULAR_COLOR); }
00233
00237 static SbBool getTransparencyOverride(SoState *state)
00238 { SO_GET_OVERRIDE(TRANSPARENCY); }
00239
00243 static SbBool getTransparencyTypeOverride(SoState *state)
00244 { SO_GET_OVERRIDE(TRANSPARENCY_TYPE); }
00245
00249 static SbBool getEnvironmentOverride(SoState *state)
00250 { SO_GET_OVERRIDE(ENVIRONMENT); }
00251
00255 static SbBool getPolygonOffsetOverride(SoState *state)
00256 { SO_GET_OVERRIDE(POLYGON_OFFSET); }
00257
00261 static SbBool getPatternOverride(SoState* state)
00262 { SO_GET_OVERRIDE(PATTERN_OFFSET); }
00263
00267 static SbBool getFullSceneAntialiasingOverride(SoState *state)
00268 { SO_GET_OVERRIDE(FULL_SCENE_ANTIALIASING); }
00269
00273 static SbBool getDepthBufferRangeOverride(SoState *state)
00274 { SO_GET_OVERRIDE(DEPTH_BUFFER_RANGE); }
00275
00279 static SbBool getDepthBufferFunctionOverride(SoState *state)
00280 { SO_GET_OVERRIDE(DEPTH_BUFFER_FUNCTION); }
00281
00285 static SbBool getBBoxTypeOverride(SoState *state)
00286 { SO_GET_OVERRIDE(BBOX_TYPE); }
00287
00288
00289
00290
00291
00292
00296 static void setAmbientColorOverride(SoState *state, SoNode *, SbBool override)
00297 { SO_SET_OVERRIDE(AMBIENT_COLOR); }
00298
00302 static void setColorIndexOverride(SoState *state, SoNode *, SbBool override)
00303 { SO_SET_OVERRIDE(COLOR_INDEX); }
00304
00308 static void setComplexityOverride(SoState *state, SoNode *, SbBool override)
00309 { SO_SET_OVERRIDE(COMPLEXITY); }
00310
00314 static void setComplexityTypeOverride(SoState *state, SoNode *, SbBool override)
00315 { SO_SET_OVERRIDE(COMPLEXITY_TYPE); }
00316
00320 static void setCreaseAngleOverride(SoState *state, SoNode *, SbBool override)
00321 { SO_SET_OVERRIDE(CREASE_ANGLE); }
00322
00326 static void setNeighborToleranceOverride(SoState *state, SoNode *, SbBool override)
00327 { SO_SET_OVERRIDE(NEIGHBOR_TOLERANCE); }
00328
00332 static void setDiffuseColorOverride(SoState *state, SoNode *, SbBool override);
00333
00337 static void setDrawStyleOverride(SoState *state, SoNode *, SbBool override)
00338 { SO_SET_OVERRIDE(DRAW_STYLE); }
00339
00343 static void setEmissiveColorOverride(SoState *state, SoNode *, SbBool override)
00344 { SO_SET_OVERRIDE(EMISSIVE_COLOR); }
00345
00349 static void setFontNameOverride(SoState *state, SoNode *, SbBool override)
00350 { SO_SET_OVERRIDE(FONT_NAME); }
00351
00355 static void setFontSizeOverride(SoState *state, SoNode *, SbBool override)
00356 { SO_SET_OVERRIDE(FONT_SIZE); }
00357
00361 static void setFontRenderStyleOverride(SoState *state, SoNode *, SbBool override)
00362 { SO_SET_OVERRIDE(FONT_RENDERSTYLE); }
00363
00367 static void setLightModelOverride(SoState *state, SoNode *, SbBool override)
00368 { SO_SET_OVERRIDE(LIGHT_MODEL); }
00369
00373 static void setLinePatternOverride(SoState *state, SoNode *, SbBool override)
00374 { SO_SET_OVERRIDE(LINE_PATTERN); }
00375
00379 static void setLineWidthOverride(SoState *state, SoNode *, SbBool override)
00380 { SO_SET_OVERRIDE(LINE_WIDTH); }
00381
00385 static void setMaterialBindingOverride(SoState *state, SoNode *, SbBool override);
00386
00390 static void setPickStyleOverride(SoState *state, SoNode *, SbBool override)
00391 { SO_SET_OVERRIDE(PICK_STYLE); }
00392
00396 static void setPointSizeOverride(SoState *state, SoNode *, SbBool override)
00397 { SO_SET_OVERRIDE(POINT_SIZE); }
00398
00402 static void setShapeHintsOverride(SoState *state, SoNode *, SbBool override)
00403 { SO_SET_OVERRIDE(SHAPE_HINTS); }
00404
00408 static void setShininessOverride(SoState *state, SoNode *, SbBool override)
00409 { SO_SET_OVERRIDE(SHININESS); }
00410
00414 static void setSpecularColorOverride(SoState *state, SoNode *, SbBool override)
00415 { SO_SET_OVERRIDE(SPECULAR_COLOR); }
00416
00420 static void setTransparencyOverride(SoState *state, SoNode *, SbBool override);
00421
00425 static void setTransparencyTypeOverride(SoState *state, SoNode *, SbBool override)
00426 { SO_SET_OVERRIDE(TRANSPARENCY_TYPE); }
00427
00431 static void setEnvironmentOverride(SoState *state, SoNode *, SbBool override)
00432 { SO_SET_OVERRIDE(ENVIRONMENT); }
00433
00437 static void setPolygonOffsetOverride(SoState *state, SoNode *, SbBool override)
00438 { SO_SET_OVERRIDE(POLYGON_OFFSET); }
00439
00443 static void setPatternOverride(SoState *state, SoNode *, SbBool override)
00444 { SO_SET_OVERRIDE(PATTERN_OFFSET); }
00445
00449 static void setFullSceneAntialiasingOverride(SoState *state, SoNode *, SbBool override)
00450 { SO_SET_OVERRIDE(FULL_SCENE_ANTIALIASING); }
00451
00455 static void setDepthBufferRangeOverride(SoState *state, SoNode *, SbBool override)
00456 { SO_SET_OVERRIDE(DEPTH_BUFFER_RANGE); }
00457
00461 static void setDepthBufferFunctionOverride(SoState *state, SoNode *, SbBool override)
00462 { SO_SET_OVERRIDE(DEPTH_BUFFER_FUNCTION); }
00463
00467 static void setBBoxTypeOverride(SoState *state, SoNode *, SbBool override)
00468 { SO_SET_OVERRIDE(BBOX_TYPE); }
00469
00473 virtual void print(FILE *fp) const;
00474
00475 private:
00476
00478 virtual void init(SoState *state);
00479
00483 virtual SbBool matches(const SoElement* elt) const;
00484
00486 virtual SoElement* copyMatchInfo() const;
00487
00488 private:
00489 enum Defined_Override_Bit {
00490 AMBIENT_COLOR= 0,
00491 COLOR_INDEX,
00492 COMPLEXITY,
00493 COMPLEXITY_TYPE,
00494 CREASE_ANGLE,
00495 DIFFUSE_COLOR,
00496 TRANSPARENCY,
00497 DRAW_STYLE,
00498 EMISSIVE_COLOR,
00499 FONT_NAME,
00500 FONT_SIZE,
00501 LIGHT_MODEL,
00502 LINE_PATTERN,
00503 LINE_WIDTH,
00504 MATERIAL_BINDING,
00505 POINT_SIZE,
00506 PICK_STYLE,
00507 PICK_METHOD,
00508 SHAPE_HINTS,
00509 SHININESS,
00510 SPECULAR_COLOR,
00511 POLYGON_OFFSET,
00512 PATTERN_OFFSET,
00513 FONT_RENDERSTYLE,
00514 FULL_SCENE_ANTIALIASING,
00515 TRANSPARENCY_TYPE,
00516 ENVIRONMENT,
00517 DEPTH_BUFFER_RANGE,
00518 DEPTH_BUFFER_FUNCTION,
00519 BBOX_TYPE,
00520 NEIGHBOR_TOLERANCE,
00521 TEXTPRP_ANTIALIASING_FACTOR,
00522 TEXTPRP_ALIGNEMENT_H,
00523 TEXTPRP_ALIGNEMENT_V,
00524 TEXTPRP_BACKFRAMELINE,
00525 TEXTPRP_ORIENTATION,
00526 TEXTPRP_KERNING,
00527 TEXTPRP_TEXTUREQUALITY,
00528 TEXTPRP_MARGIN,
00529 TEXTPRP_STYLE,
00530 TEXTPRP_STYLECOLORS,
00531 TEXTPRP_STYLECOLORS_USE_CURRENT_MATERIAL,
00532 TEXTPRP_CHARACTER_SPACING,
00533 TEXTPRP_ENABLE_ACCUMULATION,
00534 LAST_OVERRIDE_BIT,
00535 };
00536
00537 typedef std::bitset<LAST_OVERRIDE_BIT> BitSetType;
00538
00539
00540 static void initClass();
00541 static void exitClass();
00542
00543
00544
00545
00546 bool compareWithMask( const SoOverrideElement& in, const BitSetType* testBitMask = NULL ) const;
00547
00548
00549
00550 class BitSetGetter
00551 {
00552 public:
00553 explicit BitSetGetter( SoState* state )
00554 : m_BufferedFlags( SoElement::getConstElement<SoOverrideElement>( state )->m_flags )
00555 {
00556 }
00557
00558 virtual ~BitSetGetter()
00559 {
00560 }
00561
00562
00563 inline bool testBit( int i )
00564 {
00565 return m_BufferedFlags.test(i);
00566 }
00567
00568 private:
00569 BitSetGetter & operator=( const BitSetGetter & ) { return *this; }
00570 const BitSetType& m_BufferedFlags;
00571 };
00572
00573
00574
00575 class BitSetSetter
00576 {
00577 public:
00578 explicit BitSetSetter( SoState* state )
00579 : m_BufferedFlags( SoElement::getElement<SoOverrideElement>( state )->m_flags )
00580 {
00581 }
00582
00583 virtual ~BitSetSetter()
00584 {
00585 }
00586
00587
00588 inline void setBit( size_t i, bool value )
00589 {
00590 m_BufferedFlags.set(i, value);
00591 }
00592
00593 private:
00594 BitSetSetter & operator=( const BitSetSetter & );
00595 BitSetType& m_BufferedFlags;
00596 };
00597
00598 private:
00599
00600 void pFlag(FILE *, int) const;
00601
00602 BitSetType m_flags;
00603
00604 };
00605
00606 #endif
00607
00608