Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoLineSet.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**=======================================================================*/
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-2019 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_LINE_SET_
51#define _SO_LINE_SET_
52
53#include <Inventor/fields/SoMFInt32.h>
54#include <Inventor/nodes/SoNonIndexedShape.h>
55#include <Inventor/SbPImpl.h>
56
57class SoState;
58class SoTextureCoordinateBundle;
59class SoTextureCoordinate3Bundle;
60class SoTangentBundle;
61
62SO_PIMPL_PUBLIC_DECLARATION(SoLineSet)
63
64
65//
66// Class: SoLineSet
67//
68// Set of (poly)lines. Each line consists of 2 or more vertices,
69// taken in order from the current coordinates, which are joined to
70// form segments. The startIndex field gives the starting coordinate
71// index for the first line. If materials, normals or tangents are bound to
72// vertices, they will begin at that index, as well; otherwise, they
73// will start at index 0. The number of vertices in each polyline is
74// determined by successive entries in the numVertices field.
75//
77
78
79// Deprecated feature; specifying USE_REST_OF_VERTICES as the last
80// value in the numVertices field will use all the points in the
81// coordinate array.
82#define SO_LINE_SET_USE_REST_OF_VERTICES (-1)
83
84
190{
191 SO_NODE_HEADER(SoLineSet);
192 SO_PIMPL_PUBLIC_HEADER(SoLineSet)
193
194public:
199
204
205private:
206
208 virtual void GLRender( SoGLRenderAction* action );
209
214 virtual void getBoundingBox( SoGetBoundingBoxAction* action );
215
217 virtual void getPrimitiveCount( SoGetPrimitiveCountAction* action );
218
225 virtual void generateDefaultTangents( SoState* state,
226 const SbVec3f* coords,
227 int numCoords,
228 SoTangentBundle* tb,
229 SbBool storeRef = FALSE );
230private:
231
232 inline int getNumPolyLines() const { return numVertices.getNum(); }
233
235 static void initClass();
237 static void exitClass();
238
239 // return num vertices
240 virtual int getNumVert( SoState* state = NULL );
241
243 virtual void notify( SoNotList* list );
244
245 //return number of primitives
246 virtual int getNumPrim( SoState* state = NULL );
247
248 private:
249 // Generates line segments representing line set
250 virtual void generatePrimitives( SoAction* action );
251
252 // check if normal should be generated or not.
253 virtual void shouldGenerateNormals( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle );
254
255 // setup lazy element
256 virtual void setupLazyElement(SoGLRenderAction *action, const SoShapeStyleElement *shapeStyle);
257
258 //Free memory
259 virtual void exitRender( SoState* state,int stateFlag,
260 SoTextureCoordinateBundle* tcb,
261 SoTextureCoordinate3Bundle* tc3b );
262
263 // count the number of primitives in the shape
264 virtual void countPrim( SoState* state = NULL );
265
266 // really do the rendering part
267 virtual void doRendering( SoGLRenderAction* action, const SoShapeStyleElement* shapeStyle );
268
269 // says that rendering is PointOrLine
270 virtual SbBool isRenderingPointsOrLines( SoGLRenderAction* action );
271
272 // Overrides standard method to create an SoLineDetail instance
273 virtual SoDetail* createLineSegmentDetail( SoRayPickAction* action,
274 const SoPrimitiveVertex* v1,
275 const SoPrimitiveVertex* v2,
276 SoPickedPoint* pp );
277
279 virtual ~SoLineSet();
280
281};
282
283inline SbBool
284SoLineSet::isRenderingPointsOrLines( SoGLRenderAction* )
285{
286 return TRUE;
287}
288
289#endif /* _SO_LINE_SET_ */
290
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.
Computes bounding box of a scene.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
Polyline shape node.
Definition SoLineSet.h:190
SoLineSet()
Creates a line set node with default settings.
SoMFInt32 numVertices
Number of vertices per polyline.
Definition SoLineSet.h:198
Multiple-value field containing any number of int32_t integers.
Definition SoMFInt32.h:88
int getNum() const
Returns the number of values currently in the field.
Definition SoMField.h:146
Abstract base class for all non-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
int SbBool
Boolean type.
Definition SbBase.h:87