aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer/NeoRenderer.java')
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index 1a58d9c..b6031a5 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -188,7 +188,7 @@ public class NeoRenderer {
piFirst[i].limit(MAX_MESHES);
piCount[i].limit(MAX_MESHES);
for(Mesh mesh : sentMeshes[i]) {
- if(mesh.visible && (Config.maxMeshesPerFrame == -1 || renderedMeshes < Config.maxMeshesPerFrame)) {
+ if(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++) {
@@ -201,6 +201,15 @@ public class NeoRenderer {
}
}
+ private boolean shouldRenderMesh(Mesh mesh) {
+ if(mesh.visible && (Config.maxMeshesPerFrame == -1 || renderedMeshes < Config.maxMeshesPerFrame)) {
+ if(!Config.renderFog || !Config.fogOcclusion || mesh.distSq(eyePosX / 16.0, mesh.y + 0.5, eyePosZ / 16.0) < Math.pow((fogStartEnd.get(1)) / 16.0 + 1.0, 2)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private void mainLoop() {
if(Minecraft.getMinecraft().playerController.netClientHandler.doneLoadingTerrain) {
for(Iterator<Entry<ChunkCoordIntPair, NeoRegion>> it = loadedRegionsMap.entrySet().iterator(); it.hasNext();) {
@@ -300,13 +309,9 @@ public class NeoRenderer {
glGetFloat(GL_FOG_COLOR, fogColorBuf);
fogColorBuf.limit(4);
- if(Config.renderFog) {
- fogStartEnd.put(glGetFloat(GL_FOG_START));
- fogStartEnd.put(glGetFloat(GL_FOG_END));
- } else {
- fogStartEnd.put(-1);
- fogStartEnd.put(-1);
- }
+ fogStartEnd.put(glGetFloat(GL_FOG_START));
+ fogStartEnd.put(glGetFloat(GL_FOG_END));
+
fogStartEnd.flip();
}