Skip to content

Commit

Permalink
Fixed bug in texture packing
Browse files Browse the repository at this point in the history
  • Loading branch information
HeDo88TH committed Oct 24, 2022
1 parent a5f8435 commit d89b52c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Obj2Tiles.Library/Geometry/MeshT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ private void BinPackTextures(string targetFolder, int materialIndex, IReadOnlyLi

Debug.WriteLine("Cluster boundary (percentage): " + clusterBoundary);

var clusterX = (int)Math.Ceiling(clusterBoundary.Left * textureWidth);
var clusterY = (int)Math.Ceiling(clusterBoundary.Top * textureHeight);
var clusterX = (int)Math.Floor(clusterBoundary.Left * textureWidth);
var clusterY = (int)Math.Floor(clusterBoundary.Top * textureHeight);
var clusterWidth = (int)Math.Max(Math.Ceiling(clusterBoundary.Width * textureWidth), 1);
var clusterHeight = (int)Math.Max(Math.Ceiling(clusterBoundary.Height * textureHeight), 1);

Expand Down
8 changes: 3 additions & 5 deletions Obj2Tiles.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\IT 2\AppData\Local\JetBrains\Rider2022.1\resharper-host\temp\Rider\vAny\CoverageData\_Obj2Tiles.646907580\Snapshot\snapshot.utdcvr</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">VISIBLE_FILES</s:String>

<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8f6e98fe_002Dd45d_002D40bb_002D8f84_002Dbefc3c28f84e/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Session" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Or&gt;&#xD;
&lt;Project Location="C:\Users\IT 2\source\repos\Obj2Tiles\Obj2Tiles.Library.Test" Presentation="&amp;lt;Obj2Tiles.Library.Test&amp;gt;" /&gt;&#xD;
&lt;Project Location="C:\Users\IT 2\source\repos\Obj2Tiles\Obj2Tiles.Test" Presentation="&amp;lt;Obj2Tiles.Test&amp;gt;" /&gt;&#xD;
&lt;/Or&gt;&#xD;
&lt;Project Location="D:\repos\Obj2Tiles\Obj2Tiles.Test" Presentation="&amp;lt;Obj2Tiles.Test&amp;gt;" /&gt;&#xD;
&lt;/SessionState&gt;</s:String>

</wpf:ResourceDictionary>
4 changes: 2 additions & 2 deletions Obj2Tiles/Obj2Tiles.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<AssemblyVersion>1.0.10</AssemblyVersion>
<FileVersion>1.0.10</FileVersion>
<AssemblyVersion>1.0.11</AssemblyVersion>
<FileVersion>1.0.11</FileVersion>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Obj2Tiles/Stages/DecimationStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static void InternalDecimate(ObjMesh sourceObjMesh, string destPath, flo
var currentTriangleCount = 0;
for (var i = 0; i < sourceSubMeshIndices.Length; i++)
{
currentTriangleCount += (sourceSubMeshIndices[i].Length / 3);
currentTriangleCount += sourceSubMeshIndices[i].Length / 3;
}

var targetTriangleCount = (int)Math.Ceiling(currentTriangleCount * quality);
Expand Down

0 comments on commit d89b52c

Please sign in to comment.