From 4962cf480f873c6af6a54fa58234cf5ca498a02f Mon Sep 17 00:00:00 2001 From: Ezio Helios <78869679+EzioHelios@users.noreply.github.com> Date: Fri, 8 Dec 2023 15:47:09 +0800 Subject: [PATCH] remapped uv range [0, 1] to image pixel range [0, w-1] (or [0, h-1]) --- Obj2Tiles.Library/Geometry/MeshT.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 +}