Added Node::asDrawable() and Node::asGeometry() methods to provide a low cost way of casting a node to Drawable and Geoemtry.

Changed the Group::computeBound() method so that it takes account of the a Drawable's BoundingBox.
This commit is contained in:
Robert Osfield
2014-05-15 09:26:59 +00:00
parent afcf54b108
commit 20b9f3ff88
4 changed files with 35 additions and 19 deletions

View File

@@ -106,13 +106,8 @@ class OSG_EXPORT Drawable : public Node
META_Node(osg, Drawable);
/** Convert 'this' into a Geometry pointer if Drawable is a Geometry, otherwise return 0.
* Equivalent to dynamic_cast<Geometry*>(this).*/
virtual Geometry* asGeometry() { return 0; }
/** Convert 'const this' into a const Geometry pointer if Drawable is a Geometry, otherwise return 0.
* Equivalent to dynamic_cast<const Geometry*>(this).*/
virtual const Geometry* asGeometry() const { return 0; }
virtual Drawable* asDrawable() { return this; }
virtual const Drawable* asDrawable() const { return this; }
/** Compute the DataVariance based on an assessment of callback etc.*/
virtual void computeDataVariance();