aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-04 14:06:29 +0200
committermakamys <makamys@outlook.com>2022-06-04 14:08:12 +0200
commitc0a5188942b3431bab82e15b9c31d47abb90b1ac (patch)
tree59f5d2c549c1468c0f7340a6f8e6abcf9eb17eb4 /src/main
parent592aaa64ddf8416b94c4098c614b6cfbb7a81481 (diff)
downloadNeodymium-c0a5188942b3431bab82e15b9c31d47abb90b1ac.tar.gz
Neodymium-c0a5188942b3431bab82e15b9c31d47abb90b1ac.tar.bz2
Neodymium-c0a5188942b3431bab82e15b9c31d47abb90b1ac.zip
Add options to disable serialization and change sort frequency
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/makamys/lodmod/LODMod.java4
-rw-r--r--src/main/java/makamys/lodmod/renderer/LODRegion.java4
-rw-r--r--src/main/java/makamys/lodmod/renderer/LODRenderer.java6
3 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java
index e573138..70b8507 100644
--- a/src/main/java/makamys/lodmod/LODMod.java
+++ b/src/main/java/makamys/lodmod/LODMod.java
@@ -59,8 +59,10 @@ public class LODMod
public static boolean hideUnderVanillaChunks;
public static boolean disableChunkMeshes;
public static boolean disableSimpleMeshes;
+ public static boolean saveMeshes;
public static boolean optimizeChunkMeshes;
public static int maxMeshesPerFrame;
+ public static int sortFrequency;
private File configFile;
@@ -104,7 +106,9 @@ public class LODMod
disableChunkMeshes = config.getBoolean("disableChunkMeshes", "render", true, "");
disableSimpleMeshes = config.getBoolean("disableSimpleMeshes", "render", false, "");
optimizeChunkMeshes = config.getBoolean("optimizeChunkMeshes", "render", true, "");
+ saveMeshes = config.getBoolean("saveMeshes", "render", false, "");
maxMeshesPerFrame = config.getInt("maxMeshesPerFrame", "render", -1, -1, Integer.MAX_VALUE, "");
+ sortFrequency = config.getInt("sortFrequency", "render", 1, 1, Integer.MAX_VALUE, "");
if(config.hasChanged()) {
config.save();
diff --git a/src/main/java/makamys/lodmod/renderer/LODRegion.java b/src/main/java/makamys/lodmod/renderer/LODRegion.java
index 4004adf..ed13980 100644
--- a/src/main/java/makamys/lodmod/renderer/LODRegion.java
+++ b/src/main/java/makamys/lodmod/renderer/LODRegion.java
@@ -58,7 +58,7 @@ public class LODRegion {
}
public static LODRegion load(Path saveDir, int regionX, int regionZ) {
- if(!LODMod.disableChunkMeshes) {
+ if(!LODMod.disableChunkMeshes && LODMod.saveMeshes) {
File saveFile = getSavePath(saveDir, regionX, regionZ).toFile();
if(saveFile.exists()) {
try {
@@ -77,7 +77,7 @@ public class LODRegion {
}
public void save(Path saveDir) {
- if(LODMod.disableChunkMeshes) return;
+ if(LODMod.disableChunkMeshes && LODMod.saveMeshes) return;
try {
File saveFile = getSavePath(saveDir, regionX, regionZ).toFile();
diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
index d7504d7..ff86a76 100644
--- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java
+++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
@@ -92,6 +92,7 @@ public class LODRenderer {
private long saveInterval = 60 * 1000;
private int renderedMeshes;
+ private int frameCount;
public int renderRange = 48;
@@ -134,7 +135,10 @@ public class LODRenderer {
}
if(renderLOD) {
- sort();
+ if(frameCount % LODMod.sortFrequency == 0) {
+ sort();
+ }
+
updateMeshes();
initIndexBuffers();
render(alpha);