aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-09 22:11:21 +0200
committermakamys <makamys@outlook.com>2022-06-10 19:20:59 +0200
commitdd30daf76fd32d3dae980894b3e2a1c9b69028da (patch)
tree5ef3391719af09cc6a2ef8aae452da645f421957 /src/main/java/makamys
parent75b53acdf6859666549279d66b39309b0f216b7a (diff)
downloadNeodymium-dd30daf76fd32d3dae980894b3e2a1c9b69028da.tar.gz
Neodymium-dd30daf76fd32d3dae980894b3e2a1c9b69028da.tar.bz2
Neodymium-dd30daf76fd32d3dae980894b3e2a1c9b69028da.zip
Keep track of number of quads glued together
Diffstat (limited to 'src/main/java/makamys')
-rw-r--r--src/main/java/makamys/neodymium/renderer/MeshQuad.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/MeshQuad.java b/src/main/java/makamys/neodymium/renderer/MeshQuad.java
index 438f06b..6d1221e 100644
--- a/src/main/java/makamys/neodymium/renderer/MeshQuad.java
+++ b/src/main/java/makamys/neodymium/renderer/MeshQuad.java
@@ -14,6 +14,15 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.EnumFacing;
+/*
+ * This is what a quad looks like.
+ *
+ * 2--1
+ * | |
+ * 3--0
+ *
+ */
+
public class MeshQuad {
public float[] xs = new float[4];
public float[] ys = new float[4];
@@ -35,6 +44,9 @@ public class MeshQuad {
public int offset;
public ChunkMesh.Flags flags;
+ // 0: quads glued together on edge 0-1 or 2-3 ("row length")
+ // 1: quads glued together on edge 1-2 or 3-0 ("column length")
+ private int[] quadCountByDirection = {1, 1};
public static int[] totalMergeCountByPlane = new int[3];
private MeshQuad mergeReference;
@@ -163,6 +175,13 @@ public class MeshQuad {
}
}
+ if((verticesTouching[0] && verticesTouching[1]) || (verticesTouching[2] && verticesTouching[3])) {
+ quadCountByDirection[0] += o.quadCountByDirection[0];
+ }
+ if((verticesTouching[1] && verticesTouching[2]) || (verticesTouching[3] && verticesTouching[0])) {
+ quadCountByDirection[1] += o.quadCountByDirection[1];
+ }
+
totalMergeCountByPlane[plane.ordinal() - 1]++;
mergeReference = o;