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

sglUnProject Class Reference

#include <sglUnProject.hpp>

Inheritance diagram for sglUnProject::

sglGroup sglNode sglObject List of all members.

Public Methods

 sglUnProject (bool fixedPixelScale=false)
virtual ~sglUnProject ()
void setFixedPixelScale (bool on)
bool getFixedPixelScale () const
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 copyTo (sglUnProject *dst, unsigned int mode) const

Detailed Description

This node modifies the model view matrix maintained in the various traversals such that the child of this node are transformed to appear on the near clip plane. For example, this node could be used to create target indicators on a game HUD (heads up display).

There are two modes for this node: with and without fixed pixel scale:

  1. with fixed pixel scale, the following coordinate system results for the children of this node:
          x - left to right, a unit length of one = one pixel
          y - bottom to top, a unit length of one = one pixel
          z - 0 (on the near clip plane) ... (negatives extending into the scene)
       

  2. without fixed pixel scale:
          x - left to right, viewport width = 1.0 * aspect ratio \
          y - bottom to top, viewport height = 1.0 \
          z - 0 (on the near clip plane) ... (negatives extending into the scene)
       
Note: Due to the way culling is performed (with pre-computed bounding volumes), this node may exhibit non-intuitive culling behavior. The dynamically generate bounding-volume for this node will reflect the size of its children in world-space, not the transformed screen space. Thus, by default, the bounding volume is likely to be much smaller than the drawn object. It is recommended that you set a static bound of appropriate size for this sub-tree.

Example:

   sglGeode *geode = new sglGeode;
   sglUnProject *unproject_node = new sglUnProject(true); // fixed pixel scale
   unproject_node->addChild(geode);

Todo:
Implement pick and intersect functions.

Definition at line 75 of file sglUnProject.hpp.


Constructor & Destructor Documentation

sglUnProject::sglUnProject ( bool fixedPixelScale = false )
 

Constructor

Parameters:
fixedPixelScale   boolean flag that sets whether fixed pixel scale mode is to be used or not (defaults to false).

sglUnProject::~sglUnProject ( ) [virtual]
 

virtual destructor.


Member Function Documentation

void sglUnProject::setFixedPixelScale ( bool on ) [inline]
 

Set whether geometry is scaled in units of pixels.

Parameters:
on   If true then fixed pixel scale is to be used.

Definition at line 90 of file sglUnProject.hpp.

bool sglUnProject::getFixedPixelScale ( ) const [inline]
 

Query for fixed pixel scale mode.

Returns:
true if fixed pixel scale mode is being used; otherwise, false.

Definition at line 95 of file sglUnProject.hpp.

virtual sglBound::IntersectResultEnum sglUnProject::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 sglUnProject::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 sglUnProject::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 sglUnProject::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* sglUnProject::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.

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

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


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