This commit is contained in:
d-a-heitbrink
2017-03-01 16:12:49 -06:00
59 changed files with 1001 additions and 874 deletions

View File

@@ -168,13 +168,22 @@ class OSG_EXPORT CullStack : public osg::CullSettings
return osg::Vec3(-matrix(0,2),-matrix(1,2),-matrix(2,2));
}
typedef fast_back_stack< ref_ptr<RefMatrix> > MatrixStack;
MatrixStack& getProjectionStack() { return _projectionStack; }
const MatrixStack& getProjectionStack() const { return _projectionStack; }
MatrixStack& getModelViewStack() { return _modelviewStack; }
const MatrixStack& getModelViewStack() const { return _modelviewStack; }
MatrixStack& getMVPWStack() { return _MVPW_Stack; }
const MatrixStack& getMVPWStack() const { return _MVPW_Stack; }
protected:
// base set of shadow volume occluder to use in culling.
ShadowVolumeOccluderList _occluderList;
typedef fast_back_stack< ref_ptr<RefMatrix> > MatrixStack;
MatrixStack _projectionStack;

View File

@@ -61,7 +61,6 @@ namespace osgDB {
void share(osg::Node *node, OpenThreads::Mutex *mt=0);
void apply(osg::Node& node);
void apply(osg::Geode& geode);
// Answers the question "Will this state set be eliminated by
// the SharedStateManager because an equivalent one has been

View File

@@ -106,11 +106,11 @@ class OSGGA_EXPORT EventVisitor : public osg::NodeVisitor
handle_callbacks(drawable.getStateSet());
}
// The following overrides are technically redundant as the default implementation would eventually trickle down to
// apply(osg::Node&); - however defining these explicitely should save a couple of virtual function calls
virtual void apply(osg::Geode& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Billboard& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::LightSource& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Group& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Transform& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Projection& node) { handle_callbacks_and_traverse(node); }

View File

@@ -48,8 +48,6 @@ class OSGUTIL_EXPORT DisplayRequirementsVisitor : public osg::NodeVisitor
virtual void apply(osg::Node& node);
virtual void apply(osg::Geode& geode);
protected:
osg::ref_ptr<osg::DisplaySettings> _ds;

View File

@@ -34,7 +34,7 @@ class OSGUTIL_EXPORT DrawElementTypeSimplifierVisitor : public osg::NodeVisitor
META_NodeVisitor(osgUtil, DrawElementTypeSimplifierVisitor);
void apply(osg::Geode& node);
void apply(osg::Geometry& geom);
};
}

View File

@@ -94,11 +94,6 @@ class OSGUTIL_EXPORT GLObjectsVisitor : public osg::NodeVisitor
/** Simply traverse using standard NodeVisitor traverse method.*/
virtual void apply(osg::Node& node);
/** For each Geode visited set the display list usage according to the
* _displayListMode.
*/
virtual void apply(osg::Geode& node);
void apply(osg::Drawable& drawable);
void apply(osg::StateSet& stateset);

View File

@@ -33,7 +33,7 @@ public:
Optimizer::OptimizationOptions options)
: BaseOptimizerVisitor(optimizer, options) {}
void reset();
void apply(osg::Geode& geode);
void apply(osg::Geometry& geom);
typedef std::set<osg::Geometry*> GeometryList;
GeometryList& getGeometryList() { return _geometryList; };
protected:
@@ -77,7 +77,7 @@ class OSGUTIL_EXPORT VertexCacheMissVisitor : public osg::NodeVisitor
public:
VertexCacheMissVisitor(unsigned cacheSize = 16);
void reset();
virtual void apply(osg::Geode& geode);
virtual void apply(osg::Geometry& geom);
void doGeometry(osg::Geometry& geom);
unsigned misses;
unsigned triangles;

View File

