In case where I have u = 1.0 or v 1.0 of vt {u} {v} in my obj file, the following line in Obj2Tiles.Library.Common.CopyImage will throw index out of range exception.
targetRow[x + destX] = sourceRow[x + sourceX];
I traced back and found that when clusterBoundary.Left (u) is exactly 1.0, clusterX will be equal to textureWidth and cause this problem.
Maybe we should consider remapping uv range [0, 1] to image pixel range [0, w-1] (or [0, h-1])?
var clusterX = (int)Math.Floor(clusterBoundary.Left * (textureWidth - 1));
var clusterY = (int)Math.Floor(clusterBoundary.Top * (textureHeight - 1));
As for uv out of range [0, 1], it might not be necessary to handle repetition.
In case where I have u = 1.0 or v 1.0 of
vt {u} {v}
in my obj file, the following line inObj2Tiles.Library.Common.CopyImage
will throw index out of range exception.I traced back and found that when
clusterBoundary.Left
(u) is exactly 1.0, clusterX will be equal totextureWidth
and cause this problem.Maybe we should consider remapping uv range [0, 1] to image pixel range [0, w-1] (or [0, h-1])?
As for uv out of range [0, 1], it might not be necessary to handle repetition.