Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members Related Pages
sglBillboard Class Reference
#include <sglBillboard.hpp>
Inheritance diagram for sglBillboard::
List of all members.
Public Types 
enum  ModeEnum {
ePOINT_ROT_EYE,
ePOINT_ROT_WORLD,
eAXIAL_ROT
} 
Public Methods 
 sglBillboard () 
virtual  ~sglBillboard () 
const sglVec3d&  getPos () const 
void  setPos (const sglVec3d &p) 
const sglVec3d&  getAxis () const 
void  setAxis (const sglVec3d &v) 
void  setMode (ModeEnum mode) 
ModeEnum  getMode () 
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 sglNode*  clone (unsigned int mode) const 
virtual void  printInfo (ostream &ostrm, const char *indent_string) const 
Protected Methods 
void  computeOrientation (const sglMat4f ¤t_mat, sglMat4f &new_mat) const 
void  computeOrientation (const sglMat4d ¤t_mat, sglMat4d &new_mat) const 
virtual void  computeBound () 
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 (sglBillboard *dst, unsigned int mode) const 
Protected Attributes 
ModeEnum  m_mode 
sglVec3d  m_pos 
sglVec3d  m_axis 
Detailed Description
The sglBillboard node modifies traversal modelview matrices to effect one of three (currently two) orientation behaviours as a function of the view direction before traversing the children. This matrix can be modified by setting one of the following modes:
 sglBillboard::ePOINT_ROT_EYE In this mode, the modelview matrix is modified so that the origin of the childrens' coordinate systems spins about a point in this node as specified by the setPos() member function. The childrens' local coordinate systems will spin such that the Yaxes always stay upright on the screen and the Zaxes point back to the user (out of the screen). The default point of rotation is this node's origin.
 sglBillboard::eAXIAL_ROT In this mode, the modelview matrix is modified so that each child's Yaxis system rotates about this node's axis as specified by the setAxis() member function. The childrens' coordinate systems rotate so that the childrens' local Zaxes point back to the viewer as closely as possible. As in the ePOINT_ROT_EYE mode, the child's origin will rotate about the a point in the sglBillboard's coordinate system as specified by the setPos() member function. The default axis of rotation is the sglBillboard's +Zaxis.
 sglBillboard::ePOINT_ROT_WORLD Not implemented yet.
The default mode is ePOINT_ROT_EYE.
Special behaviour for intersect and pick traversals
In the default case, the intersect and pick traversals stop at sglBillboard nodes. If the user wishes to traverse these nodes, the user must set the modelview matrix in the sglProbe object (actually sglTraverser base class) and add the sglProbe::eBILLBOARD_VIEW flag to its mode.
Example:
sglBillboard *billboard_node = new sglBillboard;
sglVec3d pos(3.0, 0.0, 0.0); // spin about a point along the x axis
billboard_node>setPos(pos);
billboard_node>setMode(sglBillboard::ePOINT_ROT_EYE);
// or
sglVec3d pos(3.0, 0.0, 0.0); // origin at a point along the x axis
billboard_node>setPos(pos);
sglVec3d axis(1.0, 1.0, 0.0); // will be normalized automatically
billboard_node>setAxis(axis); // rotate around the (1, 1, 0) axis
billboard_node>setMode(sglBillboard::eAXIAL_ROT);

Todo:

implement ePOINT_ROT_WORLD (what is the correct behaviour?).
add a setMode() to switch between Z_UP/Y_UP (or whatever). Possibly a setChildAxis function to be completely generic?
Check the computational complexity of eAXIAL_ROT and see if it can be reduced.
Definition at line 97 of file sglBillboard.hpp.
Constructor & Destructor Documentation
sglBillboard::sglBillboard (

)


sglBillboard::~sglBillboard (

) [virtual]


Member Function Documentation
const sglVec3d & sglBillboard::getPos (

) const [inline]



Get the current point of spin for all modes. 
Returns:

the current point of rotation.
Definition at line 117 of file sglBillboard.hpp. 
void sglBillboard::setPos (

const sglVec3d & p )



Set the point of spin for all modes. The children's origins are translated to this position before rotation. 
Parameters:

p

Point of spin with respect to this node's coordinate system. 

const sglVec3d & sglBillboard::getAxis (

) const [inline]



Get the current axis of rotation for the eAXIAL_ROT mode. 
Returns:

axis of rotation with respect to sglBillboard's coordinate system.
Definition at line 130 of file sglBillboard.hpp. 
void sglBillboard::setAxis (

const sglVec3d & v )



Set the axis of rotation for the eAXIAL_ROT mode. 
Parameters:

v

Axis of rotation with respect to sglBillboard's coordinate system. This vector will be normalized. Specifying a vector of length zero will result in the default of the Zaxis. 

void sglBillboard::setMode (

ModeEnum mode )



Specify the behaviour mode. 
Parameters:

mode

Either ePOINT_ROT_EYE (the default) or eAXIAL_ROT. 

ModeEnum sglBillboard::getMode (

) [inline]



Query the current behaviour mode. 
Returns:

the current mode (either ePOINT_ROT_EYE or eAXIAL_ROT).
Definition at line 147 of file sglBillboard.hpp. 
virtual sglBound::IntersectResultEnum sglBillboard::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 sglBillboard::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 sglBillboard::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. Cullfree picking can be accomplished by setting this to 0. 
Reimplemented from sglGroup. 
virtual void sglBillboard::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. Cullfree picking can be accomplished by setting this to 0. 
Reimplemented from sglGroup. 
virtual sglNode* sglBillboard::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 ORed together from the mode values in sglObject::CloneModeEnum. 

Returns:

Pointer to root of cloned scene graph.
Reimplemented from sglGroup. 
virtual void sglBillboard::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. 
virtual void sglBillboard::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 userfriendly 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. Cullfree drawing can be accomplished with cull_flags = 0. 
Reimplemented from sglGroup. 
virtual void sglBillboard::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 userfriendly 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. Cullfree drawing can be accomplished with cull_flags = 0. 
Reimplemented from sglGroup. 
The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:06 2002 for SGL by
1.2.6 written by Dimitri van Heesch,
© 19972001