@@ -73,7 +73,7 @@ class OSGUTIL_EXPORT Optimizer
COMBINE_ADJACENT_LODS = (1 << 3),
SHARE_DUPLICATE_STATE = (1 << 4),
MERGE_GEOMETRY = (1 << 5),
CHECK_GEOMETRY = (1 << 6),
CHECK_GEOMETRY = (1 << 6), // deprecated, currently no-op
MAKE_FAST_GEOMETRY = (1 << 7),
SPATIALIZE_GROUPS = (1 << 8),
COPY_SHARED_NODES = (1 << 9),
@@ -275,7 +275,7 @@ class OSGUTIL_EXPORT Optimizer
BaseOptimizerVisitor(optimizer, FLATTEN_STATIC_TRANSFORMS) {}
virtual void apply(osg::Node& geode);
virtual void apply(osg::Geode& 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);
@@ -360,7 +360,6 @@ class OSGUTIL_EXPORT Optimizer
RemoveEmptyNodesVisitor(Optimizer* optimizer=0):
BaseOptimizerVisitor(optimizer, REMOVE_REDUNDANT_NODES) {}
virtual void apply(osg::Geode& geode);
virtual void apply(osg::Group& group);
void removeEmptyNodes();
@@ -404,7 +403,7 @@ class OSGUTIL_EXPORT Optimizer
};
/** Tessellate all geodes, to remove POLYGONS.*/
/** Tessellate all Geometries, to remove POLYGONS.*/
class OSGUTIL_EXPORT TessellateVisitor : public BaseOptimizerVisitor
{
public:
@@ -415,7 +414,7 @@ class OSGUTIL_EXPORT Optimizer
TessellateVisitor(Optimizer* optimizer=0):
BaseOptimizerVisitor(optimizer, TESSELLATE_GEOMETRY) {}
virtual void apply(osg::Geode& geode);
virtual void apply(osg::Geometry& geom);
};
@@ -461,8 +460,6 @@ class OSGUTIL_EXPORT Optimizer
virtual void apply(osg::Node& node);
virtual void apply(osg::Geode& geode);
void optimize();
protected:
@@ -504,20 +501,6 @@ class OSGUTIL_EXPORT Optimizer
};
class OSGUTIL_EXPORT CheckGeometryVisitor : public BaseOptimizerVisitor
{
public:
/// default to traversing all children.
CheckGeometryVisitor(Optimizer* optimizer=0):
BaseOptimizerVisitor(optimizer, CHECK_GEOMETRY) {}
virtual void apply(osg::Geode& geode) { checkGeode(geode); }
void checkGeode(osg::Geode& geode);
};
class OSGUTIL_EXPORT MakeFastGeometryVisitor : public BaseOptimizerVisitor
{
public:
@@ -526,9 +509,7 @@ class OSGUTIL_EXPORT Optimizer
MakeFastGeometryVisitor(Optimizer* optimizer=0):
BaseOptimizerVisitor(optimizer, MAKE_FAST_GEOMETRY) {}
virtual void apply(osg::Geode& geode) { checkGeode(geode); }
void checkGeode(osg::Geode& geode);
virtual void apply(osg::Geometry& geom);
};
@@ -627,7 +608,6 @@ class OSGUTIL_EXPORT Optimizer
_changeClientImageStorage(changeClientImageStorage), _valueClientImageStorage(valueClientImageStorage),
_changeAnisotropy(changeAnisotropy), _valueAnisotropy(valueAnisotropy) {}
virtual void apply(osg::Geode& node);
virtual void apply(osg::Node& node);
void apply(osg::StateSet& stateset);
@@ -816,8 +796,7 @@ class OSGUTIL_EXPORT Optimizer
virtual void reset();
virtual void apply(osg::Node& node);
virtual void apply(osg::Geode& geode);
virtual void apply(osg::Drawable& node);
void optimize();
@@ -850,15 +829,12 @@ class OSGUTIL_EXPORT Optimizer
BaseOptimizerVisitor(optimizer, STATIC_OBJECT_DETECTION) {}
virtual void apply(osg::Node& node);
virtual void apply(osg::Geode& geode);
virtual void apply(osg::Drawable& drawable);
protected:
void applyStateSet(osg::StateSet& stateset);
void applyDrawable(osg::Drawable& drawable);
};
/** For all geometry apply settings.*/

View File

@@ -67,7 +67,7 @@ public:
osg::StateSet *getRootStateSet() const { return _rootStateSet.get(); }
void apply(osg::Node &node);
void apply(osg::Geode &geode);
void apply(osg::Drawable &drawable);
void reset();

View File

@@ -97,16 +97,9 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor
return getSampleRatio()<1.0;
}
virtual void apply(osg::Geode& geode)
virtual void apply(osg::Geometry& geom)
{
for(unsigned int i=0;i<geode.getNumDrawables();++i)
{
osg::Geometry* geometry = geode.getDrawable(i)->asGeometry();
if (geometry)
{
simplify(*geometry);
}
}
simplify(geom);
}
/** simply the geometry.*/

View File

@@ -36,8 +36,8 @@ class OSGUTIL_EXPORT SmoothingVisitor : public osg::NodeVisitor
/// smooth geoset by creating per vertex normals.
static void smooth(osg::Geometry& geoset, double creaseAngle=osg::PI);
/// apply smoothing method to all geode geosets.
virtual void apply(osg::Geode& geode);
/// apply smoothing method to all geometries.
virtual void apply(osg::Geometry& geom);
/// set the maximum angle, in radians, at which angle between adjacent triangles that normals are smoothed
/// for edges that greater the shared vertices are duplicated

View File

@@ -53,7 +53,7 @@ class OSGUTIL_EXPORT TriStripVisitor : public BaseOptimizerVisitor
void stripify();
/// Accumulate the Geometry drawables to make into strips.
virtual void apply(osg::Geode& geode);
virtual void apply(osg::Geometry& geom);
inline void setCacheSize( unsigned int size )
{

View File

@@ -73,11 +73,11 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
handle_callbacks(drawable.getStateSet());
}
// The following overrides are technically redundant as the default implementation would eventually trickle down to
// apply(osg::Node&); - however defining these explicitely should save a couple of virtual function calls
virtual void apply(osg::Geode& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Billboard& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::LightSource& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Group& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Transform& node) { handle_callbacks_and_traverse(node); }
virtual void apply(osg::Projection& node) { handle_callbacks_and_traverse(node); }