aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoChunk.java14
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRegion.java12
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java4
3 files changed, 28 insertions, 2 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoChunk.java b/src/main/java/makamys/neodymium/renderer/NeoChunk.java
index 4dd692e..2adc7ef 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoChunk.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoChunk.java
@@ -185,4 +185,18 @@ public class NeoChunk {
return true;
}
+ public boolean isEmpty() {
+ for(SimpleChunkMesh scm: simpleMeshes) {
+ if(scm != null) {
+ return false;
+ }
+ }
+ for(CullableMeshCollection cm: chunkMeshes) {
+ if(cm != null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
}
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRegion.java b/src/main/java/makamys/neodymium/renderer/NeoRegion.java
index 841bf55..78bf9e7 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRegion.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRegion.java
@@ -174,5 +174,17 @@ public class NeoRegion {
public String toString() {
return "LODRegion(" + regionX + ", " + regionZ + ")";
}
+
+ public boolean isEmpty() {
+ for(int i = 0; i < 32; i++) {
+ for(int j = 0; j < 32; j++) {
+ NeoChunk chunk = data[i][j];
+ if(chunk != null && !chunk.isEmpty()) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
}
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index d55119f..92efffc 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -103,7 +103,7 @@ public class NeoRenderer {
private int renderedMeshes, renderedQuads;
private int frameCount;
- public int renderRange = 48;
+ public int renderRange = 48; // unused LOD thing..
private boolean freezeMeshes;
@@ -266,7 +266,7 @@ public class NeoRenderer {
ChunkCoordIntPair k = it.next();
NeoRegion v = loadedRegionsMap.get(k);
- if(v.distanceTaxicab(player) > renderRange * 16 + 16 * 16) {
+ if(v.isEmpty()) {
System.out.println("unloading " + v);
v.destroy(getSaveDir());
it.remove();