A Level-of-Detail node. More...
Public Member Functions | |
LODNode (string name) | |
addSwitch (float in, float out) | |
Adds a switch range to the LODNode. | |
clearForceSwitch () | |
Undoes the effect of a previous call to force_switch() and releases the LODNode to once again display the normal level. | |
clearSwitches () | |
Removes the set of switching ranges for the LODNode, presumably in conjunction with removing all of its children. | |
forceSwitch (int index) | |
Forces the LODNode to show the indicated level instead of the level that would normally be shown based on the distance from the camera. | |
Point3 const | getCenter () |
Returns the center of the LOD. | |
int | getHighestSwitch () |
Returns the index number of the child with the highest level of detail; that is, the one that is designed to be seen from the closest to the camera. | |
float | getIn (int index) |
Returns the "in" distance of the indicated switch range. | |
list | getIns () |
float | getLodScale () |
Returns the multiplier for lod distances. | |
int | getLowestSwitch () |
Returns the index number of the child with the lowest level of detail; that is, the one that is designed to be seen from the farthest away. | |
int | getNumSwitches () |
Returns the number of switch ranges added to the LODNode. | |
float | getOut (int index) |
Returns the "out" distance of the indicated switch range. | |
list | getOuts () |
hideAllSwitches () | |
Hides all levels, restoring the LODNode to normal operation. | |
hideSwitch (int index) | |
Disables a previous call to show_switch(). | |
bool | isAnyShown () |
Returns true if any switch has been shown with show_switch(), indicating the LODNode is in debug show mode; or false if it is in the normal mode. | |
setCenter (Point3 const center) | |
Specifies the center of the LOD. | |
setLodScale (float value) | |
Sets the multiplier for lod distances. | |
bool | setSwitch (int index, float in, float out) |
Changes the switching range of a particular child of the LODNode. | |
showAllSwitches () | |
Shows all levels in their default colors. | |
showSwitch (int index) | |
This is provided as a debugging aid. | |
showSwitch (int index, VBase4 const color) | |
This is provided as a debugging aid. | |
bool | verifyChildBounds () |
Returns true if the bounding volumes for the geometry of each fhild node entirely fits within the switch_in radius for that child, or false otherwise. | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
static LODNode | makeDefaultLod (string name) |
Creates a new LODNode of the type specified by the default-lod-type config variable. |
A Level-of-Detail node.
This selects only one of its children for rendering, according to the distance from the camera and the table indicated in the associated LOD object.
LODNode | ( | string | name | ) |
addSwitch | ( | float | in, |
float | out | ||
) |
Adds a switch range to the LODNode.
This implies that the corresponding child node has been parented to the node.
The sense of in vs. out distances is as if the object were coming towards you from far away: it switches "in" at the far distance, and switches "out" at the close distance. Thus, "in" should be larger than "out".
clearForceSwitch | ( | ) |
Undoes the effect of a previous call to force_switch() and releases the LODNode to once again display the normal level.
clearSwitches | ( | ) |
Removes the set of switching ranges for the LODNode, presumably in conjunction with removing all of its children.
See add_switch().
forceSwitch | ( | int | index | ) |
Forces the LODNode to show the indicated level instead of the level that would normally be shown based on the distance from the camera.
Returns the center of the LOD.
This is the point that is compared to the camera (in camera space) to determine the particular LOD that should be chosen.
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from PandaNode.
Reimplemented in FadeLODNode.
int getHighestSwitch | ( | ) |
Returns the index number of the child with the highest level of detail; that is, the one that is designed to be seen from the closest to the camera.
This is usually the last child, but it is not necessarily so.
Returns the "in" distance of the indicated switch range.
This should be larger than the "out" distance of the same range.
list getIns | ( | ) |
float getLodScale | ( | ) |
Returns the multiplier for lod distances.
int getLowestSwitch | ( | ) |
Returns the index number of the child with the lowest level of detail; that is, the one that is designed to be seen from the farthest away.
This is usually the first child, but it is not necessarily so.
int getNumSwitches | ( | ) |
Returns the "out" distance of the indicated switch range.
This should be smaller than the "in" distance of the same range.
list getOuts | ( | ) |
hideAllSwitches | ( | ) |
Hides all levels, restoring the LODNode to normal operation.
hideSwitch | ( | int | index | ) |
Disables a previous call to show_switch().
bool isAnyShown | ( | ) |
Returns true if any switch has been shown with show_switch(), indicating the LODNode is in debug show mode; or false if it is in the normal mode.
static LODNode makeDefaultLod | ( | string | name | ) | [static] |
Creates a new LODNode of the type specified by the default-lod-type config variable.
Specifies the center of the LOD.
This is the point that is compared to the camera (in camera space) to determine the particular LOD that should be chosen.
setLodScale | ( | float | value | ) |
Sets the multiplier for lod distances.
A higher value means you'll see farther switchs than normal
Changes the switching range of a particular child of the LODNode.
See add_switch().
showAllSwitches | ( | ) |
Shows all levels in their default colors.
showSwitch | ( | int | index | ) |
This is provided as a debugging aid.
show_switch() will put the LODNode into a special mode where rather than computing and drawing the appropriate level of the LOD, a ring is drawn around the LODNode center indicating the switch distances from the camera for the indicated level, and the geometry of the indicated level is drawn in wireframe.
Multiple different levels can be visualized this way at once. Call hide_switch() or hide_all_switches() to undo this mode and restore the LODNode to its normal behavior.
showSwitch | ( | int | index, |
VBase4 const | color | ||
) |
This is provided as a debugging aid.
show_switch() will put the LODNode into a special mode where rather than computing and drawing the appropriate level of the LOD, a ring is drawn around the LODNode center indicating the switch distances from the camera for the indicated level, and the geometry of the indicated level is drawn in wireframe.
Multiple different levels can be visualized this way at once. Call hide_switch() or hide_all_switches() to undo this mode and restore the LODNode to its normal behavior.
bool verifyChildBounds | ( | ) |
Returns true if the bounding volumes for the geometry of each fhild node entirely fits within the switch_in radius for that child, or false otherwise.
It is almost always a mistake for the geometry of an LOD level to be larger than its switch_in radius.