levelOfDetail derived from ygNode Example Source Header

Description: a selector based on distance from the viewer

notes:
Category: Selection
Author: Alex Hill
Revision: 11/01/01

    Messages
range float, integer set the distance at which a child is switched on
ranges multiple floats set the distance for each child plus switch off distance
    Debugs
selected
    Comments

constructor levelOfDetail

1 set the range to the first child as 0.0
2 initialize a range variable to 50.0
3 for each child
3.1 set child number plus one range to the variable
3.2 double the range variable

destructor ~levelOfDetail

method reset

method message

1 set the distance at which a child is switched on
2 set the distance for each child plus switch off distance

method app

1 get the world viewer
2 find the viewer with respect to this node
3 find the distance to the viewer
4 set selected to OFF
5 for each range value minus the last one
5.1 if distance greater than range, then set selected to that child
6 if distance greater than last range, then set selected to OFF
7 if selected has changed
7.1 set sw value

method appTraverse

1 start timing
2 execute app method
3 call appTraverse recursively on selected child
4 end timing