00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : Pascal DOUX (Jan 1998) 00022 **=======================================================================*/ 00023 00024 #ifndef _SO_SIMPLIFY_ACTION_ 00025 #define _SO_SIMPLIFY_ACTION_ 00026 00027 //------------------------------------------------------------------------------ 00028 // Includes 00029 00030 #include <Inventor/actions/SoAction.h> 00031 #include <Inventor/actions/SoSubAction.h> 00032 #include <Inventor/fields/SoMFFloat.h> 00033 #include <Inventor/simplifier/SoSimplifier.h> 00034 00035 #include <Inventor/SoType.h> 00036 00085 class SoSimplifyAction : public SoAction 00086 { 00087 SO_ACTION_HEADER(SoSimplifyAction); 00088 00089 public: 00090 00095 SoSimplifyAction (SoSimplifier *_simplifier); 00099 ~SoSimplifyAction(); 00100 00109 void setSimplificationLevels(int num, const float levels[]); 00115 const float *getSimplificationLevels() const; 00119 int getNumSimplificationLevels() const; 00120 00127 void setRanges(int num, const float newRanges[]); 00134 const float *getRanges() const; 00139 int getNumRanges() const; 00140 00145 void setSizeFactor(float size); 00150 float getSizeFactor() const; 00151 00157 void setInlineLOD(SbBool i); 00163 SbBool isInlineLOD() const; 00164 00168 void setUrlName(const SbString name); 00172 SbString getUrlName() const; 00173 00179 void setVerbosity(SbBool v); 00185 SbBool isVerbose() const; 00186 00192 void setMinTriangles(int mt); 00196 int getMinTriangles() const; 00197 00203 void setRenderCulling(SbBool r); 00209 int isRenderCulling() const; 00210 00211 private: 00212 static void initClass(); 00213 static void exitClass(); 00214 00215 private: 00216 00217 // The simplifier object. 00218 SoSimplifier *simplifier; 00219 00220 // contains the different level of simplification. 00221 // must be a decreasing list of % 00222 // if not set computes with 0.5 00223 // if contains a single value, does not put a LOD 00224 // if contains several values, create a LOD and use range as selector. 00225 int numSimplificationLevels; 00226 float *simplificationLevels; 00227 00228 // contains the range given to each LOD when they exist. 00229 // must be a non-decreasing list containing the distances to the objects. 00230 // when the scene graph contains several objects with very different sizes 00231 // this value should not be set, thus allowing the action to compute the ranges 00232 // automatically for each shape individually. 00233 int numRanges; 00234 float *ranges; 00235 00236 // this factor is used in the computation of individual LOD ranges. 00237 // used only if range is not set (default 3) 00238 float sizeFactor; 00239 00240 // if TRUE each LOD level is stored in a SoWWWInline (or SoVRMLInline) 00241 // otherwise use a SoSeparator (or SoVRMLGroup) (to enable caching) 00242 // default FALSE 00243 SbBool inlineLOD; 00244 00245 // base name of each inlined sub-files (default "") 00246 SbString urlName; 00247 00248 // verbosity: is TRUE prints a lot of informations during processing 00249 SbBool verbosity; 00250 00251 // minimum number of triangle to consider for decimation. 00252 // if the number of triangle is smaller than this number the decimation 00253 // won't occur (default 0) 00254 int minTriangles; 00255 00256 // render culling flag: if TRUE, each separator will have the renderCulling 00257 // field set to TRUE. This can improve performances when view frustrum culling 00258 // is necessary. Default FALSE. 00259 int renderCulling; 00260 00261 // internal methods 00262 SoNode *simplifySingleLevel(); 00263 SoNode *simplifyMultiLevelsWithInline(); 00264 SoNode *simplifyMultiLevels(); 00265 SoNode *simplify(); 00266 00267 int shapeNum; 00268 00269 }; 00270 00271 #endif // _SO_SIMPLIFY_ACTION_ 00272 00273