From f7cb4bd245f719772e2abdb637bb47d40849900b Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 23 Feb 2017 19:46:54 +0100 Subject: [PATCH] optimizer: remove some cruft --- components/sceneutil/optimizer.cpp | 97 +++--------------------------- components/sceneutil/optimizer.hpp | 2 - 2 files changed, 7 insertions(+), 92 deletions(-) diff --git a/components/sceneutil/optimizer.cpp b/components/sceneutil/optimizer.cpp index 36d589170..956c9053b 100644 --- a/components/sceneutil/optimizer.cpp +++ b/components/sceneutil/optimizer.cpp @@ -18,29 +18,18 @@ #include "optimizer.hpp" -#include #include #include #include #include #include -#include #include #include -#include -#include -#include #include -#include -#include -#include #include -#include #include #include -#include -#include #include #include @@ -53,6 +42,9 @@ using namespace osgUtil; +namespace SceneUtil +{ + void Optimizer::reset() { } @@ -90,20 +82,6 @@ void Optimizer::optimize(osg::Node* node, unsigned int options) cstv.removeTransforms(node); } - if (options & MERGE_GEODES) - { - OSG_INFO<<"Optimizer::optimize() doing MERGE_GEODES"<tick(); - - MergeGeodesVisitor visitor; - node->accept(visitor); - - osg::Timer_t endTick = osg::Timer::instance()->tick(); - - OSG_INFO<<"MERGE_GEODES took "<delta_s(startTick,endTick)<delta_s(startTick,endTick)<accept(tsv); - tsv.stripify(); - } - if (options & REMOVE_REDUNDANT_NODES) { OSG_INFO<<"Optimizer::optimize() doing REMOVE_REDUNDANT_NODES"<accept(fbv); - fbv.process(); - } - - if (options & SPATIALIZE_GROUPS) - { - OSG_INFO<<"Optimizer::optimize() doing SPATIALIZE_GROUPS"<accept(sv); - sv.divide(); - } - - if (options & INDEX_MESH) - { - OSG_INFO<<"Optimizer::optimize() doing INDEX_MESH"<accept(imv); - imv.makeMesh(); - } - if (options & VERTEX_POSTTRANSFORM) { OSG_INFO<<"Optimizer::optimize() doing VERTEX_POSTTRANSFORM"<supports(_transformFunctor)) return false; return BaseOptimizerVisitor::isOperationPermissibleForObject(drawable); } inline bool isOperationPermissibleForObject(const osg::Node* node) const { - // disable if object is a light point node. - if (strcmp(node->className(),"LightPointNode")==0) return false; - if (dynamic_cast(node)) return false; - if (dynamic_cast(node)) return false; return BaseOptimizerVisitor::isOperationPermissibleForObject(node); } @@ -634,27 +573,9 @@ bool CollectLowestTransformsVisitor::removeTransforms(osg::Node* nodeWeCannotRem void Optimizer::FlattenStaticTransformsVisitor::apply(osg::Node& node) { - if (strcmp(node.className(),"LightPointNode")==0) - { - _excludedNodeSet.insert(&node); - } - traverse(node); -} - - -void Optimizer::FlattenStaticTransformsVisitor::apply(osg::ProxyNode& node) -{ - _excludedNodeSet.insert(&node); - traverse(node); } -void Optimizer::FlattenStaticTransformsVisitor::apply(osg::PagedLOD& node) -{ - _excludedNodeSet.insert(&node); - - traverse(node); -} void Optimizer::FlattenStaticTransformsVisitor::apply(osg::Drawable& drawable) { @@ -811,7 +732,7 @@ void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Group& group) { // only remove empty groups, but not empty occluders. if (group.getNumChildren()==0 && isOperationPermissibleForObject(&group) && - (typeid(group)==typeid(osg::Group) || (dynamic_cast(&group) && !dynamic_cast(&group))) && + (typeid(group)==typeid(osg::Group) || (dynamic_cast(&group))) && (group.getNumChildrenRequiringUpdateTraversal()==0 && group.getNumChildrenRequiringEventTraversal()==0) ) { _redundantNodeList.insert(&group); @@ -843,13 +764,8 @@ void Optimizer::RemoveEmptyNodesVisitor::removeEmptyNodes() ++pitr) { osg::Group* parent = *pitr; - if (!dynamic_cast(parent) && - !dynamic_cast(parent) && - strcmp(parent->className(),"MultiSwitch")!=0) - { - parent->removeChild(nodeToRemove.get()); - if (parent->getNumChildren()==0 && isOperationPermissibleForObject(parent)) newEmptyGroups.insert(parent); - } + parent->removeChild(nodeToRemove.get()); + if (parent->getNumChildren()==0 && isOperationPermissibleForObject(parent)) newEmptyGroups.insert(parent); } } @@ -1887,3 +1803,4 @@ bool Optimizer::MergeGeometryVisitor::mergePrimitive(osg::DrawElementsUInt& lhs, return true; } +} diff --git a/components/sceneutil/optimizer.hpp b/components/sceneutil/optimizer.hpp index c58b57b11..d2a63a32a 100644 --- a/components/sceneutil/optimizer.hpp +++ b/components/sceneutil/optimizer.hpp @@ -270,8 +270,6 @@ class Optimizer virtual void apply(osg::Node& geode); virtual void apply(osg::Drawable& drawable); virtual void apply(osg::Billboard& geode); - virtual void apply(osg::ProxyNode& node); - virtual void apply(osg::PagedLOD& node); virtual void apply(osg::Transform& transform); bool removeTransforms(osg::Node* nodeWeCannotRemove);