aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-07-17 05:06:33 +0200
committermakamys <makamys@outlook.com>2022-07-17 05:07:09 +0200
commit3ae475be9b76e63f1be14c7a139494cf9a13a277 (patch)
treeb0bf78bedb8a494d31b5db289122aff645e8e8d4 /src/main/java/makamys/neodymium
parentde3e4f656cfef82e3df41d918e71802e5a7c8941 (diff)
downloadNeodymium-3ae475be9b76e63f1be14c7a139494cf9a13a277.tar.gz
Neodymium-3ae475be9b76e63f1be14c7a139494cf9a13a277.tar.bz2
Neodymium-3ae475be9b76e63f1be14c7a139494cf9a13a277.zip
Scale mesh index arrays by amount of allocated VRAM
Diffstat (limited to 'src/main/java/makamys/neodymium')
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index 3762dea..e70a12c 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -58,7 +58,7 @@ public class NeoRenderer {
public boolean forceRenderFog;
public boolean hasIncompatibilities;
- private static int MAX_MESHES = 100000;
+ private static int MAX_MESHES;
private int VAO;
private int[] shaderProgramsFog = {0, 0};
@@ -364,6 +364,10 @@ public class NeoRenderer {
}
public boolean init() {
+ // The average mesh is 60 KB. Let's be safe and assume 8 KB per mesh.
+ // This means 1 MB of index data per 512 MB of VRAM.
+ MAX_MESHES = Config.VRAMSize * 128;
+
reloadShader();
VAO = glGenVertexArrays();