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

@@ -35,17 +35,11 @@ class OSG_EXPORT Geometry : public Drawable
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return new Geometry(); }
virtual Object* clone(const CopyOp& copyop) const { return new Geometry(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Geometry*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Geometry"; }
META_Node(osg, Geometry);
virtual Geometry* asGeometry() { return this; }
virtual const Geometry* asGeometry() const { return this; }
virtual void accept(NodeVisitor& nv) { nv.apply(*this); }
bool empty() const;
typedef std::vector< osg::ref_ptr<osg::Array> > ArrayList;