diff --git a/components/terrain/quadtreenode.cpp b/components/terrain/quadtreenode.cpp index 99f60827d..5eb59a6a2 100644 --- a/components/terrain/quadtreenode.cpp +++ b/components/terrain/quadtreenode.cpp @@ -58,6 +58,7 @@ QuadTreeNode* searchNeighbour (QuadTreeNode* currentNode, Direction dir) QuadTreeNode::QuadTreeNode(QuadTreeNode* parent, ChildDirection direction, float size, const osg::Vec2f& center) : mParent(parent) , mDirection(direction) + , mValidBounds(false) , mSize(size) , mCenter(center) { @@ -90,6 +91,9 @@ void QuadTreeNode::initNeighbours() void QuadTreeNode::traverse(osg::NodeVisitor &nv) { + if (!hasValidBounds()) + return; + if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR) { osgUtil::CullVisitor* cv = static_cast(&nv); @@ -136,6 +140,7 @@ ViewData* QuadTreeNode::getView(osg::NodeVisitor &nv) void QuadTreeNode::setBoundingBox(const osg::BoundingBox &boundingBox) { mBoundingBox = boundingBox; + mValidBounds = boundingBox.valid(); dirtyBound(); getBound(); } diff --git a/components/terrain/quadtreenode.hpp b/components/terrain/quadtreenode.hpp index 0f7eb05ef..1d996487e 100644 --- a/components/terrain/quadtreenode.hpp +++ b/components/terrain/quadtreenode.hpp @@ -51,6 +51,7 @@ namespace Terrain void setBoundingBox(const osg::BoundingBox& boundingBox); const osg::BoundingBox& getBoundingBox() const; + bool hasValidBounds() const { return mValidBounds; } virtual osg::BoundingSphere computeBound() const; @@ -81,6 +82,7 @@ namespace Terrain ChildDirection mDirection; osg::BoundingBox mBoundingBox; + bool mValidBounds; float mSize; osg::Vec2f mCenter;