Moved BaseOptimizerVisitor out of Optimizer into osgUtil namespace to try and
get round MipsPro compile problems.
This commit is contained in:
parent
3a4b09940b
commit
3b4636311b
@ -25,6 +25,30 @@
|
||||
|
||||
namespace osgUtil {
|
||||
|
||||
// forward declare
|
||||
class Optimizer;
|
||||
|
||||
/** Helper base class for implementing Optimizer techniques.*/
|
||||
class OSGUTIL_EXPORT BaseOptimizerVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
BaseOptimizerVisitor(Optimizer* optimizer, unsigned int operation):
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
||||
_optimizer(optimizer),
|
||||
_operationType(operation) {}
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::StateSet* object) const;
|
||||
inline bool isOperationPermissibleForObject(const osg::StateAttribute* object) const;
|
||||
inline bool isOperationPermissibleForObject(const osg::Drawable* object) const;
|
||||
inline bool isOperationPermissibleForObject(const osg::Node* object) const;
|
||||
|
||||
protected:
|
||||
|
||||
Optimizer* _optimizer;
|
||||
unsigned int _operationType;
|
||||
};
|
||||
|
||||
/** Traverses scene graph to improve efficiency. See OptimizationOptions.
|
||||
* For example of usage see examples/osgimpostor or osgviewer.
|
||||
*/
|
||||
@ -212,42 +236,6 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
public:
|
||||
|
||||
|
||||
class OSGUTIL_EXPORT BaseOptimizerVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
BaseOptimizerVisitor(Optimizer* optimizer, unsigned int operation):
|
||||
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
|
||||
_optimizer(optimizer),
|
||||
_operationType(operation) {}
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::StateSet* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::StateAttribute* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::Drawable* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool isOperationPermissibleForObject(const osg::Node* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
Optimizer* _optimizer;
|
||||
unsigned int _operationType;
|
||||
};
|
||||
|
||||
/** Flatten Static Transform nodes by applying their transform to the
|
||||
* geometry on the leaves of the scene graph, then removing the
|
||||
* now redundant transforms.*/
|
||||
@ -538,6 +526,26 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
};
|
||||
|
||||
inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::StateSet* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::StateAttribute* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::Drawable* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
inline bool BaseOptimizerVisitor::isOperationPermissibleForObject(const osg::Node* object) const
|
||||
{
|
||||
return _optimizer ? _optimizer->isOperationPermissibleForObject(object,_operationType) : true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -27,13 +27,13 @@ namespace osgUtil {
|
||||
/** A tri stripping visitor for converting Geometry surface primitives into tri strips.
|
||||
* The current implemention is based upon Tanguy Fautre's triangulation code.
|
||||
*/
|
||||
class OSGUTIL_EXPORT TriStripVisitor : public Optimizer::BaseOptimizerVisitor
|
||||
class OSGUTIL_EXPORT TriStripVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
/// default to traversing all children.
|
||||
TriStripVisitor(Optimizer* optimizer=0) :
|
||||
Optimizer::BaseOptimizerVisitor( optimizer, Optimizer::TRISTRIP_GEOMETRY),
|
||||
BaseOptimizerVisitor( optimizer, Optimizer::TRISTRIP_GEOMETRY),
|
||||
_cacheSize( 16 ),
|
||||
_minStripSize( 2 ),
|
||||
_generateFourPointPrimitivesQuads ( false)
|
||||
|
@ -565,13 +565,13 @@ void Optimizer::StateVisitor::optimize()
|
||||
// Flatten static transforms
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CollectLowestTransformsVisitor : public Optimizer::BaseOptimizerVisitor
|
||||
class CollectLowestTransformsVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
CollectLowestTransformsVisitor(Optimizer* optimizer=0):
|
||||
Optimizer::BaseOptimizerVisitor(optimizer,Optimizer::FLATTEN_STATIC_TRANSFORMS),
|
||||
BaseOptimizerVisitor(optimizer,Optimizer::FLATTEN_STATIC_TRANSFORMS),
|
||||
_transformFunctor(osg::Matrix())
|
||||
{
|
||||
setTraversalMode(osg::NodeVisitor::TRAVERSE_PARENTS);
|
||||
|
Loading…
Reference in New Issue
Block a user