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 : Pascal DOUX (May 1998) 00022 **=======================================================================*/ 00023 00024 00025 #ifndef _SO_REORGANIZE_ACTION_ 00026 #define _SO_REORGANIZE_ACTION_ 00027 00028 00029 //------------------------------------------------------------------------------ 00030 // Includes 00031 00032 #include <Inventor/actions/SoAction.h> 00033 #include <Inventor/actions/SoSubAction.h> 00034 #include <Inventor/actions/SoCallbackAction.h> 00035 #include <Inventor/actions/SoSimplifyAction.h> 00036 #include <Inventor/nodes/SoMaterial.h> 00037 #include <Inventor/fields/SoMFFloat.h> 00038 00039 #include <Inventor/SoType.h> 00040 00041 class SoSimplifier; 00042 00067 class SoReorganizeAction : public SoSimplifyAction 00068 { 00069 SO_ACTION_HEADER(SoReorganizeAction); 00070 00071 public: 00072 00076 SoReorganizeAction (SoSimplifier *_simplifier = NULL) ; 00077 00081 ~SoReorganizeAction(); 00082 00086 SoSeparator *getSimplifiedSceneGraph() const { return simplifiedRoot; } 00091 void generateNormals(SbBool g) { generateNormal = g;} 00095 SbBool areNormalGenerated() const { return generateNormal ;} 00100 void generateTriangleStrips(SbBool g) { generateTriangleStrip = g;} 00105 SbBool areTriangleStripGenerated() const { return generateTriangleStrip ;} 00111 void generateTexCoords(SbBool g) { generateTexCoord = g;} 00116 SbBool areTexCoordsGenerated() const { return generateTexCoord ;} 00122 void generateVPNodes(SbBool g) { generateVPNode = g;} 00127 SbBool areVPNodesGenerated() const { return generateVPNode ;} 00132 void matchIndexArrays(SbBool g) { matchIndexArray = g;} 00136 SbBool areIndexArraysMatched() const { return matchIndexArray ;} 00137 00141 SoSimplifier *getSimplifier() const { return simplifier ;} 00142 00147 SoNONUNICODE static void startReport(const char* msg); 00148 00152 static void startReport(const SbString& msg); 00153 00157 static void finishReport(); 00158 00160 virtual void apply(SoNode *node); 00161 00163 virtual void apply(SoPath *path); 00164 00166 virtual void apply(const SoPathList &path_list, SbBool obeys_rules=FALSE); 00167 00168 private: 00169 virtual void beginTraversal(SoNode *) { beginTraversal();} 00170 virtual void endTraversal (SoNode *) { endTraversal() ;} 00171 00172 private: 00173 static void initClass(); 00174 static void exitClass(); 00175 00176 private: 00177 00178 virtual void beginTraversal(); 00179 virtual void endTraversal (); 00180 00181 // new scene graph 00182 SoSeparator *simplifiedRoot; 00183 00184 // generate per-vertex normals 00185 SbBool generateNormal; 00186 00187 // generate Triangle Strips 00188 // only used if a not using a simplifier. Otherwise ignored. 00189 // FALSE by default 00190 SbBool generateTriangleStrip; 00191 00192 // generate Texture Coordinates 00193 SbBool generateTexCoord; 00194 00195 // generate Vertex Property Nodes 00196 SbBool generateVPNode; 00197 00198 // match Index Arrays 00199 SbBool matchIndexArray; 00200 00201 void simplifySingleLevel(); 00202 void simplifyMultiLevelsWithInline(); 00203 void simplifyMultiLevels(); 00204 void simplify(); 00205 00206 }; 00207 00208 00209 #endif // _SO_REORGANIZE_ACTION_ 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219