17 INLINE HeightfieldTesselator::
18 HeightfieldTesselator(
const std::string &name) :
Namable(name) {
20 _visibility_radius = 32768;
23 _horizontal_scale = 1.0;
24 _vertical_scale = 255.0;
26 _radii_calculated =
false;
32 INLINE HeightfieldTesselator::
33 ~HeightfieldTesselator() {
50 _radii_calculated =
false;
51 return _heightfield.
read(filename, ftype);
60 _radii_calculated =
false;
73 _radii_calculated =
false;
74 if (radius < 1) radius = 1;
75 if (radius > 32768) radius = 32768;
76 _visibility_radius = radius;
96 _horizontal_scale = h;
119 INLINE
bool HeightfieldTesselator::
120 subdivide(
int scale,
int x,
int y) {
126 int deltax = x - _focal_x;
127 int deltay = y - _focal_y;
128 if (deltax < 0) deltax = -deltax;
129 if (deltay < 0) deltay = -deltay;
130 int dist = (deltax > deltay) ? deltax : deltay;
131 if (dist < _radii[scale-1]) {
bool set_heightfield(const Filename &filename, PNMFileType *type=nullptr)
Loads the specified greyscale image file into the heightfield.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
void set_focal_point(int x, int y)
Sets the focal point.
PNMImage & heightfield()
Returns a reference to the heightfield (a PNMImage) contained inside the HeightfieldTesselator.
void set_max_triangles(int n)
Sets the max triangles per geom.
This is the base class of a family of classes that represent particular image file types that PNMImag...
bool read(const Filename &filename, PNMFileType *type=nullptr, bool report_unknown_type=true)
Reads the indicated image filename.
void set_horizontal_scale(double h)
Sets the horizontal scale.
A base class for all things which can have a name.
The name of a file, such as a texture file or an Egg file.
void set_visibility_radius(int r)
Sets the visibility radius.
void set_vertical_scale(double v)
Sets the vertical scale.
void set_poly_count(int n)
Sets the polygon-count target.