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:
00052 enum MappingMethod {
00054 BUMP_MAPPING,
00056 IMAGE_MAPPING
00057 } ;
00058
00062 static void set(SoState *state, SoNode *node, int unit, MappingMethod mappingMethod) ;
00063
00067 static SbBool activateTextureUnit(SoState *state, int unit) ;
00068
00072 virtual void push(SoState *state) ;
00073
00077 virtual void pop(SoState *, const SoElement *prevTopElement) ;
00078
00082 static const SbIntList& getTextureUnits(SoState *state) ;
00083
00088 static const MappingMethod* getMappingMethods(SoState *state) ;
00089
00093 static int getActiveTextureUnit(SoState *state) ;
00094
00099 static MappingMethod getActiveMappingMethod(SoState *state) ;
00100
00104 static int getMaxTextureUnit(SoState* state=NULL) ;
00105
00111 static SbBool isMultiTexturing(SoState *state, SbIntList &imageTexUnitList) ;
00112
00117 static SbBool shouldSendGLData(SoState *state) ;
00118
00123 static int isImageMapping(SoState *state) ;
00124
00129 static int isBumpMapping(SoState *state) ;
00130
00131 private:
00132
00134 virtual void commonInit();
00135
00137 virtual void init(SoState *state);
00138
00139 private:
00140
00141
00142 static void initClass() ;
00143 static void exitClass() ;
00144
00148 static uint32_t getFixedPipelineMaxTextureUnit(SoState* state) ;
00149
00154 static SbBool isMultitexturingAvailable(SoState* state);
00155
00156 private:
00157
00158 virtual void setElt(SoState* state, SoNode *node, const int unit, MappingMethod mappingMethod) ;
00159 virtual void setUnit(SoState* state, const int unit);
00160
00161 int m_startIndex ;
00162 int m_textureUnit ;
00163
00164
00165 SbIntList m_textureUnits ;
00166
00167
00168
00169 virtual ~SoTextureUnitElement() ;
00170
00171 MappingMethod& getMapping(const size_t unit) const;
00172
00173 virtual SbBool matches(const SoElement* element) const;
00174 virtual SoElement* copyMatchInfo() const;
00175
00176 private:
00177
00178 mutable std::vector<MappingMethod> m_mappingMethods ;
00179
00180
00181 static SbBool s_multiTexturingAllowed;
00182 static int s_multitexturing_extensionID;
00183 } ;
00184
00185
00186 #ifdef _MSC_VER
00187 #pragma warning( pop )
00188 #endif
00189
00190 #endif // _SO_TEXTURE_UNIT_ELEMENT_
00191
00192
00193