|
|
@@ -361,9 +361,9 @@ set_heightfield(const Filename &filename, PNMFileType *ftype) {
|
|
|
if (image.read(filename, ftype)) {
|
|
|
_is_dirty = true;
|
|
|
_heightfield = PNMImage(
|
|
|
- max(3, (int) pow(2.0, ceil(log(float(max(2, image.get_x_size())))
|
|
|
+ max(3, (int) pow(2.0, ceil(log(float(max(2, image.get_x_size() - 1)))
|
|
|
/ log(2.0))) + 1),
|
|
|
- max(3, (int) pow(2.0, ceil(log(float(max(2, image.get_y_size())))
|
|
|
+ max(3, (int) pow(2.0, ceil(log(float(max(2, image.get_y_size() - 1)))
|
|
|
/ log(2.0))) + 1));
|
|
|
// Make sure not to apply gaussian when it's already the right size
|
|
|
if (_heightfield.get_x_size() == image.get_x_size() &&
|
|
|
@@ -381,9 +381,9 @@ set_heightfield(const Filename &filename, PNMFileType *ftype) {
|
|
|
INLINE bool GeoMipTerrain::
|
|
|
set_heightfield(const PNMImage &image) {
|
|
|
_heightfield = PNMImage(
|
|
|
- max(3, (int) pow(2.0, ceil(log(float(max(2, image.get_x_size())))
|
|
|
+ max(3, (int) pow(2.0, ceil(log(float(max(2, image.get_x_size() - 1)))
|
|
|
/ log(2.0))) + 1),
|
|
|
- max(3, (int) pow(2.0, ceil(log(float(max(2, image.get_y_size())))
|
|
|
+ max(3, (int) pow(2.0, ceil(log(float(max(2, image.get_y_size() - 1)))
|
|
|
/ log(2.0))) + 1));
|
|
|
// Make sure not to apply gaussian when it's already the right size
|
|
|
if (_heightfield.get_x_size() == image.get_x_size() &&
|
|
|
@@ -400,9 +400,9 @@ set_heightfield(const PNMImage &image) {
|
|
|
INLINE bool GeoMipTerrain::
|
|
|
set_heightfield(const Texture *tex) {
|
|
|
_heightfield = PNMImage(
|
|
|
- max(3, (int) pow(2.0, ceil(log(float(max(2, tex->get_x_size())))
|
|
|
+ max(3, (int) pow(2.0, ceil(log(float(max(2, tex->get_x_size() - 1)))
|
|
|
/ log(2.0))) + 1),
|
|
|
- max(3, (int) pow(2.0, ceil(log(float(max(2, tex->get_y_size())))
|
|
|
+ max(3, (int) pow(2.0, ceil(log(float(max(2, tex->get_y_size() - 1)))
|
|
|
/ log(2.0))) + 1));
|
|
|
PNMImage image;
|
|
|
tex->store(image);
|