Cleanin' up after Robert's spelling ...er ... challenges.
This commit is contained in:
@@ -30,11 +30,11 @@ class OSGUTIL_EXPORT Optimizer
|
||||
enum OptimizationOptions
|
||||
{
|
||||
FLATTEN_STATIC_TRANSFORMS = 0x1,
|
||||
REMOVE_REDUNDENT_NODES = 0x2,
|
||||
REMOVE_REDUNDANT_NODES = 0x2,
|
||||
COMBINE_ADJACENT_LODS = 0x4,
|
||||
SHARE_DUPLICATE_STATE = 0x8,
|
||||
ALL_OPTIMIZATIONS = FLATTEN_STATIC_TRANSFORMS |
|
||||
REMOVE_REDUNDENT_NODES |
|
||||
REMOVE_REDUNDANT_NODES |
|
||||
COMBINE_ADJACENT_LODS |
|
||||
SHARE_DUPLICATE_STATE
|
||||
};
|
||||
@@ -59,7 +59,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
/** Flatten Static Trasform nodes by applying their transform to the
|
||||
* geometry on the leaves of the scene graph, then removing the
|
||||
* now redundent transforms.*/
|
||||
* now redundant transforms.*/
|
||||
class OSGUTIL_EXPORT FlattenStaticTransformsVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
@@ -93,14 +93,14 @@ class OSGUTIL_EXPORT Optimizer
|
||||
};
|
||||
|
||||
|
||||
/** Remove rendundent nodes, such as groups with one single child.*/
|
||||
/** Remove rendundant nodes, such as groups with one single child.*/
|
||||
class OSGUTIL_EXPORT RemoveEmptyNodesVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
typedef std::set<osg::Node*> NodeList;
|
||||
NodeList _redundentNodeList;
|
||||
NodeList _redundantNodeList;
|
||||
|
||||
RemoveEmptyNodesVisitor():osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
|
||||
@@ -111,20 +111,20 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
};
|
||||
|
||||
/** Remove rendundent nodes, such as groups with one single child.*/
|
||||
class OSGUTIL_EXPORT RemoveRedundentNodesVisitor : public osg::NodeVisitor
|
||||
/** Remove rendundant nodes, such as groups with one single child.*/
|
||||
class OSGUTIL_EXPORT RemoveRedundantNodesVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::set<osg::Node*> NodeList;
|
||||
NodeList _redundentNodeList;
|
||||
NodeList _redundantNodeList;
|
||||
|
||||
RemoveRedundentNodesVisitor():osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
RemoveRedundantNodesVisitor():osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
|
||||
virtual void apply(osg::Group& group);
|
||||
virtual void apply(osg::Transform& transform);
|
||||
|
||||
void removeRedundentNodes();
|
||||
void removeRedundantNodes();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -50,16 +50,16 @@ void Optimizer::optimize(osg::Node* node, unsigned int options)
|
||||
}
|
||||
|
||||
|
||||
if (options & REMOVE_REDUNDENT_NODES)
|
||||
if (options & REMOVE_REDUNDANT_NODES)
|
||||
{
|
||||
|
||||
RemoveEmptyNodesVisitor renv;
|
||||
node->accept(renv);
|
||||
renv.removeEmptyNodes();
|
||||
|
||||
RemoveRedundentNodesVisitor rrnv;
|
||||
RemoveRedundantNodesVisitor rrnv;
|
||||
node->accept(rrnv);
|
||||
rrnv.removeRedundentNodes();
|
||||
rrnv.removeRedundantNodes();
|
||||
|
||||
}
|
||||
|
||||
@@ -809,7 +809,7 @@ void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Geode& geode)
|
||||
{
|
||||
if (geode.getNumParents()>0)
|
||||
{
|
||||
if (geode.getNumDrawables()==0) _redundentNodeList.insert(&geode);
|
||||
if (geode.getNumDrawables()==0) _redundantNodeList.insert(&geode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Group& group)
|
||||
if (group.getNumChildren()==0 &&
|
||||
(typeid(group)==typeid(osg::Group) || dynamic_cast<osg::Transform*>(&group)))
|
||||
{
|
||||
_redundentNodeList.insert(&group);
|
||||
_redundantNodeList.insert(&group);
|
||||
}
|
||||
}
|
||||
traverse(group);
|
||||
@@ -833,10 +833,10 @@ void Optimizer::RemoveEmptyNodesVisitor::removeEmptyNodes()
|
||||
NodeList newEmptyGroups;
|
||||
|
||||
// keep iterator through until scene graph is cleaned of empty nodes.
|
||||
while (!_redundentNodeList.empty())
|
||||
while (!_redundantNodeList.empty())
|
||||
{
|
||||
for(NodeList::iterator itr=_redundentNodeList.begin();
|
||||
itr!=_redundentNodeList.end();
|
||||
for(NodeList::iterator itr=_redundantNodeList.begin();
|
||||
itr!=_redundantNodeList.end();
|
||||
++itr)
|
||||
{
|
||||
|
||||
@@ -859,17 +859,17 @@ void Optimizer::RemoveEmptyNodesVisitor::removeEmptyNodes()
|
||||
}
|
||||
}
|
||||
|
||||
_redundentNodeList.clear();
|
||||
_redundentNodeList.swap(newEmptyGroups);
|
||||
_redundantNodeList.clear();
|
||||
_redundantNodeList.swap(newEmptyGroups);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// RemoveRedundentNodes.
|
||||
// RemoveRedundantNodes.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Optimizer::RemoveRedundentNodesVisitor::apply(osg::Group& group)
|
||||
void Optimizer::RemoveRedundantNodesVisitor::apply(osg::Group& group)
|
||||
{
|
||||
if (group.getNumParents()>0)
|
||||
{
|
||||
@@ -882,7 +882,7 @@ void Optimizer::RemoveRedundentNodesVisitor::apply(osg::Group& group)
|
||||
!group.getStateSet() &&
|
||||
group.getNodeMask()==0xffffffff)
|
||||
{
|
||||
_redundentNodeList.insert(&group);
|
||||
_redundantNodeList.insert(&group);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -890,7 +890,7 @@ void Optimizer::RemoveRedundentNodesVisitor::apply(osg::Group& group)
|
||||
traverse(group);
|
||||
}
|
||||
|
||||
void Optimizer::RemoveRedundentNodesVisitor::apply(osg::Transform& transform)
|
||||
void Optimizer::RemoveRedundantNodesVisitor::apply(osg::Transform& transform)
|
||||
{
|
||||
if (transform.getNumParents()>0 && transform.getDataVariance()==osg::Object::STATIC)
|
||||
{
|
||||
@@ -899,18 +899,18 @@ void Optimizer::RemoveRedundentNodesVisitor::apply(osg::Transform& transform)
|
||||
transform.getWorldToLocalMatrix(matrix,NULL);
|
||||
if (matrix==identity)
|
||||
{
|
||||
_redundentNodeList.insert(&transform);
|
||||
_redundantNodeList.insert(&transform);
|
||||
}
|
||||
}
|
||||
traverse(transform);
|
||||
}
|
||||
|
||||
|
||||
void Optimizer::RemoveRedundentNodesVisitor::removeRedundentNodes()
|
||||
void Optimizer::RemoveRedundantNodesVisitor::removeRedundantNodes()
|
||||
{
|
||||
|
||||
for(NodeList::iterator itr=_redundentNodeList.begin();
|
||||
itr!=_redundentNodeList.end();
|
||||
for(NodeList::iterator itr=_redundantNodeList.begin();
|
||||
itr!=_redundantNodeList.end();
|
||||
++itr)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> group = dynamic_cast<osg::Group*>(*itr);
|
||||
@@ -937,7 +937,7 @@ void Optimizer::RemoveRedundentNodesVisitor::removeRedundentNodes()
|
||||
std::cout<<"failed dynamic_cast"<<std::endl;
|
||||
}
|
||||
}
|
||||
_redundentNodeList.clear();
|
||||
_redundantNodeList.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user