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 IMAGE_MAPPING
00055 } ;
00056
00060 static void set(SoState *state, SoNode *node, int unit, MappingMethod mappingMethod) ;
00061
00065 static SbBool activateTextureUnit(SoState *state, int unit) ;
00066
00070 virtual void push(SoState *state) ;
00071
00075 virtual void pop(SoState *, const SoElement *prevTopElement) ;
00076
00080 static const SbIntList& getTextureUnits(SoState *state) ;
00081
00086 static const MappingMethod* getMappingMethods(SoState *state) ;
00087
00091 static int getActiveTextureUnit(SoState *state) ;
00092
00097 static MappingMethod getActiveMappingMethod(SoState *state) ;
00098
00102 static int getMaxTextureUnit(SoState* state=NULL) ;
00103
00109 static SbBool isMultiTexturing(SoState *state, SbIntList &imageTexUnitList) ;
00110
00115 static int isImageMapping(SoState *state) ;
00116
00117 private:
00118
00120 virtual void commonInit();
00121
00123 virtual void init(SoState *state);
00124
00125 private:
00126
00127
00128 static void initClass() ;
00129 static void exitClass() ;
00130
00134 static uint32_t getFixedPipelineMaxTextureUnit(SoState* state) ;
00135
00139 static bool isActiveTextureUnitInFixedPipeline(SoState* state);
00140
00145 static SbBool isMultitexturingAvailable(SoState* state);
00146
00147 private:
00148
00149 virtual void setElt(SoState* state, SoNode *node, const int unit, MappingMethod mappingMethod) ;
00150 virtual void setUnit(SoState* state, const int unit);
00151
00152 int m_startIndex ;
00153 int m_textureUnit ;
00154
00155
00156 SbIntList m_textureUnits ;
00157
00158
00159
00160 virtual ~SoTextureUnitElement() ;
00161
00162 MappingMethod& getMapping(const size_t unit) const;
00163
00164 virtual SbBool matches(const SoElement* element) const;
00165 virtual SoElement* copyMatchInfo() const;
00166
00167 private:
00168
00169 mutable std::vector<MappingMethod> m_mappingMethods ;
00170
00171
00172 static SbBool s_multiTexturingAllowed;
00173 static int s_multitexturing_extensionID;
00174 } ;
00175
00176
00177 #ifdef _MSC_VER
00178 #pragma warning( pop )
00179 #endif
00180
00181 #endif // _SO_TEXTURE_UNIT_ELEMENT_
00182
00183
00184