Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglGeode Class Reference

#include <sglGeode.hpp>

Inheritance diagram for sglGeode::

sglNode sglObject List of all members.

Public Methods

 sglGeode ()
virtual ~sglGeode ()
unsigned int getNumGeometries () const
bool addGeometry (sglDrawable *geometry)
bool insertGeometry (unsigned int index, sglDrawable *geometry)
bool removeGeometry (sglDrawable *geometry)
sglDrawablegetGeometry (unsigned int index)
virtual sglBound::IntersectResultEnum intersect (sglIntersectf &isector) const
virtual sglBound::IntersectResultEnum intersect (sglIntersectd &segset) const
virtual void pick (sglPickf &pick_state, unsigned int cull_flags) const
virtual void pick (sglPickd &pick_state, unsigned int cull_flags) const
virtual void preDraw (const PreDrawStruct &trav_state)
virtual sglNodeclone (unsigned int mode) const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Protected Methods

virtual void computeBound ()
virtual void computeBoundsRecursiveDown ()
virtual void cull (sglCull< float > &trav_state, unsigned int cull_flags) const
virtual void cull (sglCull< double > &trav_state, unsigned int cull_flags) const
void copyTo (sglGeode *dst, unsigned int mode) const

Protected Attributes

vector<sglDrawable *> m_geometry_list

Detailed Description

The sglGeode node is a container for a set of 3D geometry classes. It is also considered a leaf node, even though it has children of a different sort: sglDrawable and its subclasses that encapsulate the geometry and graphics state information that specify the 3D objects that are rendered.

Example:

   sglGeode       *geode = new sglGeode;

   // subclasses of sglDrawable:
   sglLineSet     *geom1 = new sglLineSet;
   sglTriangleSet *geom2 = new sglTriangleSet;

   geode->addGeometry(geom1);
   geode->addGeometry(geom2);

   unsigned int num = geode->getNumGeometries(); // returns 2
   sglDrawable* geom = geode->getGeometry(0);    // returns geom1
   geom = geode->getGeometry(2);                 // returns NULL

   geode->removeGeometry(geom2);                 // returns true;
   geode->insertGeometry(0, geom2);

   geom = geode->getGeometry(0);                 // returns geom2

Definition at line 68 of file sglGeode.hpp.


Constructor & Destructor Documentation

sglGeode::sglGeode ( )
 

default constructor.

sglGeode::~sglGeode ( ) [virtual]
 

virtual destructor.


Member Function Documentation

unsigned int sglGeode::getNumGeometries ( ) const [inline]
 

Get the number of sglDrawable nodes.

Returns:
The current number of sglDrawable objects contained in this class.

Definition at line 80 of file sglGeode.hpp.

bool sglGeode::addGeometry ( sglDrawable * geometry )
 

Add an sglDrawable to the end of the list.

Parameters:
geometry   Pointer to an sglDrawable object.
Returns:
true if geometry parameter is non-NULL.

bool sglGeode::insertGeometry ( unsigned int index,
sglDrawable * geometry )
 

Insert an sglDrawable in a specific location of the list

