aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-07-11 16:33:22 +0200
committermakamys <makamys@outlook.com>2022-07-11 17:27:32 +0200
commitf26762ca0c6b7c1977f71ae24b3b011a658d7e53 (patch)
treedee10950c5483e7e1b2d3c71e3dc970a5ff5fa1e /src
parenteff3af0abb03bd4d586e72d5644b4a4bc175a29f (diff)
downloadNeodymium-f26762ca0c6b7c1977f71ae24b3b011a658d7e53.tar.gz
Neodymium-f26762ca0c6b7c1977f71ae24b3b011a658d7e53.tar.bz2
Neodymium-f26762ca0c6b7c1977f71ae24b3b011a658d7e53.zip
Respect isVisible field of world renderers
Adds compatibility with ArchaicFix's occlusion tweak, and reduces performance penalty of Advanced OpenGL.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/makamys/neodymium/renderer/ChunkMesh.java12
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java5
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(