Added CullVisitor::Identifier to help with cull operations that require a consistent identifier for

cull traveresals when osgViewer::Renderer uses double buffering.
This commit is contained in:
Robert Osfield
2011-03-17 13:54:14 +00:00
parent 307bf7002f
commit e28f9a7d32
2 changed files with 16 additions and 3 deletions

View File

@@ -70,9 +70,19 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
virtual void reset();
struct Identifier : public osg::Referenced
{
Identifier() {}
virtual ~Identifier() {}
};
void setIdentifier(Identifier* identifier) { _identifier = identifier; }
Identifier* getIdentifier() { return _identifier.get(); }
const Identifier* getIdentifier() const { return _identifier.get(); }
virtual osg::Vec3 getEyePoint() const { return getEyeLocal(); }
virtual osg::Vec3 getViewPoint() const { return getViewPointLocal(); }
virtual float getDistanceToEyePoint(const osg::Vec3& pos, bool withLODScale) const;
virtual float getDistanceFromEyePoint(const osg::Vec3& pos, bool withLODScale) const;
@@ -369,7 +379,8 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
typedef std::multimap<value_type, MatrixPlanesDrawables> DistanceMatrixDrawableMap;
DistanceMatrixDrawableMap _nearPlaneCandidateMap;
osg::ref_ptr<Identifier> _identifier;
};
inline void CullVisitor::addDrawable(osg::Drawable* drawable,osg::RefMatrix* matrix)

View File

@@ -53,6 +53,7 @@ CullVisitor::CullVisitor():
_currentReuseRenderLeafIndex(0),
_numberOfEncloseOverrideRenderBinDetails(0)
{
_identifier = new Identifier;
}
CullVisitor::CullVisitor(const CullVisitor& rhs):
@@ -63,7 +64,8 @@ CullVisitor::CullVisitor(const CullVisitor& rhs):
_computed_znear(FLT_MAX),
_computed_zfar(-FLT_MAX),
_currentReuseRenderLeafIndex(0),
_numberOfEncloseOverrideRenderBinDetails(0)
_numberOfEncloseOverrideRenderBinDetails(0),
_identifier(rhs._identifier)
{
}