Moved the code referencing osg::BoundingBox::isValid() and

osg::BoundingSphere::isValid() across to use the valid() methods, the later
being more consitent with other classes such as osg::ref_ptr<>.
This commit is contained in:
Robert Osfield
2002-07-11 14:32:21 +00:00
parent b015d80d68
commit c4c97a0f64
12 changed files with 19 additions and 24 deletions

View File

@@ -50,12 +50,8 @@ class SG_EXPORT BoundingBox
_max.set(-FLT_MAX,-FLT_MAX,-FLT_MAX);
}
/** return true if the bounding box contains valid values,
false if the bounding box is effectively unset/empty.*/
inline const bool isValid() const
{
return _max.x()>=_min.x();
}
/** deprecated, use valid() instead.*/
inline const bool isValid() const { return _max.x()>=_min.x(); }
inline const bool valid() const
{
@@ -139,7 +135,7 @@ class SG_EXPORT BoundingBox
/** return true is vertex v is within the box.*/
inline const bool contains(const Vec3& v) const
{
return isValid() &&
return valid() &&
(v.x()>=_min.x() && v.x()<=_max.x()) &&
(v.y()>=_min.y() && v.y()<=_max.y()) &&
(v.z()>=_min.z() && v.z()<=_max.z());

View File

@@ -38,8 +38,7 @@ class SG_EXPORT BoundingSphere
_radius = -1.0f;
}
/** return true if the bounding sphere contains valid values,
false if the bounding sphere is effectively unset.*/
/** deprecated, use valid() instead.*/
inline const bool isValid() const { return _radius>=0.0f; }
/** return true if the bounding sphere contains valid values,
@@ -106,13 +105,13 @@ class SG_EXPORT BoundingSphere
/** return true is vertex v is within the sphere.*/
inline const bool contains(const Vec3& v) const
{
return isValid() && ((v-_center).length2()<=radius2());
return valid() && ((v-_center).length2()<=radius2());
}
/** return true if bounding sphere's intersect each other.*/
inline const bool intersects( const BoundingSphere& bs ) const
{
return isValid() && bs.isValid() &&
return valid() && bs.valid() &&
((_center - bs._center).length2() <= (_radius + bs._radius)*(_radius + bs._radius));
}

View File

@@ -102,7 +102,7 @@ class SG_EXPORT CullStack
inline bool isCulled(const BoundingBox& bb)
{
return bb.isValid() && _modelviewCullingStack.back()->isCulled(bb);
return bb.valid() && _modelviewCullingStack.back()->isCulled(bb);
}
inline bool isCulled(const BoundingSphere& bs)

View File

@@ -139,7 +139,7 @@ class SG_EXPORT Node : public Object
/** Return true if this node can be culled by view frustum, occlusion or small feature culling during the cull traversal.
* note, return true only if no children have culling disabled, and the local _cullingActive flag is true.*/
inline const bool isCullingActive() const { return _numChildrenWithCullingDisabled==0 && _cullingActive && _bsphere.isValid(); }
inline const bool isCullingActive() const { return _numChildrenWithCullingDisabled==0 && _cullingActive && _bsphere.valid(); }
/** Get the number of Children of this node which are or have OccluderNode's.*/
inline const int getNumChildrenWithOccluderNodes() const { return _numChildrenWithOccluderNodes; }