Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoTextureUnitElement.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : R. ALBOU (May 2002)
22**=======================================================================*/
23
24#ifndef _SO_TEXTURE_UNIT_ELEMENT_
25#define _SO_TEXTURE_UNIT_ELEMENT_
26
27#include <Inventor/SbPList.h>
28#include <Inventor/elements/SoAccumulatedElement.h>
29
30#ifdef _MSC_VER
31#pragma warning( push )
32#pragma warning(disable:4251)
33#endif
34
47SoEXTENDER_Documented class SoTextureUnitElement : public SoAccumulatedElement {
48 SO_ELEMENT_HEADER(SoTextureUnitElement) ;
49
50 public:
54 static void set(SoState *state, SoNode *node, int unit) ;
55
59 static SbBool activateTextureUnit(SoState *state, int unit) ;
60
64 virtual void push(SoState *state) ;
65
69 virtual void pop(SoState *, const SoElement *prevTopElement) ;
70
74 static const SbIntList& getTextureUnits(SoState *state) ;
75
79 static int getActiveTextureUnit(SoState *state) ;
80
84 static int getMaxTextureUnit(SoState* state=NULL) ;
85
90 static SbBool isMultiTexturing(SoState *state, SbIntList &imageTexUnitList) ;
91
92private:
93
95 virtual void commonInit();
96
98 virtual void init(SoState *state);
99
100private:
101
102 // Initializes the SoTextureUnitElement class
103 static void initClass() ;
104 static void exitClass() ;
105
109 static uint32_t getFixedPipelineMaxTextureUnit(SoState* state) ;
110
114 static bool isActiveTextureUnitInFixedPipeline(SoState* state);
115
120 static SbBool isMultitexturingAvailable(SoState* state);
121
122 private:
123 // Sets the element
124 virtual void setElt(SoState* state, SoNode *node, const int unit) ;
125 virtual void setUnit(SoState* state, const int unit);
126
127 int m_startIndex ;
128 int m_textureUnit ;
129
130 // List of texture units
131 SbIntList m_textureUnits ;
132
133 virtual ~SoTextureUnitElement() ;
134
135 virtual SbBool matches(const SoElement* element) const;
136 virtual SoElement* copyMatchInfo() const;
137
138private:
139 // used to indicate that multitexturing has been disable through OIV_MULTITEXTURING envvar
140 static SbBool s_multiTexturingAllowed;
141} ;
142/*----------------------------------------------------------------------------*/
143
144#ifdef _MSC_VER
145#pragma warning( pop )
146#endif
147
148#endif // _SO_TEXTURE_UNIT_ELEMENT_
149
150
Abstract base class for each state element whose value may be accumulated when it is set.
Abstract base class for all state elements.
Definition SoElement.h:102
Abstract base class for all database nodes.
Definition SoNode.h:145
Traversal state.
Definition SoState.h:74
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Stores the curre...
static void set(SoState *state, SoNode *node, int unit)
Sets the current texture unit.
static const SbIntList & getTextureUnits(SoState *state)
Returns the current list texture units.
virtual void push(SoState *state)
Overrides push() method to copy values from next instance in the stack.
static int getMaxTextureUnit(SoState *state=NULL)
Returns the maximum texture units.
static SbBool isMultiTexturing(SoState *state, SbIntList &imageTexUnitList)
Returns TRUE if the multi-texturing is active: i.e., at least 2 texture units are defined.
static SbBool activateTextureUnit(SoState *state, int unit)
Activates the current texture if it exists.
virtual void pop(SoState *, const SoElement *prevTopElement)
Pop method.
static int getActiveTextureUnit(SoState *state)
Returns the current active texture unit (the last texture unit set).
int SbBool
Boolean type.
Definition SbBase.h:87