diff options
Diffstat (limited to 'src')
4 files changed, 11 insertions, 7 deletions
diff --git a/src/main/java/makamys/neodymium/config/Config.java b/src/main/java/makamys/neodymium/config/Config.java index c582033..5b110fd 100644 --- a/src/main/java/makamys/neodymium/config/Config.java +++ b/src/main/java/makamys/neodymium/config/Config.java @@ -64,6 +64,8 @@ public class Config { public static int VRAMSize; @ConfigEnum(cat="render", def="auto", clazz=AutomatableBoolean.class, com="Render fog? Slightly reduces framerate. `auto` means the OpenGL setting will be respected (as set by mods like OptiFine).\nValid values: true, false, auto") public static AutomatableBoolean renderFog; + @ConfigInt(cat="render", def=Integer.MAX_VALUE, min=0, max=Integer.MAX_VALUE, com="Chunks further away than this distance (in chunks) will not have unaligned quads such as tall grass rendered.") + public static int maxUnalignedQuadDistance; @ConfigBoolean(cat="misc", def=true, com="Replace splash that says 'OpenGL 1.2!' with 'OpenGL 3.3!'. Just for fun.") public static boolean replaceOpenGLSplash; diff --git a/src/main/java/makamys/neodymium/renderer/ChunkMesh.java b/src/main/java/makamys/neodymium/renderer/ChunkMesh.java index 6c39d9e..a9055b2 100644 --- a/src/main/java/makamys/neodymium/renderer/ChunkMesh.java +++ b/src/main/java/makamys/neodymium/renderer/ChunkMesh.java @@ -16,6 +16,7 @@ import makamys.neodymium.config.Config; import makamys.neodymium.ducks.IWorldRenderer; import makamys.neodymium.util.BufferWriter; import makamys.neodymium.util.RecyclingList; +import makamys.neodymium.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; @@ -266,9 +267,9 @@ public class ChunkMesh extends Mesh { } @Override - public int writeToIndexBuffer(IntBuffer piFirst, IntBuffer piCount, int cameraXDiv, int cameraYDiv, int cameraZDiv) { + public int writeToIndexBuffer(IntBuffer piFirst, IntBuffer piCount, int cameraXDiv, int cameraYDiv, int cameraZDiv, int pass) { if(!Config.cullFaces) { - return super.writeToIndexBuffer(piFirst, piCount, cameraXDiv, cameraYDiv, cameraZDiv); + return super.writeToIndexBuffer(piFirst, piCount, cameraXDiv, cameraYDiv, cameraZDiv, pass); } int renderedMeshes = 0; @@ -278,7 +279,7 @@ public class ChunkMesh extends Mesh { if(i < subMeshStart.length && subMeshStart[i] == -1) continue; QuadNormal normal = i < NORMAL_ORDER.length ? NORMAL_ORDER[i] : null; - boolean isVisible = normal != null && isNormalVisible(normal, cameraXDiv, cameraYDiv, cameraZDiv); + boolean isVisible = normal != null && isNormalVisible(normal, cameraXDiv, cameraYDiv, cameraZDiv, pass); if(isVisible && startIndex == -1) { startIndex = subMeshStart[QUAD_NORMAL_TO_NORMAL_ORDER[normal.ordinal()]]; @@ -296,7 +297,7 @@ public class ChunkMesh extends Mesh { return renderedMeshes; } - private boolean isNormalVisible(QuadNormal normal, int interpXDiv, int interpYDiv, int interpZDiv) { + private boolean isNormalVisible(QuadNormal normal, int interpXDiv, int interpYDiv, int interpZDiv, int pass) { switch(normal) { case POSITIVE_X: return interpXDiv >= ((x + 0)); @@ -311,7 +312,8 @@ public class ChunkMesh extends Mesh { case NEGATIVE_Z: return interpZDiv < ((z + 1)); default: - return true; + return pass != 0 || Config.maxUnalignedQuadDistance == Integer.MAX_VALUE + || Util.distSq(interpXDiv, interpYDiv, interpZDiv, x, y, z) < Math.pow((double)Config.maxUnalignedQuadDistance, 2); } } diff --git a/src/main/java/makamys/neodymium/renderer/Mesh.java b/src/main/java/makamys/neodymium/renderer/Mesh.java index f3e2279..6518c46 100644 --- a/src/main/java/makamys/neodymium/renderer/Mesh.java +++ b/src/main/java/makamys/neodymium/renderer/Mesh.java @@ -42,7 +42,7 @@ public abstract class Mesh { UNSENT, SENT, PENDING_DELETE } - public int writeToIndexBuffer(IntBuffer piFirst, IntBuffer piCount, int cameraXDiv, int cameraYDiv, int cameraZDiv) { + public int writeToIndexBuffer(IntBuffer piFirst, IntBuffer piCount, int cameraXDiv, int cameraYDiv, int cameraZDiv, int pass) { piFirst.put(iFirst); piCount.put(iCount); diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java index e70a12c..a87c7b3 100644 --- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java +++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java @@ -194,7 +194,7 @@ public class NeoRenderer { for(Mesh mesh : sentMeshes[i]) { WorldRenderer wr = ((ChunkMesh)mesh).wr; if(mesh.visible && wr.isVisible && shouldRenderMesh(mesh)) { - int meshes = mesh.writeToIndexBuffer(piFirst[i], piCount[i], eyePosXTDiv, eyePosYTDiv, eyePosZTDiv); + int meshes = mesh.writeToIndexBuffer(piFirst[i], piCount[i], eyePosXTDiv, eyePosYTDiv, eyePosZTDiv, i); renderedMeshes += meshes; for(int j = piCount[i].position() - meshes; j < piCount[i].position(); j++) { renderedQuads += piCount[i].get(j) / 4; |