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-2018 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 00084 class SoSimplifyAction : public SoAction 00085 { 00086 SO_ACTION_HEADER(SoSimplifyAction); 00087 00088 public: 00089 00094 SoSimplifyAction (SoSimplifier *_simplifier); 00098 ~SoSimplifyAction(); 00099 00108 void setSimplificationLevels(int num, const float levels[]); 00114 const float *getSimplificationLevels() const; 00118 int getNumSimplificationLevels() const; 00119 00126 void setRanges(int num, const float newRanges[]); 00133 const float *getRanges() const; 00138 int getNumRanges() const; 00139 00144 void setSizeFactor(float size); 00149 float getSizeFactor() const; 00150 00156 void setInlineLOD(SbBool i); 00162 SbBool isInlineLOD() const; 00163 00167 void setUrlName(const SbString name); 00171 SbString getUrlName() const; 00172 00178 void setVerbosity(SbBool v); 00184 SbBool isVerbose() const; 00185 00191 void setMinTriangles(int mt); 00195 int getMinTriangles() const; 00196 00202 void setRenderCulling(SbBool r); 00208 int isRenderCulling() const; 00209 00210 private: 00211 static void initClass(); 00212 static void exitClass(); 00213 00214 private: 00215 00216 // The simplifier object. 00217 SoSimplifier *simplifier; 00218 00219 // contains the different level of simplification. 00220 // must be a decreasing list of % 00221 // if not set computes with 0.5 00222 // if contains a single value, does not put a LOD 00223 // if contains several values, create a LOD and use range as selector. 00224 int numSimplificationLevels; 00225 float *simplificationLevels; 00226 00227 // contains the range given to each LOD when they exist. 00228 // must be a non-decreasing list containing the distances to the objects. 00229 // when the scene graph contains several objects with very different sizes 00230 // this value should not be set, thus allowing the action to compute the ranges 00231 // automatically for each shape individually. 00232 int numRanges; 00233 float *ranges; 00234 00235 // this factor is used in the computation of individual LOD ranges. 00236 // used only if range is not set (default 3) 00237 float sizeFactor; 00238 00239 // if TRUE each LOD level is stored in a SoWWWInline 00240 // otherwise use a SoSeparator to enable caching 00241 // default FALSE 00242 SbBool inlineLOD; 00243 00244 // base name of each inlined sub-files (default "") 00245 SbString urlName; 00246 00247 // verbosity: is TRUE prints a lot of informations during processing 00248 SbBool verbosity; 00249 00250 // minimum number of triangle to consider for decimation. 00251 // if the number of triangle is smaller than this number the decimation 00252 // won't occur (default 0) 00253 int minTriangles; 00254 00255 // render culling flag: if TRUE, each separator will have the renderCulling 00256 // field set to TRUE. This can improve performances when view frustrum culling 00257 // is necessary. Default FALSE. 00258 int renderCulling; 00259 00260 // internal methods 00261 SoNode *simplifySingleLevel(); 00262 SoNode *simplifyMultiLevelsWithInline(); 00263 SoNode *simplifyMultiLevels(); 00264 SoNode *simplify(); 00265 00266 int shapeNum; 00267 00268 }; 00269 00270 #endif // _SO_SIMPLIFY_ACTION_ 00271 00272