Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoSimplifyAction.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2018 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Pascal DOUX (Jan 1998)
22**=======================================================================*/
23
24#ifndef _SO_SIMPLIFY_ACTION_
25#define _SO_SIMPLIFY_ACTION_
26
27//------------------------------------------------------------------------------
28// Includes
29
30#include <Inventor/actions/SoAction.h>
31#include <Inventor/actions/SoSubAction.h>
32#include <Inventor/fields/SoMFFloat.h>
33#include <Inventor/simplifier/SoSimplifier.h>
34
35#include <Inventor/SoType.h>
36
85{
86 SO_ACTION_HEADER(SoSimplifyAction);
87
88public:
89
99
108 void setSimplificationLevels(int num, const float levels[]);
114 const float *getSimplificationLevels() const;
119
126 void setRanges(int num, const float newRanges[]);
133 const float *getRanges() const;
138 int getNumRanges() const;
139
144 void setSizeFactor(float size);
149 float getSizeFactor() const;
150
163
167 void setUrlName(const SbString name);
172
185
191 void setMinTriangles(int mt);
195 int getMinTriangles() const;
196
208 int isRenderCulling() const;
209
210 private:
211 static void initClass();
212 static void exitClass();
213
214private:
215
216 // The simplifier object.
217 SoSimplifier *simplifier;
218
219 // contains the different level of simplification.
220 // must be a decreasing list of %
221 // if not set computes with 0.5
222 // if contains a single value, does not put a LOD
223 // if contains several values, create a LOD and use range as selector.
224 int numSimplificationLevels;
225 float *simplificationLevels;
226
227 // contains the range given to each LOD when they exist.
228 // must be a non-decreasing list containing the distances to the objects.
229 // when the scene graph contains several objects with very different sizes
230 // this value should not be set, thus allowing the action to compute the ranges
231 // automatically for each shape individually.
232 int numRanges;
233 float *ranges;
234
235 // this factor is used in the computation of individual LOD ranges.
236 // used only if range is not set (default 3)
237 float sizeFactor;
238
239 // if TRUE each LOD level is stored in a SoWWWInline
240 // otherwise use a SoSeparator to enable caching
241 // default FALSE
242 SbBool inlineLOD;
243
244 // base name of each inlined sub-files (default "")
245 SbString urlName;
246
247 // verbosity: is TRUE prints a lot of informations during processing
248 SbBool verbosity;
249
250 // minimum number of triangle to consider for decimation.
251 // if the number of triangle is smaller than this number the decimation
252 // won't occur (default 0)
253 int minTriangles;
254
255 // render culling flag: if TRUE, each separator will have the renderCulling
256 // field set to TRUE. This can improve performances when view frustrum culling
257 // is necessary. Default FALSE.
258 int renderCulling;
259
260 // internal methods
261 SoNode *simplifySingleLevel();
262 SoNode *simplifyMultiLevelsWithInline();
263 SoNode *simplifyMultiLevels();
264 SoNode *simplify();
265
266 int shapeNum;
267
268};
269
270#endif // _SO_SIMPLIFY_ACTION_
271
Class for smart character strings.
Definition SbString.h:202
Abstract base class for all actions.
Definition SoAction.h:132
Abstract base class for all database nodes.
Definition SoNode.h:145
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
SbString getUrlName() const
Gets the name used when creating Inline files for each simplified child.
int getNumRanges() const
Gets the number of ranges that will be used in the LevelOfSimplification node to decide which level o...
const float * getSimplificationLevels() const
Gets percentages to produce at each level of detail.
int getNumSimplificationLevels() const
Gets number of levels of detail to produce.
void setVerbosity(SbBool v)
Sets verbosity flag.
void setMinTriangles(int mt)
Sets the minimum number of triangles for a simplified child; if a given percentage would create a sim...
void setInlineLOD(SbBool i)
Sets inlineLOD flag.
void setSimplificationLevels(int num, const float levels[])
Sets number of levels of detail to produce and what percentage to produce at each level.
void setRenderCulling(SbBool r)
Sets render culling flag.
SoSimplifyAction(SoSimplifier *_simplifier)
Constructor.
int isRenderCulling() const
Gets render culling flag.
const float * getRanges() const
Gets the ranges that will be used in the LevelOfSimplification node to decide which level of detail t...
SbBool isInlineLOD() const
Gets inlineLOD flag.
int getMinTriangles() const
Gets the minimum number of triangles for a simplified child.
void setRanges(int num, const float newRanges[])
Sets the ranges that will be used in the LevelOfSimplification node to decide which level of detail t...
SbBool isVerbose() const
Gets verbosity flag.
void setSizeFactor(float size)
Sets the scale factor to use to decide what values of ranges to use in the LevelOfSimplification node...
float getSizeFactor() const
Gets the scale factor to use to decide what values of ranges to use in the LevelOfSimplification node...
~SoSimplifyAction()
Destructor.
void setUrlName(const SbString name)
Sets the name used when creating Inline files for each simplified child.
int SbBool
Boolean type.
Definition SbBase.h:87