diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresTileModel.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresTileModel.java index a6536dd7..ab87e4f2 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresTileModel.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresTileModel.java @@ -34,7 +34,10 @@ import de.bluecolored.bluemap.core.util.math.MatrixM4f; import de.bluecolored.bluemap.core.util.math.VectorM3f; -import java.io.*; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; import java.util.UUID; @@ -625,10 +628,11 @@ private void sort() { MergeSort.mergeSortInt(materialIndexSort, 0, size, this::compareMaterialIndex, materialIndexSortSupport); // move + int s; for (int i = 0; i < size; i++) { - while (materialIndexSort[i] != i) { - swap(i, materialIndexSort[i]); - } + s = materialIndexSort[i]; + while (s < i) s = materialIndexSort[s]; + swap(i, s); } } @@ -694,9 +698,9 @@ private void swap(int face1, int face2) { materialIndex[face2] = vi; //swap material-index-sort (assuming FI_MATERIAL_INDEX = 1) - vi = materialIndexSort[face1]; - materialIndexSort[face1] = materialIndexSort[face2]; - materialIndexSort[face2] = vi; + //vi = materialIndexSort[face1]; + //materialIndexSort[face1] = materialIndexSort[face2]; + //materialIndexSort[face2] = vi; } private static void calculateSurfaceNormal(