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/STL/vector>
00056
00057 #ifdef _MSC_VER
00058 #pragma warning( push )
00059 #pragma warning(disable:4251)
00060 #endif
00061
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
00103 virtual void pop(SoState *state, const SoElement *prevTopElement);
00104
00108 static const SoShapeStyleElement * get(SoState *state);
00109
00113 SbBool mightNotRender() const { return m_delayFlags; }
00114
00118 SbBool needNormals() const { return m_needNorms; }
00119
00123 SbBool needTangents() const
00124 {
00125 return m_needTangs;
00126 }
00127
00131 SbBool needTexCoords(int unit=0) const;
00132
00136 SbBool needTexCoords3(int unit=0) const;
00137
00144 int getRenderCaseMask() const
00145 { return m_renderCaseMask; }
00146
00150 static void setDrawStyle(SoState *state, int32_t value);
00154 static void setComplexityType(SoState *state, int32_t value);
00158 static void setTransparencyType(SoState *state, int32_t value);
00162 static void setTextureEnabled(SoState *state, SbBool value, int unit=0);
00166 static void setTexture3Enabled(SoState *state, SbBool value, int unit=0);
00170 static void setTextureFunction(SoState *state, SbBool value, int unit=0);
00174 static void setLightModel(SoState *state, int32_t value);
00179 static void setOverrides(SoState *state, SbBool value);
00180
00182 virtual void print(FILE *fp) const;
00183
00184 private:
00185
00187 virtual void commonInit();
00188
00190 virtual void init(SoState *state);
00191
00193 virtual SbBool matches(const SoElement* elt) const;
00194
00196 virtual SoElement* copyMatchInfo() const;
00197
00198 private:
00199 SbBool isTextureFunction(int unit=0) const
00200 {return (getTextureData(unit).texFunc);}
00201
00202 static void initClass();
00203
00204 static void exitClass();
00205
00206 private:
00207
00208 virtual ~SoShapeStyleElement();
00209
00210 private:
00211 int m_delayFlags;
00212 SbBool m_needNorms;
00213 SbBool m_needTangs;
00214
00215
00216 struct SoTextureData {
00217 bool texEnabled ;
00218 bool tex3Enabled ;
00219 bool texFunc ;
00220
00221
00222 SoTextureData()
00223 {
00224 texEnabled = tex3Enabled = texFunc = false;
00225 }
00226
00227
00228 friend int operator ==(const SoTextureData &texData1, const SoTextureData &texData2)
00229 {
00230 return (texData1.texEnabled == texData2.texEnabled &&
00231 texData1.tex3Enabled == texData2.tex3Enabled &&
00232 texData1.texFunc == texData2.texFunc) ;
00233 }
00234
00235
00236 friend int operator !=(const SoTextureData &texData1, const SoTextureData &texData2)
00237 { return !(texData1 == texData2) ; }
00238 } ;
00239
00240
00241 SoTextureData& getTextureData( const int unit ) const;
00242 typedef std::vector<SoTextureData> SoTexDataList;
00243 mutable SoTexDataList m_texDataList;
00244
00245 int m_renderCaseMask;
00246 };
00247
00248 #ifdef _MSC_VER
00249 #pragma warning( pop )
00250 #endif
00251
00252 #endif
00253
00254
00255