diff --git a/examples/osganalysis/osganalysis.cpp b/examples/osganalysis/osganalysis.cpp index a41c65c5f..176259412 100644 --- a/examples/osganalysis/osganalysis.cpp +++ b/examples/osganalysis/osganalysis.cpp @@ -28,6 +28,7 @@ #include #include +#include class StripStateVisitor : public osg::NodeVisitor { @@ -87,6 +88,14 @@ public: while (arguments.read("--dl")) { modifyDrawableSettings = true; useDisplayLists = true; } while (arguments.read("-s", simplificatioRatio)) {} + while (arguments.read("--tristripper")) { useTriStripVisitor=true; } + while (arguments.read("--no-tristripper")) { useTriStripVisitor=false; } + while (arguments.read("--smoother")) { useSmoothingVisitor=true; } + while (arguments.read("--no-smoother")) { useSmoothingVisitor=false; } + + while (arguments.read("--remove-duplicate-vertices") || arguments.read("--rdv")) removeDuplicateVertices = true; + while (arguments.read("--optimize-vertex-cache") || arguments.read("--ovc")) optimizeVertexCache = true; + while (arguments.read("--optimize-vertex-order") || arguments.read("--ovo")) optimizeVertexOrder = true; while (arguments.read("--build-mipmaps")) { modifyTextureSettings = true; buildImageMipmaps = true; } while (arguments.read("--compress")) { modifyTextureSettings = true; compressImages = true; } @@ -110,11 +119,35 @@ public: OSG_NOTICE<<"Running simplifier with simplification ratio="<accept(simplifier); } + if (removeDuplicateVertices) + { + OSG_NOTICE<<"Running osgUtil::IndexMeshVisitor"<accept(imv); + imv.makeMesh(); + } + + if (optimizeVertexCache) + { + OSG_NOTICE<<"Running osgUtil::VertexCacheVisitor"<accept(vcv); + vcv.optimizeVertices(); + } + + if (optimizeVertexOrder) + { + OSG_NOTICE<<"Running osgUtil::VertexAccessOrderVisitor"<accept(vaov); + vaov.optimizeOrder(); + } + if (modifyDrawableSettings || modifyTextureSettings) { OSG_NOTICE<<"Running StripStateVisitor"<accept(ssv); } - return node; } @@ -133,7 +165,14 @@ protected: modifyDrawableSettings = false; useVBO = false; useDisplayLists = false; + simplificatioRatio = 1.0; + useTriStripVisitor = false; + useSmoothingVisitor = false; + + removeDuplicateVertices = false; + optimizeVertexCache = false; + optimizeVertexOrder = false; modifyTextureSettings = false; buildImageMipmaps = false; @@ -144,7 +183,14 @@ protected: bool modifyDrawableSettings; bool useVBO; bool useDisplayLists; + float simplificatioRatio; + bool useTriStripVisitor; + bool useSmoothingVisitor; + + bool removeDuplicateVertices; + bool optimizeVertexCache; + bool optimizeVertexOrder; bool modifyTextureSettings; bool buildImageMipmaps;