diff options
author | makamys <makamys@outlook.com> | 2022-06-09 21:20:42 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2022-06-10 19:20:57 +0200 |
commit | f52fb6744aa0f675965df7a596b9c3a469e7b54b (patch) | |
tree | 4865d902db0ea54f446b2f30128a1718de64ddae /src | |
parent | 995d0c1f2e8342c73b5ea61e81415ce0579ed221 (diff) | |
download | Neodymium-f52fb6744aa0f675965df7a596b9c3a469e7b54b.tar.gz Neodymium-f52fb6744aa0f675965df7a596b9c3a469e7b54b.tar.bz2 Neodymium-f52fb6744aa0f675965df7a596b9c3a469e7b54b.zip |
coords wrong?
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/MeshQuad.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/MeshQuad.java b/src/main/java/makamys/neodymium/renderer/MeshQuad.java index ca6f5a2..438f06b 100644 --- a/src/main/java/makamys/neodymium/renderer/MeshQuad.java +++ b/src/main/java/makamys/neodymium/renderer/MeshQuad.java @@ -37,6 +37,8 @@ public class MeshQuad { public static int[] totalMergeCountByPlane = new int[3]; + private MeshQuad mergeReference; + private int minPositive(int a, int b) { if(a == -1) { return b; @@ -116,8 +118,12 @@ public class MeshQuad { } } - private boolean isTranslatedCopyOf(MeshQuad o) { - if(!isValid(this) || !isValid(o) || plane != o.plane) return false; + private boolean isTranslatedCopyOf(MeshQuad o, boolean checkValid) { + if((!isValid(this) && checkValid) || !isValid(o) || plane != o.plane) return false; + + if(mergeReference != null) { + return mergeReference.isTranslatedCopyOf(o, false); + } for(int i = 1; i < 4; i++) { double relX = xs[i] - xs[0]; @@ -139,7 +145,7 @@ public class MeshQuad { } public void tryToMerge(MeshQuad o) { - if(isTranslatedCopyOf(o)) { + if(isTranslatedCopyOf(o, true)) { int numVerticesTouching = 0; boolean[] verticesTouching = new boolean[4]; for(int i = 0; i < 4; i++) { @@ -159,6 +165,8 @@ public class MeshQuad { totalMergeCountByPlane[plane.ordinal() - 1]++; + mergeReference = o; + o.deleted = true; } } |