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

sglUnScaleRange Class Reference

#include <sglUnScaleRange.hpp>

Inheritance diagram for sglUnScaleRange::

sglGroup sglNode sglObject List of all members.

Public Methods

 sglUnScaleRange ()
virtual ~sglUnScaleRange ()
void setScaleParameters (float reference_size, unsigned int min_pixel_size, unsigned int max_pixel_size)
unsigned int getMinPixelSize () const
unsigned int getMaxPixelSize () const
float getReferenceSize () const
void setInverseMode (bool on)
bool getInverseMode () 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 (sglUnScaleRange *dst, unsigned int mode) const

Detailed Description

This node modifies the traversal's view matrix such that geometry below it in the scene graph is scaled in a complex fashion to appear the same minimum pixel size when it is greater than a "certain" distance away, and the same maximum pixel size when it is closer than a second "certain" distance away. To determine the distances the user supplies a reference size (in scene graph length units) that is to be mapped to the minimum and maximum pixel sizes. In between these two distances it acts as if there is no scale factor.

Setting the minimum pixel size to 0 disables this limit so that objects can shrink without limit as they get farther away. Likewise, specifying the maximum pixel size to 0 allows that objects to grow larger without limit as they approach the view point. Setting both to negative values results in an sglGroup node behaviour.

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 node (and its children).

Example:

   sglGeode geode = new sglGeode;
   sglUnScaleRange *unscale = new sglUnScaleRange;

   // scale the children so that an object with dimension 4 will not shrink
   // less than 10 pixels on that dimension or grow larger than 40 pixels.
   unscale->setScaleParameters(4.f, 10, 40);

   unscale->addChild(geode);

Definition at line 73 of file sglUnScaleRange.hpp.


Constructor & Destructor Documentation

sglUnScaleRange::sglUnScaleRange ( )
 

Default constructor.

sglUnScaleRange::~sglUnScaleRange ( ) [virtual]
 

virtual destructor.


Member Function Documentation

void sglUnScaleRange::setScaleParameters ( float reference_size,
unsigned int min_pixel_size,
unsigned int max_pixel_size )
 

Set the scaling parameters.

Parameters:
reference_size   How tall the geometry beneath this node is. Values not greater than zero will be set to one.
min_pixel_size   The minimum size (in pixels) the geometry (or more precisely, reference_size) is to be rendered at. A zero value disables this limit.
max_pixel_size   The maximum size (in pixels) the geometry (or more precisely, reference_size) is to be rendered at. A zero value disables this limit.

unsigned int sglUnScaleRange::getMinPixelSize ( ) const [inline]
 

Query the minimum pixel size. It will return zero if this limit has been disabled.

Returns:
The minimum pixel size.

Definition at line 100 of file sglUnScaleRange.hpp.

unsigned int sglUnScaleRange::getMaxPixelSize ( ) const [inline]
 

Query the maximum pixel size. It will return zero if this limit has been disabled.

Returns:
The maximum pixel size.

Definition at line 106 of file sglUnScaleRange.hpp.

float sglUnScaleRange::getReferenceSize ( ) const [inline]
 

Query the reference size.

Returns:
The reference size.

Definition at line 111 of file sglUnScaleRange.hpp.

void sglUnScaleRange::setInverseMode ( bool on ) [inline]
 

Set whether or not to apply the inverse of the scale computed. This is useful for sequential nodes of this type if you want to undo the previous one. The default is disabled.

Parameters:
on   If true apply the inverse instead.

Definition at line 118 of file sglUnScaleRange.hpp.

bool sglUnScaleRange::getInverseMode ( ) const [inline]
 

Query whether or not the inverse of the scale computed is applied.

Returns:
True if this is enabled.

Definition at line 123 of file sglUnScaleRange.hpp.

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