#include <sglLOD.hpp>
Inheritance diagram for sglLOD::
Public Methods  
sglLOD ()  
virtual  ~sglLOD () 
unsigned int  getNumRanges () const 
void  setRange (unsigned int index, float range) 
float  getRange (unsigned int index) const 
void  setCenter (const sglVec3f ¢er) 
const sglVec3f&  getCenter () const 
void  setLODState (sglLODState *lod_state) 
sglLODState*  getLODState () 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 sglNode*  clone (unsigned int mode) const 
virtual void  printInfo (ostream &ostrm, const char *indent_string) const 
sglLOD ()  
virtual  ~sglLOD () 
unsigned int  getNumRanges () const 
void  setRange (unsigned int index, float range) 
float  getRange (unsigned int index) const 
void  setCenter (const sglVec3f ¢er) 
const sglVec3f&  getCenter () const 
void  setLODState (sglLODState *lod_state) 
sglLODState*  getLODState () 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 sglNode*  clone (unsigned int mode) const 
virtual void  printInfo (ostream &ostrm, const char *indent_string) const 
Static Public Methods  
void  setScaleFactor (float scale) 
float  getScaleFactor () 
void  setScaleFactor (float scale) 
float  getScaleFactor () 
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 
virtual float  computeRange (float trav_lod_scale, float trav_lod_offset, const sglMat4f &view_matrix) const 
virtual float  computeRange (float trav_lod_scale, float trav_lod_offset, const sglMat4d &view_matrix) const 
void  copyTo (sglLOD *dst, unsigned int mode) const 
virtual void  cull (sglCull< float > &trav_state, unsigned int cull_flags) const 
virtual void  cull (sglCull< double > &trav_state, unsigned int cull_flags) const 
virtual float  computeRange (float trav_lod_scale, float trav_lod_offset, const sglMat4f &view_matrix) const 
virtual float  computeRange (float trav_lod_scale, float trav_lod_offset, const sglMat4d &view_matrix) const 
void  copyTo (sglLOD *dst, unsigned int mode) const 
Protected Attributes  
sglVec3f  m_center 
vector<float>  m_ranges 
sglLODState*  m_lod_state 
Static Protected Attributes  
float  s_range_scale 
After the children have been added, the user specifies the range and specifies the center point which is a reference point relative to the origin of the local coordinate system of this node used to compute the range to the viewpoint. This range value can also be scaled and biased to change which child is selected. Unlike LOD, the order that the children are added to the node is NOT significant.
The children are selected for further traversal according to the following table:
Range Value, x Child selected:   x <= distance all children x > distance none
Scale and Bias
The range value, x, that is computed by this node during traversal can be modified in a number of different ways:
new_range1 = state_scale*(dist from eyepoint and center) + state_offset
new_range2 = static_scale*new_range1
new_range3 = traversal_scale*new_range2 + traversal_offsetFor the cull traversal, the traversal scale and offset are computed in the scene graph's root (sglScene) node before the traversal commences. It does this by making a call to sglScene::computeLODScale with the size of the window in pixels and the field of view. In this function the scale is computed in an attempt select higher resolution children as the window becomes larger or the FOV gets smaller (a zoom in effect). Note: currently the trav_offset is always set to zero.
When using the intersect or pick traversal on a scene graph containing sglLOD nodes a number of different behaviours can be dictated by the user when it encounters an sglLOD node. By default, the intersection will only be performed for the highest resolution child (child[0]). The other behaviours are listed as follows for various sglProbe modes:
sglLOD *lod_node = new sglLOD; lod_node>setLODState(new sglLODState); sglGeode *geode1 = new sglGeode; sglGeode *geode2 = new sglGeode; sglGeode *geode3 = new sglGeode; lod_node>addChild(geode1); // finest resolution lod_node>addChild(geode2); lod_node>addChild(geode3); // coarsest resolution // select nothing less than 1.0 lod_node>setRange(0, 1.0f); // select geode1 between 1.0 and 5.0 lod_node>setRange(1, 5.0f); // select geode2 between 5.0 and 10.0 lod_node>setRange(2, 10.0f); // select geode3 between 10.0 and 50.0 lod_node>setRange(3, 50.0f); // select nothing greater than 50.0 // double computed range for all LODs: has effect of selecting coarser // resolution children. sglLOD::setScaleFactor(2.0f); // halve the computed range and add a bias for this LOD only: has effect // of selecting finer resolution children sglLODState *lod_state = lod_node>getLODState(); if (lod_state) { lod_state>setRangeScale(0.5f); lod_state>setRangeOffset(2.0f); }
Definition at line 145 of file sglDistanceSwitch.hpp~.

default constructor.


virtual destructor.


default constructor.


virtual destructor.


Get the number of elements in the range vector.
Definition at line 156 of file sglDistanceSwitch.hpp~. 

Set a range value.


Get a range value.


Set the reference position for computing a range to. This defaults to the origin of this node's local coordinate system.
Definition at line 177 of file sglDistanceSwitch.hpp~. 

Get the current reference position.
Definition at line 182 of file sglDistanceSwitch.hpp~. 

Set a global scale factor used to affect transitions of groups of ALL LOD nodes.
Definition at line 188 of file sglDistanceSwitch.hpp~. 

Get the current global scale factor.
Definition at line 193 of file sglDistanceSwitch.hpp~. 

Specify a scale and bias to affect transitions of this LOD node. By using the same sglLODState object for more than one sglLOD node, a group of sglLOD's range calculation can be affected simultaneously. These objects are reference counted with this function. New objects are ref()ed while previous objects are deref()ed. If an sglLODState object's reference count goes to zero when it is replaced by this function, it will be deleted.


Get a pointer to the current sglLODState object.
Definition at line 211 of file sglDistanceSwitch.hpp~. 

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

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

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

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

Make a copy of the scenegraph rooted at this node.
Reimplemented from sglGroup. 

Output the state of this node to the specified ostream.
Reimplemented from sglGroup. 

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.
Reimplemented from sglGroup. 

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.
Reimplemented from sglGroup. 

Get the number of elements in the range vector.
Definition at line 174 of file sglLOD.hpp. 

Set a range value.


Get a range value.


Set the reference position for computing a range to. This defaults to the origin of this node's local coordinate system.
Definition at line 195 of file sglLOD.hpp. 

Get the current reference position.
Definition at line 200 of file sglLOD.hpp. 

Set a global scale factor used to affect transitions of groups of ALL LOD nodes.
Definition at line 206 of file sglLOD.hpp. 

Get the current global scale factor.
Definition at line 211 of file sglLOD.hpp. 

Specify a scale and bias to affect transitions of this LOD node. By using the same sglLODState object for more than one sglLOD node, a group of sglLOD's range calculation can be affected simultaneously. These objects are reference counted with this function. New objects are ref()ed while previous objects are deref()ed. If an sglLODState object's reference count goes to zero when it is replaced by this function, it will be deleted.


Get a pointer to the current sglLODState object.
Definition at line 229 of file sglLOD.hpp. 

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

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

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

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

Make a copy of the scenegraph rooted at this node.
Reimplemented from sglGroup. 

Output the state of this node to the specified ostream.
Reimplemented from sglGroup. 

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.
Reimplemented from sglGroup. 

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.
Reimplemented from sglGroup. 