Panda3D
Public Member Functions | List of all members
HeightfieldTesselator Class Reference
Inheritance diagram for HeightfieldTesselator:
Namable

Public Member Functions

 __init__ (const HeightfieldTesselator)
 
 __init__ (str name)
 
NodePath generate ()
 Generates a tree of nodes that represents the heightfield. More...
 
double getElevation (double x, double y)
 Fetches the elevation at (x,y), where the input coordinate is specified in pixels. More...
 
PNMImage heightfield ()
 Returns a reference to the heightfield (a PNMImage) contained inside the HeightfieldTesselator. More...
 
 setFocalPoint (int x, int y)
 Sets the focal point. More...
 
bool setHeightfield (const Filename filename, PNMFileType type)
 Loads the specified greyscale image file into the heightfield. More...
 
 setHorizontalScale (double h)
 Sets the horizontal scale. More...
 
 setMaxTriangles (int n)
 Sets the max triangles per geom. More...
 
 setPolyCount (int n)
 Sets the polygon-count target. More...
 
 setVerticalScale (double v)
 Sets the vertical scale. More...
 
 setVisibilityRadius (int r)
 Sets the visibility radius. More...
 
- Public Member Functions inherited from Namable
 __init__ (const Namable)
 
 __init__ (str initial_name)
 
 clearName ()
 Resets the Namable's name to empty. More...
 
str getName ()
 
bool hasName ()
 Returns true if the Namable has a nonempty name set, false if the name is empty. More...
 
 output (Ostream out)
 Outputs the Namable. More...
 
 setName (str name)
 

Additional Inherited Members

- Static Public Member Functions inherited from Namable
static TypeHandle getClassType ()
 
- Public Attributes inherited from Namable
const String name
 

Member Function Documentation

◆ __init__() [1/2]

__init__ ( const  HeightfieldTesselator)

◆ __init__() [2/2]

__init__ ( str  name)

◆ generate()

NodePath generate ( )

Generates a tree of nodes that represents the heightfield.

This can be reparented into the scene.

◆ getElevation()

double getElevation ( double  x,
double  y 
)

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.

◆ heightfield()

PNMImage heightfield ( )

Returns a reference to the heightfield (a PNMImage) contained inside the HeightfieldTesselator.

You can use the reference to alter the heightfield.

◆ setFocalPoint()

setFocalPoint ( int  x,
int  y 
)

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.

◆ setHeightfield()

bool setHeightfield ( const Filename  filename,
PNMFileType  type 
)

Loads the specified greyscale image file into the heightfield.

◆ setHorizontalScale()

setHorizontalScale ( double  h)

Sets the horizontal scale.

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

◆ setMaxTriangles()

setMaxTriangles ( int  n)

Sets the max triangles per geom.

◆ setPolyCount()

setPolyCount ( int  n)

Sets the polygon-count target.

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

◆ setVerticalScale()

setVerticalScale ( double  v)

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.

◆ setVisibilityRadius()

setVisibilityRadius ( int  r)

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.