# panda3d.core.LODNode¶

class LODNode

Bases: PandaNode

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.

Inheritance diagram

__init__(name: str) → None
static makeDefaultLod(name: str) → LODNode

Creates a new LODNode of the type specified by the default-lod-type config variable.

Return type

LODNode

addSwitch(in: float, out: float) → None

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”.

setSwitch(index: int, in: float, out: float) → bool

Changes the switching range of a particular child of the LODNode. See addSwitch().

clearSwitches() → None

Removes the set of switching ranges for the LODNode, presumably in conjunction with removing all of its children. See addSwitch().

getNumSwitches() → int

Returns the number of switch ranges added to the LODNode. This should correspond to the number of children of the node in order for the LODNode to function correctly.

getIn(index: int) → float

Returns the “in” distance of the indicated switch range. This should be larger than the “out” distance of the same range.

getOut(index: int) → float

Returns the “out” distance of the indicated switch range. This should be smaller than the “in” distance of the same range.

getLowestSwitch() → int

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.

getHighestSwitch() → int

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.

forceSwitch(index: int) → None

Forces the LODNode to show the indicated level instead of the level that would normally be shown based on the distance from the camera.

clearForceSwitch() → None

Undoes the effect of a previous call to forceSwitch() and releases the LODNode to once again display the normal level.

setLodScale(value: float) → None

Sets the multiplier for lod distances. A higher value means you’ll see farther switchs than normal

getLodScale() → float

Returns the multiplier for lod distances

setCenter(center: LPoint3) → None

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.

getCenter() → LPoint3

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.

Return type

LPoint3

showSwitch(index: int) → None

This is provided as a debugging aid. showSwitch() 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 hideSwitch() or hideAllSwitches() to undo this mode and restore the LODNode to its normal behavior.

showSwitch(index: int, color: LColor) → None

This is provided as a debugging aid. showSwitch() 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 hideSwitch() or hideAllSwitches() to undo this mode and restore the LODNode to its normal behavior.

hideSwitch(index: int) → None

Disables a previous call to showSwitch().

showAllSwitches() → None

Shows all levels in their default colors.

hideAllSwitches() → None

Hides all levels, restoring the LODNode to normal operation.

isAnyShown() → bool

Returns true if any switch has been shown with showSwitch(), indicating the LODNode is in debug show mode; or false if it is in the normal mode.

verifyChildBounds() → bool

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.

static getClassType() → TypeHandle
Return type

TypeHandle

getIns() → list
getOuts() → list
property ins

Returns the “in” distance of the indicated switch range. This should be larger than the “out” distance of the same range.

Return type

Sequence[float]

property outs

Returns the “out” distance of the indicated switch range. This should be smaller than the “in” distance of the same range.

Return type

Sequence[float]

property lowest_switch

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.

Return type

int

property highest_switch

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.

Return type

int

property lod_scale
Getter

Returns the multiplier for lod distances

Setter

for performance tuning, increasing this value should improve performance at the cost of model quality

for performance tuning, increasing this value should improve performance at the cost of model quality

Sets the multiplier for lod distances. A higher value means you’ll see farther switchs than normal

Return type

float

property center
Getter

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.

Setter

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.

Return type

LPoint3