#include <sglDistanceSwitch.hpp>
Inheritance diagram for sglDistanceSwitch::
Public Methods  
sglDistanceSwitch ()  
virtual  ~sglDistanceSwitch () 
void  setRange (float range) 
float  getRange () 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 () 
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 (sglDistanceSwitch *dst, unsigned int mode) const 
Protected Attributes  
sglVec3f  m_center 
float  m_range 
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
This node is designed to make a specific construct more efficient. With the sglLOD node you might have the following subgraph to switch a set of children with a single range (i.e., turn them off if they are too far away):
sglLOD (range[0] = 0, range[1] = view_distance)  sglGroup /  \ Node1 Node2 Node3
This can be replaced with a more efficient construct as follows:
sglSwitchDistance (range = view_distance) /  \ /  \ Node1 Node2 Node3
Scale and Bias
See sglLOD documentation for details.
Special behaviour for intersect and pick traversals
This node uses the same flags as sglLOD. See sglLOD documentation for details. Note that the default behaviour for sglLOD (to intersect against range zero only) is equivalent to using the eLOD_ALL flag in this node.
Example:
sglDistanceSwitch *ds_node = new sglDistanceSwitch; ds_node>setLODState(new sglLODState); sglGeode *geode1 = new sglGeode; sglGeode *geode2 = new sglGeode; sglGeode *geode3 = new sglGeode; ds_node>addChild(geode1); // finest resolution ds_node>addChild(geode2); ds_node>addChild(geode3); // coarsest resolution ds_node>setRange(50.0f); // deselect all above 50. // double computed range for all sglDistanceSwitch nodes: has effect of // halving the switch range. sglDistanceSwitch::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 = ds_node>getLODState(); if (lod_state) { lod_state>setRangeScale(0.5f); lod_state>setRangeOffset(2.0f); }
Definition at line 123 of file sglDistanceSwitch.hpp.

default constructor.


virtual destructor.


Set a range value. Distances computed outside this range will result in all children being culled.


Get a range value.
Definition at line 141 of file sglDistanceSwitch.hpp. 

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

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

Set a global scale factor used to affect transitions of groups of ALL SwitchDistance nodes (this is a separate factor from sglLOD  should they share the same value?).
Definition at line 159 of file sglDistanceSwitch.hpp. 

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

Specify a scale and bias to affect transitions of this SwitchDistance node. By using the same sglLODState object for more than one sglDistanceSwitch (and sglLOD) node, a group of sglDistanceSwitch'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 183 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. 