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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user