Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoShapeHintsElement.h
Go to the documentation of this file.
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 : Paul S. Strauss (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifndef _SO_SHAPE_HINTS_ELEMENT
51#define _SO_SHAPE_HINTS_ELEMENT
52
54
70
72
73 public:
94 };
111
129
144
149 static void set(SoState *state, VertexOrdering vertexOrdering,
150 ShapeType shapeType, FaceType faceType);
151
156 static void set(SoState *state, WindingType windingType);
157
161 static void set(SoState *state, SbBool useVBO) ;
162
166 static void set(SoState *state, VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType,
167 WindingType windingType, SbBool useVBO);
168
172 static void set(SoState *state, SoNode *,
173 VertexOrdering vertexOrdering,
174 ShapeType shapeType, FaceType faceType)
175 { set(state, vertexOrdering, shapeType, faceType); }
176
180 static void set(SoState *state, SoNode *,WindingType windingType)
181 { set(state,windingType); }
182
186 static void set(SoState *state, SoNode *, SbBool useVBO)
187 { set(state,useVBO); }
188
192 static void get(SoState *state,
193 VertexOrdering &vertexOrdering,
194 ShapeType &shapeType, FaceType &faceType);
195
199 static void get(SoState *state, WindingType &windingType );
200
204 static SbBool isVBOUsed(SoState *state) ;
205
210 {
211 return s_vertexOrderingDefault;
212 }
217 {
218 return s_shapeTypeDefault;
219 }
224 {
225 return s_faceTypeDefault;
226 }
231 {
232 return s_windingTypeDefault;
233 }
238 {
239 return true;
240 }
241
246 virtual void push(SoState *state);
247
251 virtual void print(FILE *fp) const;
252
253private:
254
256 virtual void init(SoState *state);
257
261 virtual SbBool matches(const SoElement* elt) const;
262
266 virtual SoElement* copyMatchInfo() const;
267
268 private:
269 // Initializes the SoShapeHintsElement class
270 static void initClass();
271 static void exitClass();
272
273 static bool isTwoSidedLighting(SoState *state);
274 static void setForceTwoSidedLighting( SoState* state, bool forceTwoSidedLighting );
275
277 static bool isCulling(SoState *state);
278
280 bool isCulling() const;
281
283 static bool isCulling( VertexOrdering vertexOrdering, ShapeType shapeType );
284
286 static bool isCounterClockwise(SoState *state);
287
289 bool isCounterClockwise() const;
290
291private:
293 virtual void commonInit();
294
295 // Virtual set methods that subclasses can override.
296 virtual void setElt(VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType);
297
298 virtual void setElt(WindingType windingType);
299
300 // Set shape hints by defining all options.
301 virtual void setElt(VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType,
302 WindingType windingType, SbBool useVBO);
303
304 VertexOrdering vertexOrdering;
305 ShapeType shapeType;
306 FaceType faceType;
307 WindingType windingType;
308 SbBool useVBO ;
309
310 virtual ~SoShapeHintsElement();
311
312private:
313 bool isTwoSidedLighting() const;
314
315 bool m_forceTwoSidedLighting;
316
317 static void initVertexOrdering();
318 static void initShapeType();
319 static void initFaceType();
320 static void initWindingType();
321
322 static VertexOrdering s_vertexOrderingDefault;
323 static ShapeType s_shapeTypeDefault;
324 static FaceType s_faceTypeDefault;
325 static WindingType s_windingTypeDefault;
326};
327
328#endif /* _SO_SHAPE_HINTS_ELEMENT */
329
#define SoEXTENDER_Documented
static void init()
#define SO_ELEMENT_HEADER(className)
Abstract base class for all state elements.
Definition SoElement.h:102
Abstract base class for all database nodes.
Definition SoNode.h:145
Stores the current shape hints.
static void set(SoState *state, SoNode *, SbBool useVBO)
Indicates if VBO is used from the state.
static void get(SoState *state, WindingType &windingType)
Return current shape winding type from the state.
static VertexOrdering getDefaultVertexOrdering()
Returns default hint.
ShapeType
Hints about entire shape.
@ SOLID
Shape is known to be solid.
@ UNKNOWN_SHAPE_TYPE
Nothing is known about shape.
@ SHAPE_TYPE_AS_IS
Indicates to set() to leave as is.
static void get(SoState *state, VertexOrdering &vertexOrdering, ShapeType &shapeType, FaceType &faceType)
Returns current shape hints from the state.
FaceType
Hints about faces of shape.
@ CONVEX
Faces are all convex.
@ FACE_TYPE_AS_IS
Indicates to set() to leave as is.
@ UNKNOWN_FACE_TYPE
Nothing is known about faces.
virtual void push(SoState *state)
Push copies the values from the previous element, so set doesn't have to set them if they are set AS_...
WindingType
Hints about winding type.
VertexOrdering
Hints about ordering of face vertices.
@ ORDERING_AS_IS
Indicates to set() to leave as is.
@ UNKNOWN_ORDERING
No ordering info is known.
@ COUNTERCLOCKWISE
Vertices are ordered CCW around faces.
@ CLOCKWISE
Vertices are ordered CW around faces.
static void set(SoState *state, WindingType windingType)
Sets the current shape hints in the state.
virtual void print(FILE *fp) const
Prints element (for debugging).
static WindingType getDefaultWindingType()
Returns default hint.
static SbBool getDefaultVBOUsage()
Returns default hint.
static SbBool isVBOUsed(SoState *state)
Indicates if VBO is used from the state.
static void set(SoState *state, SbBool useVBO)
Sets the current shape hints in the state.
static void set(SoState *state, SoNode *, VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType)
Sets the current shape hints in the state.
static void set(SoState *state, VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType, WindingType windingType, SbBool useVBO)
Set shape hints by defining all options.
static void set(SoState *state, VertexOrdering vertexOrdering, ShapeType shapeType, FaceType faceType)
Sets the current shape hints in the state.
static ShapeType getDefaultShapeType()
Returns default hint.
static void set(SoState *state, SoNode *, WindingType windingType)
static FaceType getDefaultFaceType()
Returns default hint.
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87