aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2023-11-24 05:02:20 +0100
committermakamys <makamys@outlook.com>2023-11-24 07:36:15 +0100
commitad3e310f2aa1a75b066d0959e943ea5e1c60a49e (patch)
tree7f09645695683801706ca34e82890a9eddeeeda6 /src/main/java
parent76261b9eed25cf9719fecba7fbad4281b9ce6567 (diff)
downloadNeodymium-ad3e310f2aa1a75b066d0959e943ea5e1c60a49e.tar.gz
Neodymium-ad3e310f2aa1a75b066d0959e943ea5e1c60a49e.tar.bz2
Neodymium-ad3e310f2aa1a75b066d0959e943ea5e1c60a49e.zip
Only check if fog is enabled once per frame
GL calls were being made every time `shouldRenderMesh` was called, oops. This could cause worse performance with Nd than without it if `renderFog` is set to `auto` (added in 0.1.5)
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index 7dd94bf..b3564ff 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -61,6 +61,8 @@ public class NeoRenderer {
public boolean forceRenderFog;
public boolean hasIncompatibilities;
+ private boolean fogEnabled;
+
private static int MAX_MESHES;
private int VAO;
@@ -334,6 +336,8 @@ public class NeoRenderer {
fogStartEnd.put(glGetFloat(GL_FOG_END));
fogStartEnd.flip();
+
+ fogEnabled = GL11.glIsEnabled(GL11.GL_FOG) && !OFUtil.isFogOff();
}
private void updateUniforms(double alpha, int pass) {
@@ -623,14 +627,14 @@ public class NeoRenderer {
return ((forceRenderFog || isFogEnabled()) ? shaderProgramsFog : shaderProgramsNoFog)[pass];
}
- private static boolean isFogEnabled() {
+ private boolean isFogEnabled() {
switch(Config.renderFog) {
case TRUE:
return true;
case FALSE:
return false;
default:
- return GL11.glIsEnabled(GL11.GL_FOG) && !OFUtil.isFogOff();
+ return fogEnabled;
}
}