aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/renderer/MeshQuad.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer/MeshQuad.java')
-rw-r--r--src/main/java/makamys/neodymium/renderer/MeshQuad.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/MeshQuad.java b/src/main/java/makamys/neodymium/renderer/MeshQuad.java
index 2024efd..1ff4173 100644
--- a/src/main/java/makamys/neodymium/renderer/MeshQuad.java
+++ b/src/main/java/makamys/neodymium/renderer/MeshQuad.java
@@ -96,7 +96,9 @@ public class MeshQuad {
}
}
- public MeshQuad(int[] rawBuffer, int offset, ChunkMesh.Flags flags, int offsetX, int offsetY, int offsetZ) {
+ public void setState(int[] rawBuffer, int offset, ChunkMesh.Flags flags, int offsetX, int offsetY, int offsetZ) {
+ resetState();
+
read(rawBuffer, offset, offsetX, offsetY, offsetZ);
uDirectionIs01 = us[0] != us[1];
@@ -110,6 +112,36 @@ public class MeshQuad {
normal = QuadNormal.fromVector(vectorC);
}
+ private void resetState() {
+ Arrays.fill(xs, 0);
+ Arrays.fill(ys, 0);
+ Arrays.fill(zs, 0);
+ Arrays.fill(us, 0);
+ Arrays.fill(vs, 0);
+ Arrays.fill(bs, 0);
+ Arrays.fill(cs, 0);
+
+ minX = Float.POSITIVE_INFINITY;
+ minY = Float.POSITIVE_INFINITY;
+ minZ = Float.POSITIVE_INFINITY;
+ maxX = Float.NEGATIVE_INFINITY;
+ maxY = Float.NEGATIVE_INFINITY;
+ maxZ = Float.NEGATIVE_INFINITY;
+
+ deleted = noMerge = false;
+ normal = null;
+ offset = 0;
+ flags = null;
+ uDirectionIs01 = false;
+ Arrays.fill(quadCountByDirection, 1);
+ Arrays.fill(totalMergeCountByPlane, 0);
+ mergeReference = null;
+ }
+
+ public MeshQuad() {
+
+ }
+
public void writeToBuffer(BufferWriter out) throws IOException {
for(int vertexI = 0; vertexI < 4; vertexI++) {
int vi = vertexI;