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
- add_switch(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.
- clear_force_switch()
Undoes the effect of a previous call to
force_switch()
and releases theLODNode
to once again display the normal level.
- clear_switches()
Removes the set of switching ranges for the
LODNode
, presumably in conjunction with removing all of its children. Seeadd_switch()
.
- force_switch(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.
- get_center() 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 get_class_type() TypeHandle
- get_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.
- get_in(index: int) float
Returns the “in” distance of the indicated switch range. This should be larger than the “out” distance of the same range.
- get_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.
- get_num_switches() 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.
- get_out(index: int) float
Returns the “out” distance of the indicated switch range. This should be smaller than the “in” distance of the same range.
- hide_switch(index: int)
Disables a previous call to
show_switch()
.
- 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.
- is_any_shown() bool
Returns true if any switch has been shown with
show_switch()
, 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 make_default_lod(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.
- set_center(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.
- set_lod_scale(value: float)
Sets the multiplier for lod distances. A higher value means you’ll see farther switchs than normal
- set_switch(index: int, in: float, out: float) bool
Changes the switching range of a particular child of the
LODNode
. Seeadd_switch()
.
- show_all_switches()
Shows all levels in their default colors.
- show_switch(index: int)
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 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
hide_switch()
orhide_all_switches()
to undo this mode and restore theLODNode
to its normal behavior.
- show_switch(index: int, color: LColor)
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 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
hide_switch()
orhide_all_switches()
to undo this mode and restore theLODNode
to its normal behavior.