forked from teamnwah/openmw-tes3coop
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)
|
QuadTreeNode::QuadTreeNode(QuadTreeNode* parent, ChildDirection direction, float size, const osg::Vec2f& center)
|
||||||
: mParent(parent)
|
: mParent(parent)
|
||||||
, mDirection(direction)
|
, mDirection(direction)
|
||||||
|
, mValidBounds(false)
|
||||||
, mSize(size)
|
, mSize(size)
|
||||||
, mCenter(center)
|
, mCenter(center)
|
||||||
{
|
{
|
||||||
|
@ -90,6 +91,9 @@ void QuadTreeNode::initNeighbours()
|
||||||
|
|
||||||
void QuadTreeNode::traverse(osg::NodeVisitor &nv)
|
void QuadTreeNode::traverse(osg::NodeVisitor &nv)
|
||||||
{
|
{
|
||||||
|
if (!hasValidBounds())
|
||||||
|
return;
|
||||||
|
|
||||||
if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
|
if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
|
||||||
{
|
{
|
||||||
osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>(&nv);
|
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)
|
void QuadTreeNode::setBoundingBox(const osg::BoundingBox &boundingBox)
|
||||||
{
|
{
|
||||||
mBoundingBox = boundingBox;
|
mBoundingBox = boundingBox;
|
||||||
|
mValidBounds = boundingBox.valid();
|
||||||
dirtyBound();
|
dirtyBound();
|
||||||
getBound();
|
getBound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace Terrain
|
||||||
|
|
||||||
void setBoundingBox(const osg::BoundingBox& boundingBox);
|
void setBoundingBox(const osg::BoundingBox& boundingBox);
|
||||||
const osg::BoundingBox& getBoundingBox() const;
|
const osg::BoundingBox& getBoundingBox() const;
|
||||||
|
bool hasValidBounds() const { return mValidBounds; }
|
||||||
|
|
||||||
virtual osg::BoundingSphere computeBound() const;
|
virtual osg::BoundingSphere computeBound() const;
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ namespace Terrain
|
||||||
ChildDirection mDirection;
|
ChildDirection mDirection;
|
||||||
|
|
||||||
osg::BoundingBox mBoundingBox;
|
osg::BoundingBox mBoundingBox;
|
||||||
|
bool mValidBounds;
|
||||||
float mSize;
|
float mSize;
|
||||||
osg::Vec2f mCenter;
|
osg::Vec2f mCenter;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue