diff options
author | makamys <makamys@outlook.com> | 2021-05-08 23:27:38 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2021-05-08 23:27:38 +0200 |
commit | 585cfa0b7b6d600689ffb1af3c6247c7f7b9300b (patch) | |
tree | e6fce154fbfb525fc4607577da583d0225ad3cb9 /src/main/java/makamys | |
parent | aa4d8716468bd6ce2744bb071bcc2b1da347bc12 (diff) | |
download | Neodymium-585cfa0b7b6d600689ffb1af3c6247c7f7b9300b.tar.gz Neodymium-585cfa0b7b6d600689ffb1af3c6247c7f7b9300b.tar.bz2 Neodymium-585cfa0b7b6d600689ffb1af3c6247c7f7b9300b.zip |
Make render distance not hardcoded
Diffstat (limited to 'src/main/java/makamys')
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODChunk.java | 4 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODRenderer.java | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/makamys/lodmod/renderer/LODChunk.java b/src/main/java/makamys/lodmod/renderer/LODChunk.java index 63b43e7..ae86103 100644 --- a/src/main/java/makamys/lodmod/renderer/LODChunk.java +++ b/src/main/java/makamys/lodmod/renderer/LODChunk.java @@ -84,9 +84,9 @@ public class LODChunk { public void tick(Entity player) { double distSq = distSq(player); - if(distSq < Math.pow(32 * 16, 2)) { + if(distSq < Math.pow((LODMod.renderer.renderRange / 2) * 16, 2)) { renderer.setLOD(this, 2); - } else if(distSq < Math.pow(64 * 16, 2)) { + } else if(distSq < Math.pow((LODMod.renderer.renderRange) * 16, 2)) { renderer.setLOD(this, 1); } else { renderer.setLOD(this, 0); diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index 5454352..4e9c97d 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -77,6 +77,8 @@ public class LODRenderer { private long lastGCTime = -1; private long gcInterval = 60 * 1000; + public int renderRange = 48; + public LODRenderer(){ hasInited = init(); } @@ -113,9 +115,8 @@ public class LODRenderer { int centerX = (int)Math.floor(player.posX / 16.0); int centerZ = (int)Math.floor(player.posZ / 16.0); - int range = 64; - for(int x = -range; x <= range; x++) { - for(int z = -range; z <= range; z++) { + for(int x = -renderRange; x <= renderRange; x++) { + for(int z = -renderRange; z <= renderRange; z++) { int chunkX = centerX + x; int chunkZ = centerZ + z; @@ -145,7 +146,7 @@ public class LODRenderer { } public int getFarPlaneDistanceMultiplier() { - return 4; + return renderRange / 12; } private void handleKeyboard() { |