00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _SO_TEXTURE_UNIT_ELEMENT_
00025 #define _SO_TEXTURE_UNIT_ELEMENT_
00026
00027 #include <Inventor/SbPList.h>
00028 #include <Inventor/elements/SoAccumulatedElement.h>
00029
00030 #ifdef _MSC_VER
00031 #pragma warning( push )
00032 #pragma warning(disable:4251)
00033 #endif
00034
00047 SoEXTENDER_Documented class SoTextureUnitElement : public SoAccumulatedElement {
00048 SO_ELEMENT_HEADER(SoTextureUnitElement) ;
00049
00050 public:
00051
00052 #if 1 SoDEPRECATED enum MappingMethod {
00055
00056 BUMP_MAPPING,
00058 IMAGE_MAPPING
00059 } ;
00060 SoDEPRECATED
00065 static void set( SoState *state, SoNode *node, int unit, MappingMethod mappingMethod );
00066 SoDEPRECATED
00072 static const MappingMethod* getMappingMethods( SoState *state );
00073 SoDEPRECATED
00079 static MappingMethod getActiveMappingMethod( SoState *state );
00080 #endif
00087 static SbBool activateTextureUnit(SoState *state, int unit) ;
00088
00092 virtual void push(SoState *state) ;
00093
00097 virtual void pop(SoState *, const SoElement *prevTopElement) ;
00098
00102 static const SbIntList& getTextureUnits(SoState *state) ;
00103
00107 static int getActiveTextureUnit(SoState *state) ;
00108
00112 static int getMaxTextureUnit(SoState* state=NULL) ;
00113
00119 static SbBool isMultiTexturing(SoState *state, SbIntList &imageTexUnitList) ;
00120
00125 static SbBool shouldSendGLData(SoState *state) ;
00126
00131 static int isImageMapping(SoState *state) ;
00132
00137 static int isBumpMapping(SoState *state) ;
00138
00139 private:
00140
00142 virtual void commonInit();
00143
00145 virtual void init(SoState *state);
00146
00147 private:
00148
00149
00150 static void initClass() ;
00151 static void exitClass() ;
00152
00156 static uint32_t getFixedPipelineMaxTextureUnit(SoState* state) ;
00157
00162 static SbBool isMultitexturingAvailable(SoState* state);
00163
00164 private:
00165
00166 virtual void setElt(SoState* state, SoNode *node, const int unit, MappingMethod mappingMethod) ;
00167 virtual void setUnit(SoState* state, const int unit);
00168
00169 int m_startIndex ;
00170 int m_textureUnit ;
00171
00172
00173 SbIntList m_textureUnits ;
00174
00175
00176
00177 virtual ~SoTextureUnitElement() ;
00178
00179 MappingMethod& getMapping(const size_t unit) const;
00180
00181 virtual SbBool matches(const SoElement* element) const;
00182 virtual SoElement* copyMatchInfo() const;
00183
00184 private:
00185
00186 mutable std::vector<MappingMethod> m_mappingMethods ;
00187
00188
00189 static SbBool s_multiTexturingAllowed;
00190 static int s_multitexturing_extensionID;
00191 } ;
00192
00193
00194 #ifdef _MSC_VER
00195 #pragma warning( pop )
00196 #endif
00197
00198 #endif // _SO_TEXTURE_UNIT_ELEMENT_
00199
00200
00201