diff options
author | makamys <makamys@outlook.com> | 2022-06-11 14:21:16 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2022-06-11 14:39:23 +0200 |
commit | 8e034cf328847a9f1eae1b4b7bfdae0e8ac71d08 (patch) | |
tree | c51aff00902a8a503a15f3a1a38e51f53972cc24 /src/main/java | |
parent | 9e1c83f7532adb5cbbcb1f1f8e98059b5edfbb58 (diff) | |
download | Neodymium-8e034cf328847a9f1eae1b4b7bfdae0e8ac71d08.tar.gz Neodymium-8e034cf328847a9f1eae1b4b7bfdae0e8ac71d08.tar.bz2 Neodymium-8e034cf328847a9f1eae1b4b7bfdae0e8ac71d08.zip |
Make disabling chunk simplification work again
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/ChunkMesh.java | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/ChunkMesh.java b/src/main/java/makamys/neodymium/renderer/ChunkMesh.java index e175167..1c979b7 100644 --- a/src/main/java/makamys/neodymium/renderer/ChunkMesh.java +++ b/src/main/java/makamys/neodymium/renderer/ChunkMesh.java @@ -103,28 +103,30 @@ public class ChunkMesh extends Mesh { quads.add(quad); } - ArrayList<ArrayList<MeshQuad>> quadsByPlaneDir = new ArrayList<>(); // XY, XZ, YZ - for(int i = 0; i < 3; i++) { - quadsByPlaneDir.add(new ArrayList<MeshQuad>()); - } - for(MeshQuad quad : quads) { - if(quad.plane != MeshQuad.Plane.NONE) { - quadsByPlaneDir.get(quad.plane.ordinal() - 1).add(quad); + if(Config.simplifyChunkMeshes) { + ArrayList<ArrayList<MeshQuad>> quadsByPlaneDir = new ArrayList<>(); // XY, XZ, YZ + for(int i = 0; i < 3; i++) { + quadsByPlaneDir.add(new ArrayList<MeshQuad>()); } - } - for(int plane = 0; plane < 3; plane++) { - quadsByPlaneDir.get(plane).sort(MeshQuad.QuadPlaneComparator.quadPlaneComparators[plane]); - } - - for(int plane = 0; plane < 3; plane++) { - List<MeshQuad> planeDirQuads = quadsByPlaneDir.get(plane); - int planeStart = 0; - for(int quadI = 0; quadI < planeDirQuads.size(); quadI++) { - MeshQuad quad = planeDirQuads.get(quadI); - MeshQuad nextQuad = quadI == planeDirQuads.size() - 1 ? null : planeDirQuads.get(quadI + 1); - if(!quad.onSamePlaneAs(nextQuad)) { - simplifyPlane(planeDirQuads.subList(planeStart, quadI + 1)); - planeStart = quadI + 1; + for(MeshQuad quad : quads) { + if(quad.plane != MeshQuad.Plane.NONE) { + quadsByPlaneDir.get(quad.plane.ordinal() - 1).add(quad); + } + } + for(int plane = 0; plane < 3; plane++) { + quadsByPlaneDir.get(plane).sort(MeshQuad.QuadPlaneComparator.quadPlaneComparators[plane]); + } + + for(int plane = 0; plane < 3; plane++) { + List<MeshQuad> planeDirQuads = quadsByPlaneDir.get(plane); + int planeStart = 0; + for(int quadI = 0; quadI < planeDirQuads.size(); quadI++) { + MeshQuad quad = planeDirQuads.get(quadI); + MeshQuad nextQuad = quadI == planeDirQuads.size() - 1 ? null : planeDirQuads.get(quadI + 1); + if(!quad.onSamePlaneAs(nextQuad)) { + simplifyPlane(planeDirQuads.subList(planeStart, quadI + 1)); + planeStart = quadI + 1; + } } } } |