diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/ChunkMesh.java | 12 | ||||
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/NeoRenderer.java | 5 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/ChunkMesh.java b/src/main/java/makamys/neodymium/renderer/ChunkMesh.java index f578612..c4956eb 100644 --- a/src/main/java/makamys/neodymium/renderer/ChunkMesh.java +++ b/src/main/java/makamys/neodymium/renderer/ChunkMesh.java @@ -23,6 +23,7 @@ import net.minecraft.tileentity.TileEntity; public class ChunkMesh extends Mesh { Flags flags; + WorldRenderer wr; private int[] subMeshStart = new int[NORMAL_ORDER.length]; @@ -46,10 +47,11 @@ public class ChunkMesh extends Mesh { } } - public ChunkMesh(int x, int y, int z, Flags flags, int quadCount, List<MeshQuad> quads, int pass) { - this.x = x; - this.y = y; - this.z = z; + public ChunkMesh(WorldRenderer wr, Flags flags, int quadCount, List<MeshQuad> quads, int pass) { + this.x = wr.posX / 16; + this.y = wr.posY / 16; + this.z = wr.posZ / 16; + this.wr = wr; this.flags = flags; this.quadCount = quadCount; this.pass = pass; @@ -112,7 +114,7 @@ public class ChunkMesh extends Mesh { if(quadCount > 0) { return new ChunkMesh( - (int)(xOffset / 16), (int)(yOffset / 16), (int)(zOffset / 16), + wr, new ChunkMesh.Flags(t.hasTexture, t.hasBrightness, t.hasColor, t.hasNormals), quadCount, quads, pass); } else { diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java index a387f20..bda5c8f 100644 --- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java +++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java @@ -191,7 +191,8 @@ public class NeoRenderer { piFirst[i].limit(MAX_MESHES); piCount[i].limit(MAX_MESHES); for(Mesh mesh : sentMeshes[i]) { - if(shouldRenderMesh(mesh)) { + WorldRenderer wr = ((ChunkMesh)mesh).wr; + if(mesh.visible && wr.isVisible && shouldRenderMesh(mesh)) { int meshes = mesh.writeToIndexBuffer(piFirst[i], piCount[i], eyePosXTDiv, eyePosYTDiv, eyePosZTDiv); renderedMeshes += meshes; for(int j = piCount[i].position() - meshes; j < piCount[i].position(); j++) { @@ -205,7 +206,7 @@ public class NeoRenderer { } private boolean shouldRenderMesh(Mesh mesh) { - if(mesh.visible && (Config.maxMeshesPerFrame == -1 || renderedMeshes < Config.maxMeshesPerFrame)) { + if((Config.maxMeshesPerFrame == -1 || renderedMeshes < Config.maxMeshesPerFrame)) { if((!Config.renderFog && !Config.fogOcclusionWithoutFog) || Config.fogOcclusion == !Config.fogOcclusion || mesh.distSq( |