Fix an error in sculpt LOD calculation

0.6.3-post-fixes
Dahlia Trimble 2009-01-21 02:40:09 +00:00
parent 792ebca5f3
commit 032b30ffdb
1 changed files with 3 additions and 3 deletions

View File

@ -56,8 +56,8 @@ namespace PrimMesher
int destX = 0; int destX = 0;
int destY = 0; int destY = 0;
int destWidth = (int)(sourceWidth * scale); int destWidth = (int)(srcImage.Width * scale);
int destHeight = (int)(sourceHeight * scale); int destHeight = (int)(srcImage.Height * scale);
Bitmap scaledImage = new Bitmap(destWidth, destHeight, Bitmap scaledImage = new Bitmap(destWidth, destHeight,
PixelFormat.Format24bppRgb); PixelFormat.Format24bppRgb);
@ -214,7 +214,7 @@ namespace PrimMesher
uvs = new List<UVCoord>(); uvs = new List<UVCoord>();
//float sourceScaleFactor = (float)lod / (float)Math.Max(sculptBitmap.Width, sculptBitmap.Height); //float sourceScaleFactor = (float)lod / (float)Math.Max(sculptBitmap.Width, sculptBitmap.Height);
float sourceScaleFactor = (float)(lod * lod) / (float)(sculptBitmap.Width * sculptBitmap.Height); float sourceScaleFactor = (float)(lod) / (float)Math.Sqrt(sculptBitmap.Width * sculptBitmap.Height);
bool scaleSourceImage = sourceScaleFactor < 1.0f ? true : false; bool scaleSourceImage = sourceScaleFactor < 1.0f ? true : false;
Bitmap bitmap; Bitmap bitmap;