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
00084 SoEXTENDER_Documented class SoShapeStyleElement : public SoElement {
00085
00086 SO_ELEMENT_HEADER(SoShapeStyleElement);
00087
00088 public:
00089
00091 enum flags {
00093 INVISIBLE_BIT = 0x1,
00095 BBOX_BIT = 0x2,
00097 DELAY_TRANSP_BIT = 0x4
00098 };
00099
00101 virtual void push(SoState *state);
00102
00104 virtual void pop(SoState *state, const SoElement *prevTopElement);
00105
00109 static const SoShapeStyleElement * get(SoState *state);
00110
00114 SbBool mightNotRender() const { return m_delayFlags; }
00115
00119 SbBool needNormals() const { return m_needNorms; }
00120
00124 SbBool needTangents() const
00125 {
00126 return m_needTangs;
00127 }
00128
00132 SbBool needTexCoords(int unit=0) const;
00133
00137 SbBool needTexCoords3(int unit=0) const;
00138
00145 int getRenderCaseMask() const
00146 { return m_renderCaseMask; }
00147
00151 static void setDrawStyle(SoState *state, int32_t value);
00155 static void setComplexityType(SoState *state, int32_t value);
00159 static void setTransparencyType(SoState *state, int32_t value);
00163 static void setTextureEnabled(SoState *state, SbBool value, int unit=0);
00167 static void setTexture3Enabled(SoState *state, SbBool value, int unit=0);
00171 static void setTextureFunction(SoState *state, SbBool value, int unit=0);
00175 static void setLightModel(SoState *state, int32_t value);
00180 static void setOverrides(SoState *state, SbBool value);
00181
00183 virtual void print(FILE *fp) const;
00184
00185 private:
00186
00188 virtual void commonInit();
00189
00191 virtual void init(SoState *state);
00192
00194 virtual SbBool matches(const SoElement* elt) const;
00195
00197 virtual SoElement* copyMatchInfo() const;
00198
00199 private:
00200 SbBool isTextureFunction(int unit=0) const
00201 {return (getTextureData(unit).texFunc);}
00202
00203 static void initClass();
00204
00205 static void exitClass();
00206
00207 private:
00208
00209 virtual ~SoShapeStyleElement();
00210
00211 private:
00212 int m_delayFlags;
00213 SbBool m_needNorms;
00214 SbBool m_needTangs;
00215
00216
00217 struct SoTextureData {
00218 bool texEnabled ;
00219 bool tex3Enabled ;
00220 bool texFunc ;
00221
00222
00223 SoTextureData()
00224 {
00225 texEnabled = tex3Enabled = texFunc = false;
00226 }
00227
00228
00229 friend int operator ==(const SoTextureData &texData1, const SoTextureData &texData2)
00230 {
00231 return (texData1.texEnabled == texData2.texEnabled &&
00232 texData1.tex3Enabled == texData2.tex3Enabled &&
00233 texData1.texFunc == texData2.texFunc) ;
00234 }
00235
00236
00237 friend int operator !=(const SoTextureData &texData1, const SoTextureData &texData2)
00238 { return !(texData1 == texData2) ; }
00239 } ;
00240
00241
00242 SoTextureData& getTextureData( const int unit ) const;
00243 typedef std::vector<SoTextureData> SoTexDataList;
00244 mutable SoTexDataList m_texDataList;
00245
00246 int m_renderCaseMask;
00247 };
00248
00249 #ifdef _MSC_VER
00250 #pragma warning( pop )
00251 #endif
00252
00253 #endif
00254
00255
00256