diff --git a/Obj2Tiles.Library/Geometry/MeshT.cs b/Obj2Tiles.Library/Geometry/MeshT.cs index b88afce..cf5dd62 100644 --- a/Obj2Tiles.Library/Geometry/MeshT.cs +++ b/Obj2Tiles.Library/Geometry/MeshT.cs @@ -491,8 +491,8 @@ private void BinPackTextures(string targetFolder, int materialIndex, IReadOnlyLi Debug.WriteLine("Cluster boundary (percentage): " + clusterBoundary); - var clusterX = (int)Math.Floor(clusterBoundary.Left * textureWidth); - var clusterY = (int)Math.Floor(clusterBoundary.Top * textureHeight); + var clusterX = (int)Math.Floor(clusterBoundary.Left * (textureWidth - 1)); + var clusterY = (int)Math.Floor(clusterBoundary.Top * (textureHeight - 1)); var clusterWidth = (int)Math.Max(Math.Ceiling(clusterBoundary.Width * textureWidth), 1); var clusterHeight = (int)Math.Max(Math.Ceiling(clusterBoundary.Height * textureHeight), 1); @@ -1238,4 +1238,4 @@ public enum TexturesStrategy Compress, Repack, RepackCompressed -} \ No newline at end of file +}