Support for 24-bits heightmaps

This commit is contained in:
rdb 2008-09-29 16:50:50 +00:00
parent 11aee82520
commit 56481db03c
1 changed files with 7 additions and 5 deletions

View File

@ -537,11 +537,13 @@ INLINE double GeoMipTerrain::
get_pixel_value(int x, int y) {
x = max(min(x,int(_xsize-1)),0);
y = max(min(y,int(_ysize-1)),0);
return double(_heightfield.get_bright(int(x),int(y)));
/* return double(_heightfield.get_red_val(int(x),int(y))
+ _heightfield.get_green_val(int(x),int(y)) * 256
+ _heightfield.get_blue_val(int(x),int(y)) * 65536) / 16777215.0;
*/
if (_heightfield.is_grayscale()) {
return double(_heightfield.get_bright(x, y));
} else {
return double(_heightfield.get_red(x, y));
+ double(_heightfield.get_green(x, y)) / 256.0;
+ double(_heightfield.get_blue(x, y)) / 65536.0;
}
}
INLINE double GeoMipTerrain::
get_pixel_value(unsigned short mx, unsigned short my, int x, int y) {