00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : R. ALBOU (May 2002) 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: 00054 static void set(SoState *state, SoNode *node, int unit) ; 00055 00059 static SbBool activateTextureUnit(SoState *state, int unit) ; 00060 00064 virtual void push(SoState *state) ; 00065 00069 virtual void pop(SoState *, const SoElement *prevTopElement) ; 00070 00074 static const SbIntList& getTextureUnits(SoState *state) ; 00075 00079 static int getActiveTextureUnit(SoState *state) ; 00080 00084 static int getMaxTextureUnit(SoState* state=NULL) ; 00085 00090 static SbBool isMultiTexturing(SoState *state, SbIntList &imageTexUnitList) ; 00091 00092 private: 00093 00095 virtual void commonInit(); 00096 00098 virtual void init(SoState *state); 00099 00100 private: 00101 00102 // Initializes the SoTextureUnitElement class 00103 static void initClass() ; 00104 static void exitClass() ; 00105 00109 static uint32_t getFixedPipelineMaxTextureUnit(SoState* state) ; 00110 00114 static bool isActiveTextureUnitInFixedPipeline(SoState* state); 00115 00120 static SbBool isMultitexturingAvailable(SoState* state); 00121 00122 private: 00123 // Sets the element 00124 virtual void setElt(SoState* state, SoNode *node, const int unit) ; 00125 virtual void setUnit(SoState* state, const int unit); 00126 00127 int m_startIndex ; 00128 int m_textureUnit ; 00129 00130 // List of texture units 00131 SbIntList m_textureUnits ; 00132 00133 virtual ~SoTextureUnitElement() ; 00134 00135 virtual SbBool matches(const SoElement* element) const; 00136 virtual SoElement* copyMatchInfo() const; 00137 00138 private: 00139 // used to indicate that multitexturing has been disable through OIV_MULTITEXTURING envvar 00140 static SbBool s_multiTexturingAllowed; 00141 } ; 00142 /*----------------------------------------------------------------------------*/ 00143 00144 #ifdef _MSC_VER 00145 #pragma warning( pop ) 00146 #endif 00147 00148 #endif // _SO_TEXTURE_UNIT_ELEMENT_ 00149 00150 00151