|
34 | 34 | import de.bluecolored.bluemap.core.util.math.MatrixM4f; |
35 | 35 | import de.bluecolored.bluemap.core.util.math.VectorM3f; |
36 | 36 |
|
37 | | -import java.io.*; |
| 37 | +import java.io.BufferedWriter; |
| 38 | +import java.io.IOException; |
| 39 | +import java.io.OutputStream; |
| 40 | +import java.io.OutputStreamWriter; |
38 | 41 | import java.nio.charset.StandardCharsets; |
39 | 42 | import java.util.UUID; |
40 | 43 |
|
@@ -625,10 +628,11 @@ private void sort() { |
625 | 628 | MergeSort.mergeSortInt(materialIndexSort, 0, size, this::compareMaterialIndex, materialIndexSortSupport); |
626 | 629 |
|
627 | 630 | // move |
| 631 | + int s; |
628 | 632 | for (int i = 0; i < size; i++) { |
629 | | - while (materialIndexSort[i] != i) { |
630 | | - swap(i, materialIndexSort[i]); |
631 | | - } |
| 633 | + s = materialIndexSort[i]; |
| 634 | + while (s < i) s = materialIndexSort[s]; |
| 635 | + swap(i, s); |
632 | 636 | } |
633 | 637 | } |
634 | 638 |
|
@@ -694,9 +698,9 @@ private void swap(int face1, int face2) { |
694 | 698 | materialIndex[face2] = vi; |
695 | 699 |
|
696 | 700 | //swap material-index-sort (assuming FI_MATERIAL_INDEX = 1) |
697 | | - vi = materialIndexSort[face1]; |
698 | | - materialIndexSort[face1] = materialIndexSort[face2]; |
699 | | - materialIndexSort[face2] = vi; |
| 701 | + //vi = materialIndexSort[face1]; |
| 702 | + //materialIndexSort[face1] = materialIndexSort[face2]; |
| 703 | + //materialIndexSort[face2] = vi; |
700 | 704 | } |
701 | 705 |
|
702 | 706 | private static void calculateSurfaceNormal( |
|
0 commit comments