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_SHAPE_STYLE_ELEMENT
00052 #define _SO_SHAPE_STYLE_ELEMENT
00053
00054 #include <Inventor/elements/SoInt32Element.h>
00055 #include <Inventor/elements/SoLazyElement.h>
00056 #include <Inventor/STL/vector>
00057
00058 #ifdef _MSC_VER
00059 #pragma warning( push )
00060 #pragma warning(disable:4251)
00061 #endif
00062
00083 SoEXTENDER_Documented class SoShapeStyleElement : public SoElement {
00084
00085 SO_ELEMENT_HEADER(SoShapeStyleElement);
00086
00087 public:
00088
00090 enum flags {
00092 INVISIBLE_BIT = 0x1,
00094 BBOX_BIT = 0x2,
00096 DELAY_TRANSP_BIT = 0x4
00097 };
00098
00100 virtual void push(SoState *state);
00101
00105 static const SoShapeStyleElement * get(SoState *state);
00106
00110 SbBool mightNotRender() const { return m_delayFlags; }
00111
00115 SbBool needNormals() const { return m_needNorms; }
00116
00120 SbBool needTexCoords(int unit=0) const
00121 { return (getTextureData(unit).texEnabled && (!getTextureData(unit).texFunc)); }
00122
00126 SbBool needTexCoords3(int unit=0) const
00127 { return (getTextureData(unit).tex3Enabled && (!getTextureData(unit).texFunc)); }
00128
00135 int getRenderCaseMask() const
00136 { return m_renderCaseMask; }
00137
00141 static void setDrawStyle(SoState *state, int32_t value);
00145 static void setComplexityType(SoState *state, int32_t value);
00149 static void setTransparencyType(SoState *state, int32_t value);
00153 static void setTextureEnabled(SoState *state, SbBool value, int unit=0);
00157 static void setTexture3Enabled(SoState *state, SbBool value, int unit=0);
00161 static void setTextureFunction(SoState *state, SbBool value, int unit=0);
00165 static void setLightModel(SoState *state, int32_t value);
00170 static void setOverrides(SoState *state, SbBool value);
00174 static SbBool isScreenDoor(SoState *state);
00175
00176 private:
00177
00179 virtual void commonInit();
00180
00182 virtual void init(SoState *state);
00183
00185 virtual SbBool matches(const SoElement* elt) const;
00186
00188 virtual SoElement* copyMatchInfo() const;
00189
00190 private:
00191 SbBool isTextureFunction(int unit=0) const
00192 {return (getTextureData(unit).texFunc);}
00193
00194 static void initClass();
00195
00196 static void exitClass();
00197
00198 virtual void print(FILE *fp) const;
00199
00200 private:
00201
00202 virtual ~SoShapeStyleElement();
00203
00204 private:
00205 int m_delayFlags;
00206 SbBool m_needNorms;
00207
00208
00209 struct SoTextureData {
00210 bool texEnabled ;
00211 bool tex3Enabled ;
00212 bool texFunc ;
00213
00214
00215 SoTextureData()
00216 {
00217 texEnabled = tex3Enabled = texFunc = false;
00218 }
00219
00220
00221 friend int operator ==(const SoTextureData &texData1, const SoTextureData &texData2)
00222 {
00223 return (texData1.texEnabled == texData2.texEnabled &&
00224 texData1.tex3Enabled == texData2.tex3Enabled &&
00225 texData1.texFunc == texData2.texFunc) ;
00226 }
00227
00228
00229 friend int operator !=(const SoTextureData &texData1, const SoTextureData &texData2)
00230 { return !(texData1 == texData2) ; }
00231 } ;
00232
00233
00234 SoTextureData& getTextureData( const int unit ) const;
00235 typedef std::vector<SoTextureData> SoTexDataList;
00236 mutable SoTexDataList m_texDataList;
00237
00238 int m_renderCaseMask;
00239 };
00240
00241 #ifdef _MSC_VER
00242 #pragma warning( pop )
00243 #endif
00244
00245 #endif
00246
00247
00248