LODNode
from panda3d.core import LODNode
- class LODNode
Bases:
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
- addSwitch(in: float, out: float)
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”.
- property center LPoint3
Returns/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.
- clearForceSwitch()
Undoes the effect of a previous call to
forceSwitch()
and releases theLODNode
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. SeeaddSwitch()
.
- forceSwitch(index: int)
Forces the
LODNode
to show the indicated level instead of the level that would normally be shown based on the distance from the camera.
- 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.
- static getClassType() TypeHandle
- 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.
- 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.
- 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.
- 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 theLODNode
to function correctly.
- 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.
- hideSwitch(index: int)
Disables a previous call to
showSwitch()
.
- property highest_switch 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.
- property ins Sequence[float]
Returns the “in” distance of the indicated switch range. This should be larger than the “out” distance of the same range.
- isAnyShown() bool
Returns true if any switch has been shown with
showSwitch()
, indicating theLODNode
is in debug show mode; or false if it is in the normal mode.
- property lod_scale float
- 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
- property lowest_switch 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.
- static makeDefaultLod(name: str) LODNode
Creates a new
LODNode
of the type specified by the default-lod-type config variable.
- property outs Sequence[float]
Returns the “out” distance of the indicated switch range. This should be smaller than the “in” distance of the same range.
- setCenter(center: LPoint3)
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(value: float)
Sets the multiplier for lod distances. A higher value means you’ll see farther switchs than normal
- setSwitch(index: int, in: float, out: float) bool
Changes the switching range of a particular child of the
LODNode
. SeeaddSwitch()
.
- showAllSwitches()
Shows all levels in their default colors.
- showSwitch(index: int)
This is provided as a debugging aid.
showSwitch()
will put theLODNode
into a special mode where rather than computing and drawing the appropriate level of the LOD, a ring is drawn around theLODNode
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()
orhideAllSwitches()
to undo this mode and restore theLODNode
to its normal behavior.
- showSwitch(index: int, color: LColor)
This is provided as a debugging aid.
showSwitch()
will put theLODNode
into a special mode where rather than computing and drawing the appropriate level of the LOD, a ring is drawn around theLODNode
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()
orhideAllSwitches()
to undo this mode and restore theLODNode
to its normal behavior.