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-2014 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_LEVEL_OF_SIMPLIFICATION_ 00026 #define _SO_LEVEL_OF_SIMPLIFICATION_ 00027 00028 #include <Inventor/fields/SoMFFloat.h> 00029 #include <Inventor/fields/SoSFInt32.h> 00030 #include <Inventor/nodes/SoLOD.h> 00031 00033 // 00034 // Class: SoLevelOfSimplification 00035 // 00036 // Level-of-simplfication group node. The children of this node typically 00037 // represent the same object or objects at varying levels of detail, 00038 // from highest detail to lowest. 00039 // 00040 // The group node is derived from SoLOD, and adds a new field 00041 // "percentages", which can be used to specify how complex 00042 // a representation each child is. The first child is assumed 00043 // to be the 1.0 representation, and then each value in the 00044 // "percentages" field specifies what percentage reduction 00045 // this representation is. 00046 // 00047 // If a full model has 1000 triangles, and there are two lower 00048 // levels of detail: one with 500 triangles and the other with 250, 00049 // then the percentages field should be [0.5, 0.25] 00050 // 00051 // This node will react to the Decimation element, forcing this 00052 // node to choose the representation with a certain percentage 00053 // detail. 00054 // If DecimationType is LOWEST or HIGHEST, this node will choose 00055 // the lowest or highest child. 00056 // 00057 // If DecimationType is PERCENTAGE, and DecimationValue "D", 00058 // this node will choose Child "i" such that: 00059 // percentages[i-1] <= D < percentages[i] 00060 // 00061 // If DeciamtionType is AUTOMATIC, then the child is chosen 00062 // based on the range value in the usual SoLOD manner, but 00063 // no child greater than the value of the DecimationPercentage 00064 // element will be chosen. 00065 // 00066 // You should specify N percentages for N+1 children. 00067 // 00069 00140 class SoLevelOfSimplification : public SoLOD { 00141 00142 SO_NODE_HEADER(SoLevelOfSimplification); 00143 00144 public: 00145 // Fields 00151 SoMFFloat percentages; 00157 SoSFInt32 numTriangles; 00158 00162 SoLevelOfSimplification(); 00163 00167 SoLevelOfSimplification(int nChildren); 00168 00169 00170 private: 00171 static void initClass(); 00172 static void exitClass(); 00173 00174 private: 00175 // Implement actions: 00176 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action); 00177 00178 00179 private: 00180 virtual ~SoLevelOfSimplification(); 00181 00182 virtual int whichToTraverse(SoAction *); 00183 }; 00184 00185 #endif /* _SO_LEVEL_OF_SIMPLIFICATION_ */ 00186 00187