mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-19 07:06:45 +00:00
Reject QuadTreeNodes with invalid bounds
This commit is contained in:
parent
7d004bf757
commit
f19a88be9d
2 changed files with 7 additions and 0 deletions
|
@ -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<osgUtil::CullVisitor*>(&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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue