Fix an error in sculpt LOD calculation
parent
792ebca5f3
commit
032b30ffdb
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue