panda3d.core.HeightfieldTesselator

class HeightfieldTesselator

Bases: Namable

Inheritance diagram

Inheritance diagram of HeightfieldTesselator

__init__(param0: HeightfieldTesselator) → None
__init__(name: str) → None
heightfield() → PNMImage

Returns a reference to the heightfield (a PNMImage) contained inside the HeightfieldTesselator. You can use the reference to alter the heightfield.

Return type

PNMImage

setHeightfield(filename: Filename, type: PNMFileType) → bool

Loads the specified greyscale image file into the heightfield.

setPolyCount(n: int) → None

Sets the polygon-count target. The tesselator usually manages to come within about 20% of the target, plus or minus.

setVisibilityRadius(r: int) → None

Sets the visibility radius. Polygons that are completely outside the radius (relative to the focal point) are cropped away. The cropping is imperfect (all approximations are conservative), so this should be used in conjunction with a far clipping plane, fog, or some other visibility limiting mechanism. The units are in pixels.

setFocalPoint(x: int, y: int) → None

Sets the focal point. The tesselator generates high-resolution terrain around the focal point, and progressively lower and lower resolution terrain as you get farther away. The units are in pixels.

setHorizontalScale(h: float) → None

Sets the horizontal scale. The default scale is 1.0, meaning that each pixel in the heightfield is 1x1 panda units wide.

setVerticalScale(v: float) → None

Sets the vertical scale. The default scale is 255.0, meaning that each as the gray value ranges from (0-1), the elevation ranges from (0-255) feet.

setMaxTriangles(n: int) → None

Sets the max triangles per geom.

getElevation(x: float, y: float) → float

Fetches the elevation at (x,y), where the input coordinate is specified in pixels. This ignores the current tesselation level and instead provides an accurate number. Linear blending is used for non-integral coordinates.

generate() → NodePath

Generates a tree of nodes that represents the heightfield. This can be reparented into the scene.

Return type

NodePath