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 (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 00068 class SoReorganizeAction : public SoSimplifyAction 00069 { 00070 SO_ACTION_HEADER(SoReorganizeAction); 00071 00072 public: 00073 00077 SoReorganizeAction (SoSimplifier *_simplifier = NULL) ; 00078 00082 ~SoReorganizeAction(); 00083 00087 SoSeparator *getSimplifiedSceneGraph() const { return simplifiedRoot; } 00092 void generateNormals(SbBool g) { generateNormal = g;} 00096 SbBool areNormalGenerated() const { return generateNormal ;} 00101 void generateTriangleStrips(SbBool g) { generateTriangleStrip = g;} 00106 SbBool areTriangleStripGenerated() const { return generateTriangleStrip ;} 00112 void generateTexCoords(SbBool g) { generateTexCoord = g;} 00117 SbBool areTexCoordsGenerated() const { return generateTexCoord ;} 00123 void generateVPNodes(SbBool g) { generateVPNode = g;} 00128 SbBool areVPNodesGenerated() const { return generateVPNode ;} 00133 void matchIndexArrays(SbBool g) { matchIndexArray = g;} 00137 SbBool areIndexArraysMatched() const { return matchIndexArray ;} 00138 00142 SoSimplifier *getSimplifier() const { return simplifier ;} 00143 00148 SoNONUNICODE static void startReport(const char* msg); 00149 00153 static void startReport(const SbString& msg); 00154 00158 static void finishReport(); 00159 00160 private: 00161 virtual void beginTraversal(SoNode *) { beginTraversal();} 00162 virtual void endTraversal (SoNode *) { endTraversal() ;} 00163 00164 private: 00165 static void initClass(); 00166 static void exitClass(); 00167 00168 // Not necessary to document these - interface is same as SoAction 00169 virtual void apply(SoNode *node); 00170 virtual void apply(SoPath *path); 00171 virtual void apply(const SoPathList &path_list, SbBool obeys_rules=FALSE); 00172 00173 private: 00174 00175 virtual void beginTraversal(); 00176 virtual void endTraversal (); 00177 00178 // new scene graph 00179 SoSeparator *simplifiedRoot; 00180 00181 // generate per-vertex normals 00182 SbBool generateNormal; 00183 00184 // generate Triangle Strips 00185 // only used if a not using a simplifier. Otherwise ignored. 00186 // FALSE by default 00187 SbBool generateTriangleStrip; 00188 00189 // generate Texture Coordinates 00190 SbBool generateTexCoord; 00191 00192 // generate Vertex Property Nodes 00193 SbBool generateVPNode; 00194 00195 // match Index Arrays 00196 SbBool matchIndexArray; 00197 00198 void simplifySingleLevel(); 00199 void simplifyMultiLevelsWithInline(); 00200 void simplifyMultiLevels(); 00201 void simplify(); 00202 00203 }; 00204 00205 00206 #endif // _SO_REORGANIZE_ACTION_ 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216