21 INLINE HeightfieldTesselator::
22 HeightfieldTesselator(
const string &name) :
Namable(name) {
24 _visibility_radius = 32768;
27 _horizontal_scale = 1.0;
28 _vertical_scale = 255.0;
30 _radii_calculated =
false;
38 INLINE HeightfieldTesselator::
39 ~HeightfieldTesselator() {
62 _radii_calculated =
false;
63 return _heightfield.
read(filename, ftype);
75 _radii_calculated =
false;
92 _radii_calculated =
false;
93 if (radius < 1) radius = 1;
94 if (radius > 32768) radius = 32768;
95 _visibility_radius = radius;
121 _horizontal_scale = h;
151 INLINE
bool HeightfieldTesselator::
152 subdivide(
int scale,
int x,
int y) {
160 int deltax = x - _focal_x;
161 int deltay = y - _focal_y;
162 if (deltax < 0) deltax = -deltax;
163 if (deltay < 0) deltay = -deltay;
164 int dist = (deltax > deltay) ? deltax : deltay;
165 if (dist < _radii[scale-1]) {
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.
bool read(const Filename &filename, PNMFileType *type=NULL, bool report_unknown_type=true)
Reads the indicated image filename.
This is the base class of a family of classes that represent particular image file types that PNMImag...
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.
bool set_heightfield(const Filename &filename, PNMFileType *type=NULL)
Loads the specified greyscale image file into the heightfield.