Further work on Bound class/Node::getBound() and Drawable::getBound() and usage in OSG codebase

This commit is contained in:
Robert Osfield
2014-05-14 16:01:40 +00:00
parent ff21af2b0d
commit 74f91037a7
30 changed files with 239 additions and 213 deletions

View File

@@ -271,12 +271,13 @@ class OSG_EXPORT CullingSet : public Referenced
return false;
}
#ifdef OSG_USE_BOUND
inline bool isCulled(const Bound& bound)
{
if (bound.bb) return isCulled(*bound.bb);
else return isCulled(*bound.bs);
}
#endif
inline void pushCurrentMask()
{
_frustum.pushCurrentMask();

View File

@@ -128,6 +128,20 @@ class OSG_EXPORT Drawable : public Node
/** Set the initial bounding volume to use when computing the overall bounding volume.*/
const BoundingBox& getInitialBound() const { return _initialBound; }
#ifdef OSG_USE_BOUND
virtual Bound getBound() const
{
if(!_boundingSphereComputed) getBoundingBox();
return Bound(_boundingSphere, _boundingBox);
}
#else
inline const BoundingSphere& getBound() const
{
if(!_boundingSphereComputed) getBoundingBox();
return _boundingSphere;
}
#endif
/** Get BoundingBox of Drawable.
* If the BoundingBox is not up to date then its updated via an internal call to computeBond().
*/

View File

@@ -437,7 +437,7 @@ class OSG_EXPORT Node : public Object
/** Get the bounding sphere of node.
Using lazy evaluation computes the bounding sphere if it is 'dirty'.*/
#ifdef OSG_USE_BOUND
inline Bound getBound() const
virtual Bound getBound() const
{
if(!_boundingSphereComputed)
{
@@ -452,7 +452,7 @@ class OSG_EXPORT Node : public Object
return Bound(_boundingSphere);
}
#else
inline BoundingSphere getBound() const
inline const BoundingSphere& getBound() const
{
if(!_boundingSphereComputed)
{