Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoIndexedFaceSet.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 : Paul S. Strauss (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 : AJO (May 2011)
48**=======================================================================*/
49
50
51#ifndef _SO_INDEXED_FACE_SET_
52#define _SO_INDEXED_FACE_SET_
53
54#include <Inventor/nodes/SoIndexedShape.h>
55#include <Inventor/sys/SoGLType.h>
56
58//
59// Class: SoIndexedFaceSet
60//
61// Indexed set of faces. Each face consists of 3 or more vertices,
62// each of which is denoted by an integer index (from the coordIndex
63// field) into the current coordinates. Depending on the current
64// material and normal binding values, the materials and normals for
65// the faces or vertices may be accessed in order or indexed. If they
66// are indexed, the materialIndex and normalIndex fields are used.
67//
69
70
71// This coordinate index indicates that the current face ends and the
72// next face begins. Use this for simple (1 contour) polygons.
73#define SO_END_FACE_INDEX (-1)
74
75// If SoShapeHints is used with a windingType other than NO_WINDING_TYPE,
76// this coordinate index indicates that the current contour ends
77// and the next contour begins.
78#define SO_END_CONTOUR_INDEX (-1)
79
80// This coordinate index indicates that the current complex face (block
81// of contours) ends.
82#define SO_END_POLYGON_INDEX (-2)
83
84class SoNormalBundle;
87
88SO_PIMPL_PUBLIC_DECLARATION(SoIndexedFaceSet)
89
90
248{
249 SO_NODE_HEADER(SoIndexedFaceSet);
250 SO_PIMPL_PUBLIC_HEADER(SoIndexedFaceSet)
251
252public:
253
258
259private:
260 // Implements actions
261 virtual void GLRender( SoGLRenderAction* action );
262
263 // Generates default normals using the given normal bundle.
264 // Returns TRUE.
265 virtual void generateDefaultNormals( SoState* state,
266 const SbVec3f* coords,
267 int numCoords,
268 SoNormalBundle* nb,
269 SbBool storeRef = FALSE);
270
272 virtual void shouldGenerateTangents( SoGLRenderAction* /*action*/, const SoShapeStyleElement* /*shapeStyle*/ ) {}
273
274 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action );
275 virtual void rayPick(SoRayPickAction *action);
276
277private:
278
279 static void initClass();
280 static void exitClass();
281
282 // set numTris/Quads/Faces to -1 when notified
283 virtual void notify( SoNotList* list );
284
285 // Compute the number of vertices. This is just an approximation,
286 //so using 5 verts per unknown polygon is close enough.
287 virtual int getNumPrim( SoState* state = NULL );
288
289 private:
290 // This enum is used to indicate the current material or normal binding
291 enum Binding {
292 OVERALL,
293 PER_FACE,
294 PER_FACE_INDEXED,
295 PER_VERTEX,
296 PER_VERTEX_INDEXED
297 };
298
299 //Whether to check or not shapeHints
300 virtual SbBool shouldCheckShapeHints(){ return TRUE;}
301
302 virtual SbBool shouldGenerateTexture3DCoordinates(){return TRUE;}
303
304 virtual void callSetupIndices( SoState* state, const SoShapeStyleElement* shapeStyle, uint32_t useTexCoordsAnyway );
305
306 //Whether to check or not 3d tex coords
307 virtual SbBool checkTex3Coords(){return TRUE;}
308
309 virtual SbBool shapeHintsTest( SoState* state = NULL );
310
311 int getNumPrim( int& _numTris, int& _numQuads, int& _numFaces );
312
313 virtual void countPrim( SoState* state = NULL );
314
315 // Generates triangles representing faces
316 virtual void generatePrimitives( SoAction* action );
317
318 // render function
319 virtual void doRendering( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle );
320
321 // Overrides standard method to create an SoFaceDetail instance
322 virtual SoDetail* createTriangleDetail( SoRayPickAction* action,
323 const SoPrimitiveVertex* v1,
324 const SoPrimitiveVertex* v2,
325 const SoPrimitiveVertex* v3,
326 SoPickedPoint* pp );
327
328 //When tesselating complex polygons, keep the result cached
329 virtual bool hasGeneratePrimitiveCache()
330 {
331 return true;
332 }
333
334 // destructor
335 virtual ~SoIndexedFaceSet();
336};
337
338#endif /* _SO_INDEXED_FACE_SET_ */
339
340
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
Base class for describing detail information about a shape node.
Definition SoDetail.h:99
Renders a scene graph using Open Inventor's Render Engine.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
Indexed polygonal face shape node.
SoIndexedFaceSet()
Creates an indexed face set node with default settings.
Abstract base class for all indexed vertex-based shapes.
Represents point on surface of picked object.
Represents a vertex of a generated primitive.
Intersects objects with a ray cast into scene.
Stores some information used by shapes.
Traversal state.
Definition SoState.h:74
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Indexed polygonal fac...
int SbBool
Boolean type.
Definition SbBase.h:87