Browse Source

Fix an error in sculpt LOD calculation

Dahlia Trimble 15 năm trước cách đây
mục cha
commit
032b30ffdb
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 3 3
      OpenSim/Region/Physics/Meshing/SculptMesh.cs

+ 3 - 3
OpenSim/Region/Physics/Meshing/SculptMesh.cs

@@ -56,8 +56,8 @@ namespace PrimMesher
 
             int destX = 0;
             int destY = 0;
-            int destWidth = (int)(sourceWidth * scale);
-            int destHeight = (int)(sourceHeight * scale);
+            int destWidth = (int)(srcImage.Width * scale);
+            int destHeight = (int)(srcImage.Height * scale);
 
             Bitmap scaledImage = new Bitmap(destWidth, destHeight,
                                      PixelFormat.Format24bppRgb);
@@ -214,7 +214,7 @@ namespace PrimMesher
             uvs = new List<UVCoord>();
 
             //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;
 
             Bitmap bitmap;