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

sglBitMaskSwitch Class Reference

#include <sglBitMaskSwitch.hpp>

Inheritance diagram for sglBitMaskSwitch::

sglGroup sglNode sglObject sglIndexedBitMaskSwitch List of all members.

Public Methods

 sglBitMaskSwitch ()
virtual ~sglBitMaskSwitch ()
void setMask (unsigned int mask)
unsigned int getMask ()
virtual sglBound::IntersectResultEnum intersect (sglIntersectf &isector) const
virtual sglBound::IntersectResultEnum intersect (sglIntersectd &isector) const
virtual void pick (sglPickf &pick_state, unsigned int cull_flags) const
virtual void pick (sglPickd &pick_state, unsigned int cull_flags) const
virtual sglNodeclone (unsigned int mode) const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Protected Methods

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 cull (sglCull< float > &trav_state, unsigned int cull_flags, unsigned int switch_mask) const
void cull (sglCull< double > &trav_state, unsigned int cull_flags, unsigned int switch_mask) const
void copyTo (sglBitMaskSwitch *dst, unsigned int mode) const

Protected Attributes

unsigned int m_switch_mask

Detailed Description

This will select any combination of up to 32 children to be traversed. This is done according to the values of the bits in this node's mask where one bit corresponds for each child (i.e., bit 0 toggles child 0, bit 1 toggles child 1, etc.). As with sglSwitch, the order that the children are added to the node is significant.

The switch mask is an unsigned integer which means it can be used to select one of up to 32 children. If this node has less than 32 children some of the bits are out of range and will be ignored.

Special behaviour for intersect and pick traversals

In addition to this behaviour, the intersect and pick traversals of this node type can be overridden by adding sglProbe::eSWITCH_ALL or sglProbe::eSWITCH_NONE to the mode. The former behaves as if mask 0xffffffff (~0x0) has been set on this node, and the latter corresponds to a mask of 0x0.

Example:

   sglBitMaskSwitch *switch_node = new sglBitMaskSwitch;
   sglGeode *geode0 = new sglGeode;
   sglGeode *geode1 = new sglGeode;

   switch_node->addChild(geode0);
   switch_node->addChild(geode1);

   switch_node->setMask(0x0);     // select neither
   switch_node->setMask(0x1);     // select geode0
   switch_node->setMask(0x2);     // select geode1
   switch_node->setMask(0x3);     // select both
   switch_node->setMask(0x4);     // selects neither (no corresponding child)
   switch_node->setMask(~0x0);    // select all children (the default)

Definition at line 75 of file sglBitMaskSwitch.hpp.


Constructor & Destructor Documentation

sglBitMaskSwitch::sglBitMaskSwitch ( )
 

default constructor.

sglBitMaskSwitch::~sglBitMaskSwitch ( ) [virtual]
 

destructor.


Member Function Documentation

void sglBitMaskSwitch::setMask ( unsigned int mask ) [inline]
 

Set the bit mask for selecting children. @mask The mask where each bit corresponds to one of up to 32 children.

Definition at line 86 of file sglBitMaskSwitch.hpp.

Referenced by sglIndexedBitMaskSwitch::setIndex().

unsigned int sglBitMaskSwitch::getMask ( ) [inline]
 

Get the current bit mask.

Returns:
mask The unsigned int bit mask.

Definition at line 91 of file sglBitMaskSwitch.hpp.

virtual sglBound::IntersectResultEnum sglBitMaskSwitch::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 sglGroup.

virtual sglBound::IntersectResultEnum sglBitMaskSwitch::intersect ( sglIntersectd & isector ) 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 sglGroup.

virtual void sglBitMaskSwitch::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 sglGroup.

virtual void sglBitMaskSwitch::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 sglGroup.

virtual sglNode* sglBitMaskSwitch::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 sglGroup.

Reimplemented in sglIndexedBitMaskSwitch.

virtual void sglBitMaskSwitch::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 sglGroup.

Reimplemented in sglIndexedBitMaskSwitch.

void sglBitMaskSwitch::cull ( sglCull< float > & trav_state,
unsigned int cull_flags ) const [inline, 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 sglGroup.

Definition at line 115 of file sglBitMaskSwitch.hpp.

void sglBitMaskSwitch::cull ( sglCull< double > & trav_state,
unsigned int cull_flags ) const [inline, 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 sglGroup.

Definition at line 122 of file sglBitMaskSwitch.hpp.


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