revert my change to the range of greyscale image maps, setting it back to 0 - 127.5 so not to break loading of old files. There isnt a range that fits all needs anyway

avinationmerge
UbitUmarov 2015-09-21 00:44:53 +01:00
parent fe5807cd09
commit 33b4077c2c
1 changed files with 8 additions and 3 deletions

View File

@ -213,8 +213,10 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
/// <returns>A System.Drawing.Bitmap containing a grayscale image</returns> /// <returns>A System.Drawing.Bitmap containing a grayscale image</returns>
protected static Bitmap CreateGrayscaleBitmapFromMap(ITerrainChannel map) protected static Bitmap CreateGrayscaleBitmapFromMap(ITerrainChannel map)
{ {
// Bitmap bmp = new Bitmap(map.Width, map.Height, PixelFormat.Format24bppRgb);
Bitmap bmp = new Bitmap(map.Width, map.Height); Bitmap bmp = new Bitmap(map.Width, map.Height);
const int pallete = 256; const int pallete = 256;
Color[] grays = new Color[pallete]; Color[] grays = new Color[pallete];
@ -227,9 +229,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
{ {
for (int x = 0; x < map.Width; x++) for (int x = 0; x < map.Width; x++)
{ {
int colorindex = (int)map[x, y]; // one to one conversion as seems apparent on sl docs // to change this, loading also needs change
// or 0-511 range?
// int colorindex = (int)map[x, y]/2; // 0-511 // int colorindex = (int)map[x, y]; // one to one conversion 0 - 255m range
// int colorindex = (int)map[x, y] / 2; // 0 - 510 range
int colorindex = (int)map[x, y] * 2; // the original 0 - 127.5 range
// clamp it not adding the red warning // clamp it not adding the red warning
if (colorindex < 0) if (colorindex < 0)