Skip to content

Commit

Permalink
remapped uv range [0, 1] to image pixel range [0, w-1] (or [0, h-1])
Browse files Browse the repository at this point in the history
  • Loading branch information
EzioHelios authored Dec 8, 2023
1 parent fbe5e64 commit 4962cf4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Obj2Tiles.Library/Geometry/MeshT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -1238,4 +1238,4 @@ public enum TexturesStrategy
Compress,
Repack,
RepackCompressed
}
}

0 comments on commit 4962cf4

Please sign in to comment.