Parameters:
index   position in vector to place the new geometry.
geometry   Pointer to the new geometry.
Returns:
true if geometry pointer is non-NULL, and the index is not out of range (greater than the number of geometries currently in the list.

bool sglGeode::removeGeometry ( sglDrawable * geometry )
 

Remove an sglDrawable specified by its pointer from the list.

Parameters:
geometry   Pointer to the geometry to be removed.
Returns:
true if geometry parameter is non-NULL and the pointer is found in the current list (and is removed).

sglDrawable * sglGeode::getGeometry ( unsigned int index )
 

Get a pointer to a Geometry in the list at the position specified.

Parameters:
index   The position in the list (zero is the first position).
Returns:
Pointer the the geometry at that position, or NULL if index is out of range of the current index.

virtual sglBound::IntersectResultEnum sglGeode::intersect ( sglIntersectf & isector ) const [virtual]
 

The single precision intersection traversal function which returns the closest object (bounding volume and/or triangle) that intersects with the given intersect segment.

Parameters:
isector   A reference to a single precision intersection state

Reimplemented from sglNode.

virtual sglBound::IntersectResultEnum sglGeode::intersect ( sglIntersectd & segset ) const [virtual]
 

The double precision intersection traversal function which returns the closest object (bounding volume and/or triangle) that intersects with the given intersect segment.

Parameters:
isector   A reference to a double precision intersection state

Reimplemented from sglNode.

virtual void sglGeode::pick ( sglPickf & pick_state,
unsigned int cull_flags ) const [virtual]
 

The single precision pick traversal function which returns all objects that fall within the pick frustum.

Parameters:
pick_state   A reference to a single precision pick state.
cull_flags   Bit flags that indicate which planes of the pick frustum (polytope) still need to be tested to determine if bounding spheres and boxes lie within the frustum. Cull-free picking can be accomplished by setting this to 0.

Reimplemented from sglNode.

virtual void sglGeode::pick ( sglPickd & pick_state,
unsigned int cull_flags ) const [virtual]
 

The double precision pick traversal function which returns all objects that fall within the pick frustum.

Parameters:
pick_state   A reference to a double precision pick state.
cull_flags   Bit flags that indicate which planes of the pick frustum (polytope) still need to be tested to determine if bounding spheres and boxes lie within the frustum. Cull-free picking can be accomplished by setting this to 0.

Reimplemented from sglNode.

virtual void sglGeode::preDraw ( const PreDrawStruct & trav_state ) [virtual]
 

This is the pre-draw traversal function which should be called before intersecting or culling the scene graph. This "cleans" the tree by computing the bound boxes and spheres that have been marked as dirty, building display lists for geometry that has changed, binding textures that need to be, updating the animation nodes whose state has changed. This should be called with a valid graphics context current.

Parameters:
trav_state   A struct containing state information needed by the preDraw traversal (currently frame time and count for animation nodes).

Reimplemented from sglNode.

virtual sglNode* sglGeode::clone ( unsigned int mode ) const [virtual]
 

Make a copy of the scenegraph rooted at this node.

Parameters:
mode   Bit masks to control the behaviour of the clone. These are OR-ed together from the mode values in sglObject::CloneModeEnum.
Returns:
Pointer to root of cloned scene graph.

Reimplemented from sglNode.

virtual void sglGeode::printInfo ( ostream & ostrm,
const char * indent_string ) const [virtual]
 

Output the state of this node to the specified ostream.

Parameters:
ostrm   the ostream to which the output is sent
indent_string   the string (usually spaces) that is output at the beginning of every line of output

Reimplemented from sglNode.

virtual void sglGeode::cull ( sglCull< float > & trav_state,
unsigned int cull_flags ) const [protected, virtual]
 

The single precision cull traversal function that culls out subgraphs that do not lie in the view frustum (stored in the sglCull parameter). Subclasses must implement this function. The entry point for user-friendly culling is in the sglScene class.

Parameters:
trav_state   The single precision traversal state that collects all the state and geometry information that passes the cull.
cull_flags   Bit flags that indicate which planes of the view frustum (polytope) still need to be tested to determine if bounding spheres and boxes lie within the frustum. Cull-free drawing can be accomplished with cull_flags = 0.

Reimplemented from sglNode.

virtual void sglGeode::cull ( sglCull< double > & trav_state,
unsigned int cull_flags ) const [protected, virtual]
 

The double precision cull traversal function that culls out subgraphs that do not lie in the view frustum (stored in the sglCull parameter). Subclasses must implement this function. The entry point for user-friendly culling is in the sglScene class.

Parameters:
trav_state   The single precision traversal state that collects all the state and geometry information that passes the cull.
cull_flags   Bit flags that indicate which planes of the view frustum (polytope) still need to be tested to determine if bounding spheres and boxes lie within the frustum. Cull-free drawing can be accomplished with cull_flags = 0.

Reimplemented from sglNode.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:07 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001