21 #ifndef _OF_DISTANCEACCUMULATOR_ 22 #define _OF_DISTANCEACCUMULATOR_ 26 #include <osg/NodeVisitor> 27 #include <osg/Polytope> 28 #include <osg/fast_back_stack> 44 typedef std::pair<double, double> DistancePair;
45 typedef std::vector<DistancePair> PairList;
50 virtual void apply(osg::Node &node);
51 virtual void apply(osg::Projection &proj);
52 virtual void apply(osg::Transform &transform);
53 virtual void apply(osg::Geode &geode);
56 void setMatrices(
const osg::Matrix &modelview,
57 const osg::Matrix &projection);
64 void computeCameraPairs();
67 PairList& getCameraPairs() {
return _cameraPairs; }
70 PairList& getDistancePairs() {
return _distancePairs; }
73 DistancePair& getLimits() {
return _limits; }
76 void setNearFarRatio(
double ratio);
77 inline double getNearFarRatio()
const {
return _nearFarRatio; }
80 inline void setMaxDepth(
unsigned int depth) { _maxDepth = depth; }
81 inline unsigned int getMaxDepth()
const {
return _maxDepth; }
84 inline void setMinZNear(
double minZNear) {
if(minZNear >= 0.0) _minZNear = minZNear; }
85 inline double getMinZNear() {
return _minZNear; }
90 void pushLocalFrustum();
91 void pushDistancePair(
double zNear,
double zFar);
92 bool shouldContinueTraversal(osg::Node &node);
95 osg::fast_back_stack<osg::Matrix> _viewMatrices;
96 osg::fast_back_stack<osg::Matrix> _projectionMatrices;
99 osg::Matrix _modelview, _projection;
102 osg::fast_back_stack<osg::Polytope> _localFrusta;
105 typedef std::pair<unsigned int, unsigned int> bbCornerPair;
106 osg::fast_back_stack<bbCornerPair> _bbCorners;
109 PairList _cameraPairs;
112 PairList _distancePairs;
115 DistancePair _limits;
118 double _nearFarRatio;
121 unsigned int _maxDepth, _currentDepth;
This class computes distances to drawables and splits the scene if necessary.
Definition: DistanceAccumulator.hpp:41
Definition: CoordinateAxes.hpp:29