Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoShapeStyleElement.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Alan Norton (MMM yyyy)
25** Modified by : Gavin Bell (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50
51#ifndef _SO_SHAPE_STYLE_ELEMENT
52#define _SO_SHAPE_STYLE_ELEMENT
53
54#include <Inventor/elements/SoInt32Element.h>
55#include <Inventor/STL/vector>
56
57#ifdef _MSC_VER
58#pragma warning( push )
59#pragma warning(disable:4251)
60#endif
61
83SoEXTENDER_Documented class SoShapeStyleElement : public SoElement {
84
85 SO_ELEMENT_HEADER(SoShapeStyleElement);
86
87 public:
88
90 enum flags {
94 BBOX_BIT = 0x2,
97 };
98
100 virtual void push(SoState *state);
101
103 virtual void pop(SoState *state, const SoElement *prevTopElement);
104
108 static const SoShapeStyleElement * get(SoState *state);
109
113 SbBool mightNotRender() const { return m_delayFlags; }
114
118 SbBool needNormals() const { return m_needNorms; }
119
124 {
125 return m_needTangs;
126 }
127
131 SbBool needTexCoords(int unit=0) const;
132
136 SbBool needTexCoords3(int unit=0) const;
137
145 { return m_renderCaseMask; }
146
150 static void setDrawStyle(SoState *state, int32_t value);
154 static void setComplexityType(SoState *state, int32_t value);
158 static void setTransparencyType(SoState *state, int32_t value);
162 static void setTextureEnabled(SoState *state, SbBool value, int unit=0);
166 static void setTexture3Enabled(SoState *state, SbBool value, int unit=0);
170 static void setTextureFunction(SoState *state, SbBool value, int unit=0);
174 static void setLightModel(SoState *state, int32_t value);
179 static void setOverrides(SoState *state, SbBool value);
180
182 virtual void print(FILE *fp) const;
183
184private:
185
187 virtual void commonInit();
188
190 virtual void init(SoState *state);
191
193 virtual SbBool matches(const SoElement* elt) const;
194
196 virtual SoElement* copyMatchInfo() const;
197
198 private:
199 SbBool isTextureFunction(int unit=0) const
200 {return (getTextureData(unit).texFunc);}
201
202 static void initClass();
203
204 static void exitClass();
205
206 private:
207
208 virtual ~SoShapeStyleElement();
209
210 private:
211 int m_delayFlags; // True if rendering might be delayed
212 SbBool m_needNorms;
213 SbBool m_needTangs;
214
215 // Texture Data for each texture unit
216 struct SoTextureData {
217 bool texEnabled ;
218 bool tex3Enabled ;
219 bool texFunc ;
220
221 // Constructor
222 SoTextureData()
223 {
224 texEnabled = tex3Enabled = texFunc = false;
225 }
226
227 // equality operator
228 friend int operator ==(const SoTextureData &texData1, const SoTextureData &texData2)
229 {
230 return (texData1.texEnabled == texData2.texEnabled &&
231 texData1.tex3Enabled == texData2.tex3Enabled &&
232 texData1.texFunc == texData2.texFunc) ;
233 }
234
235 // !equality operator
236 friend int operator !=(const SoTextureData &texData1, const SoTextureData &texData2)
237 { return !(texData1 == texData2) ; }
238 } ;
239
240
241 SoTextureData& getTextureData( const int unit ) const;
242 typedef std::vector<SoTextureData> SoTexDataList;
243 mutable SoTexDataList m_texDataList;
244
245 int m_renderCaseMask;
246};
247
248#ifdef _MSC_VER
249#pragma warning( pop )
250#endif
251
252#endif /* _SO_SHAPE_STYLE_ELEMENT */
253
254
Abstract base class for all state elements.
Definition SoElement.h:102
Stores some information used by shapes.
SbBool mightNotRender() const
Returns TRUE if shapes may not render for some reason.
static void setLightModel(SoState *state, int32_t value)
API used by other elements.
static const SoShapeStyleElement * get(SoState *state)
Get a readable instance.
virtual void pop(SoState *state, const SoElement *prevTopElement)
Pops element.
static void setTextureEnabled(SoState *state, SbBool value, int unit=0)
API used by other elements.
static void setOverrides(SoState *state, SbBool value)
Set value is TRUE if either diffuse, transparency, or materialbinding are overridden; otherwise FALSE...
SbBool needTexCoords3(int unit=0) const
Returns TRUE if need 3D texture coordinates.
static void setDrawStyle(SoState *state, int32_t value)
API used by other elements.
static void setComplexityType(SoState *state, int32_t value)
API used by other elements.
@ DELAY_TRANSP_BIT
DELAY_TRANSP_BIT.
@ INVISIBLE_BIT
INVISIBLE_BIT.
virtual void print(FILE *fp) const
Prints element (for debugging).
static void setTransparencyType(SoState *state, int32_t value)
API used by other elements.
SbBool needNormals() const
Returns TRUE if need normals.
static void setTexture3Enabled(SoState *state, SbBool value, int unit=0)
API used by other elements.
SbBool needTangents() const
Returns TRUE if need tangents.
virtual void push(SoState *state)
Pushes element.
SbBool needTexCoords(int unit=0) const
Returns TRUE if need texture coordinates.
int getRenderCaseMask() const
Returns a mask that can be used by the SoVertexPropertyCache class (see SoVertexProperty....
static void setTextureFunction(SoState *state, SbBool value, int unit=0)
API used by other elements.
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87