aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2023-12-02 23:39:05 +0100
committermakamys <makamys@outlook.com>2023-12-03 00:48:50 +0100
commit78aef66f5e122d7fca9cc6057180147fde7993e5 (patch)
tree76ad2014035cb2120b54ba7c31c42781f006511e /src
parent2f4979260b60f90ef0fce1b9305b74bcd9fb8af5 (diff)
downloadNeodymium-78aef66f5e122d7fca9cc6057180147fde7993e5.tar.gz
Neodymium-78aef66f5e122d7fca9cc6057180147fde7993e5.tar.bz2
Neodymium-78aef66f5e122d7fca9cc6057180147fde7993e5.zip
Fix NeoRegions not getting deallocated
Diffstat (limited to 'src')
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoChunk.java7
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRegion.java2
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoChunk.java b/src/main/java/makamys/neodymium/renderer/NeoChunk.java
index 92b5c86..de4746c 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoChunk.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoChunk.java
@@ -43,11 +43,14 @@ public class NeoChunk {
if(chunkMeshes[cy * 2 + i] != null) {
renderer.removeMesh(chunkMeshes[cy * 2 + i]);
chunkMeshes[cy * 2 + i].destroy();
- } else {
+ region.meshes--;
+ dirty = true;
+ }
+ if(newChunkMesh != null){
region.meshes++;
+ dirty = true;
}
chunkMeshes[cy * 2 + i] = newChunkMesh;
- dirty = true;
}
}
if(dirty) {
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRegion.java b/src/main/java/makamys/neodymium/renderer/NeoRegion.java
index 7e85138..ea3347a 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRegion.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRegion.java
@@ -95,7 +95,7 @@ public class NeoRegion {
@Override
public String toString() {
- return "LODRegion(" + regionX + ", " + regionZ + ")";
+ return "NeoRegion(" + regionX + ", " + regionZ + ")[n=" + meshes + "]";
}
public boolean shouldDelete() {