osg::Geode Class Reference

Inheritance diagram for osg::Geode:

osg::Node osg::Object osg::Referenced osg::Billboard osgSim::ScalarBar osgSim::SphereSegment List of all members.

Public Types

typedef std::vector< ref_ptr<
Drawable > > 
DrawableList

Public Member Functions

 Geode ()
 Geode (const Geode &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 META_Node (osg, Geode)
virtual bool addDrawable (Drawable *drawable)
virtual bool removeDrawable (Drawable *drawable)
virtual bool removeDrawables (unsigned int i, unsigned int numDrawablesToRemove=1)
virtual bool replaceDrawable (Drawable *origDraw, Drawable *newDraw)
virtual bool setDrawable (unsigned int i, Drawable *drawable)
unsigned int getNumDrawables () const
DrawablegetDrawable (unsigned int i)
const DrawablegetDrawable (unsigned int i) const
bool containsDrawable (const Drawable *gset) const
unsigned int getDrawableIndex (const Drawable *drawable) const
const DrawableListgetDrawableList () const
void compileDrawables (State &state)
const BoundingBoxgetBoundingBox () const
virtual BoundingSphere computeBound () const
virtual void releaseGLObjects (osg::State *=0) const

Protected Member Functions

virtual ~Geode ()

Protected Attributes

osg::BoundingBox _bbox
DrawableList _drawables

Detailed Description

A Geode is a "geometry node", that is, a leaf node on the scene graph that can have "renderable things" attached to it. In OSG, renderable things are represented by objects from the Drawable class, so a Geode is a Node whose purpose is grouping Drawables.


Member Typedef Documentation

typedef std::vector< ref_ptr<Drawable> > osg::Geode::DrawableList


Constructor & Destructor Documentation

osg::Geode::Geode (  ) 

osg::Geode::Geode ( const Geode ,
const CopyOp copyop = CopyOp::SHALLOW_COPY 
)

Copy constructor using CopyOp to manage deep vs shallow copy.

virtual osg::Geode::~Geode (  )  [protected, virtual]


Member Function Documentation

virtual bool osg::Geode::addDrawable ( Drawable drawable  )  [virtual]

Add a Drawable to the Geode. If drawable is not NULL and is not contained in the Geode then increment its reference count, add it to the drawables list and dirty the bounding sphere to force it to be recomputed on the next call to getBound().

Parameters:
drawable The Drawable to be added to the Geode.
Returns:
true for success; false otherwise.

Reimplemented in osg::Billboard.

void osg::Geode::compileDrawables ( State state  ) 

Compile OpenGL Display List for each drawable.

virtual BoundingSphere osg::Geode::computeBound (  )  const [virtual]

Compute the bounding sphere around Node's geometry or children. This method is automatically called by getBound() when the bounding sphere has been marked dirty via dirtyBound().

Reimplemented from osg::Node.

Reimplemented in osg::Billboard.

bool osg::Geode::containsDrawable ( const Drawable gset  )  const [inline]

Return true if a given Drawable is contained within Geode.

const BoundingBox& osg::Geode::getBoundingBox (  )  const [inline]

Return the Geode's bounding box, which is the union of all the bounding boxes of the geode's drawables.

const Drawable* osg::Geode::getDrawable ( unsigned int  i  )  const [inline]

Return the Drawable at position i.

Drawable* osg::Geode::getDrawable ( unsigned int  i  )  [inline]

Return the Drawable at position i.

unsigned int osg::Geode::getDrawableIndex ( const Drawable drawable  )  const [inline]

Get the index number of drawable.

Returns:
A value between 0 and getNumDrawables()-1 if drawable is found; if not found, then getNumDrawables() is returned.

const DrawableList& osg::Geode::getDrawableList (  )  const [inline]

Get the list of drawables.

unsigned int osg::Geode::getNumDrawables (  )  const [inline]

Return the number of Drawables currently attached to the Geode.

osg::Geode::META_Node ( osg  ,
Geode   
)

virtual void osg::Geode::releaseGLObjects ( osg::State = 0  )  const [virtual]

If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context. Otherwise, releases OpenGL objexts for all graphics contexts.

Reimplemented from osg::Node.

virtual bool osg::Geode::removeDrawable ( Drawable drawable  )  [virtual]

Remove a Drawable from the Geode. Equivalent to removeDrawable(getDrawableIndex(drawable).

Parameters:
drawable The drawable to be removed.
Returns:
true if at least one Drawable was removed. false otherwise.

Reimplemented in osg::Billboard.

virtual bool osg::Geode::removeDrawables ( unsigned int  i,
unsigned int  numDrawablesToRemove = 1 
) [virtual]

Remove Drawable(s) from the specified position in Geode's drawable list.

Parameters:
i The index of the first Drawable to remove.
numDrawablesToRemove The number of Drawable to remove.
Returns:
true if at least one Drawable was removed. false otherwise.

virtual bool osg::Geode::replaceDrawable ( Drawable origDraw,
Drawable newDraw 
) [virtual]

Replace specified Drawable with another Drawable. Equivalent to setDrawable(getDrawableIndex(origDraw),newDraw), see docs for setDrawable() for further details on implementation.

virtual bool osg::Geode::setDrawable ( unsigned int  i,
Drawable drawable 
) [virtual]

Set Drawable at position i. Decrement the reference count origGSet and increments the reference count of newGset, and dirty the bounding sphere to force it to recompute on next getBound() and returns true. If origDrawable is not found then return false and do not add newGset. If newGset is NULL then return false and do not remove origGset.

Returns:
true if set correctly, false on failure (if node==NULL || i is out of range).


Member Data Documentation

osg::BoundingBox osg::Geode::_bbox [mutable, protected]

DrawableList osg::Geode::_drawables [protected]


The documentation for this class was generated from the following file:
Generated on Sun Oct 1 13:17:06 2006 for openscenegraph by  doxygen 1.4.7