Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoLevelOfDetail.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** Modified by : Nick Thompson (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-2014 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_LEVEL_OF_DETAIL_
52#define _SO_LEVEL_OF_DETAIL_
53
56
58//
59// Class: SoLevelOfDetail
60//
61// Level-of-detail group node. The children of this node typically
62// represent the same object or objects at varying levels of detail,
63// from highest detail to lowest. The size of the objects when
64// projected into the viewport is used to determine which version to
65// use (i.e., which child to traverse).
66//
67// The size is computed as the area of the screen rectangle enclosing
68// the projection of the 3D bounding box that encloses all of the
69// children. When rendering, this size is compared to the values in
70// the screenArea field. If the size is greater than the first value,
71// child 0 is traversed. If it is smaller than the first, but greater
72// than the second, child 1 is traversed, and so on. If there are
73// fewer children than are required by this rule, the last child is
74// traversed. The screenArea field contains just 0 by default, so the
75// first child is always traversed.
76//
77// The size calculation takes the current complexity into account. If
78// the complexity is 0 or is of type BOUNDING_BOX, the last child is
79// always traversed. If the complexity is less than .5, the computed
80// size is scaled down appropriately to use (possibly) a less
81// detailed representation. If the complexity is greater than .5, the
82// size is scaled up. At complexity 1, the first child is always used.
83//
84// Picking and the callback action use the same traversal rules as
85// rendering. Bounding boxes are computed to enclose all children (as
86// is needed to compute the projected size). All other actions are
87// implemented as for SoGroup, except that SoLevelOfDetail
88// saves/restores state (like a separator) when applying any action.
89//
91
150class SoLevelOfDetail : public SoGroup {
151
153
154 public:
155 // Fields
161
166
170 SoLevelOfDetail(int nChildren);
171
172 private:
173 // Implement actions:
174 virtual void doAction(SoAction *action);
175 virtual void callback(SoCallbackAction *action);
176 virtual void GLRender(SoGLRenderAction *action);
177 virtual void rayPick(SoRayPickAction *action);
178
179 private:
180 static void initClass();
181 static void exitClass();
182
183 private:
184 virtual ~SoLevelOfDetail();
185
186 private:
187 // This action is used to compute the screen-space bbox
188 static SoGetBoundingBoxAction *bboxAction;
189};
190
191#endif /* _SO_LEVEL_OF_DETAIL_ */
192
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Base class for all group nodes.
Definition SoGroup.h:122
Level-of-detail switching group node.
SoLevelOfDetail(int nChildren)
Constructor that takes approximate number of children.
SoLevelOfDetail()
Creates a level-of-detail node with default settings.
SoMFFloat screenArea
Areas to use for comparison.
Multiple-value field containing any number of floating point values.
Definition SoMFFloat.h:90
Intersects objects with a ray cast into scene.