From dd30daf76fd32d3dae980894b3e2a1c9b69028da Mon Sep 17 00:00:00 2001 From: makamys Date: Thu, 9 Jun 2022 22:11:21 +0200 Subject: Keep track of number of quads glued together --- .../java/makamys/neodymium/renderer/MeshQuad.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/main/java/makamys') 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; -- cgit