diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODChunk.java | 14 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/LODRegion.java | 2 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java | 5 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/makamys/lodmod/renderer/LODChunk.java b/src/main/java/makamys/lodmod/renderer/LODChunk.java index 5ee5f35..c9bdd5e 100644 --- a/src/main/java/makamys/lodmod/renderer/LODChunk.java +++ b/src/main/java/makamys/lodmod/renderer/LODChunk.java @@ -113,4 +113,18 @@ public class LODChunk { return nbt; } + public void destroy() { + for(SimpleChunkMesh scm: simpleMeshes) { + if(scm != null) { + scm.destroy(); + } + } + for(ChunkMesh cm: chunkMeshes) { + if(cm != null) { + cm.destroy(); + } + } + LODMod.renderer.setVisible(this, false); + } + } diff --git a/src/main/java/makamys/lodmod/renderer/LODRegion.java b/src/main/java/makamys/lodmod/renderer/LODRegion.java index a99c24a..df79ede 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRegion.java +++ b/src/main/java/makamys/lodmod/renderer/LODRegion.java @@ -144,7 +144,7 @@ public class LODRegion { for(int j = 0; j < 32; j++) { LODChunk chunk = data[i][j]; if(chunk != null) { - LODMod.renderer.setVisible(chunk, false); + chunk.destroy(); } } } diff --git a/src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java b/src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java index 01291d5..581ee4a 100644 --- a/src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java +++ b/src/main/java/makamys/lodmod/renderer/SimpleChunkMesh.java @@ -180,4 +180,9 @@ public class SimpleChunkMesh extends Mesh { return (3 * 4 + 8 + 4 + 4); } + public void destroy() { + usedRAM -= buffer.limit(); + instances--; + } + } |