diff --git a/src/main/java/com/seibel/lod/builders/LodBufferBuilder.java b/src/main/java/com/seibel/lod/builders/LodBufferBuilder.java
index baf7204f0..7484ce7e7 100644
--- a/src/main/java/com/seibel/lod/builders/LodBufferBuilder.java
+++ b/src/main/java/com/seibel/lod/builders/LodBufferBuilder.java
@@ -221,7 +221,7 @@ public class LodBufferBuilder
adjData[1][z] = lodDim.getData(adjPos);
}
LodConfig.CLIENT.lodTemplate.get().template.addLodToBuffer(currentBuffer, playerBlockPos, lodData, adjData,
- posToRender, renderer.debugging);
+ posToRender, renderer.previousDebugMode);
}
} catch (ArrayIndexOutOfBoundsException e)
{
diff --git a/src/main/java/com/seibel/lod/builders/lodTemplates/AbstractLodTemplate.java b/src/main/java/com/seibel/lod/builders/lodTemplates/AbstractLodTemplate.java
index c44036940..5b87de96d 100644
--- a/src/main/java/com/seibel/lod/builders/lodTemplates/AbstractLodTemplate.java
+++ b/src/main/java/com/seibel/lod/builders/lodTemplates/AbstractLodTemplate.java
@@ -17,10 +17,8 @@
*/
package com.seibel.lod.builders.lodTemplates;
-import java.awt.Color;
-
+import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.objects.LevelPos.LevelPos;
-import com.seibel.lod.util.LodUtil;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.util.math.BlockPos;
@@ -35,7 +33,7 @@ import net.minecraft.util.math.BlockPos;
public abstract class AbstractLodTemplate
{
public abstract void addLodToBuffer(BufferBuilder buffer, BlockPos playerBlockPos, short[] data, short[][][] adjData,
- LevelPos levelPos, boolean debugging);
+ LevelPos levelPos, DebugMode debugging);
/**
* add the given position and color to the buffer
diff --git a/src/main/java/com/seibel/lod/builders/lodTemplates/CubicLodTemplate.java b/src/main/java/com/seibel/lod/builders/lodTemplates/CubicLodTemplate.java
index 0eddc9508..a31b10c80 100644
--- a/src/main/java/com/seibel/lod/builders/lodTemplates/CubicLodTemplate.java
+++ b/src/main/java/com/seibel/lod/builders/lodTemplates/CubicLodTemplate.java
@@ -17,6 +17,7 @@
*/
package com.seibel.lod.builders.lodTemplates;
+import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.enums.ShadingMode;
import com.seibel.lod.handlers.LodConfig;
import com.seibel.lod.objects.DataPoint;
@@ -47,7 +48,7 @@ public class CubicLodTemplate extends AbstractLodTemplate
@Override
public void addLodToBuffer(BufferBuilder buffer, BlockPos playerBlockPos, short[] data, short[][][] adjData,
- LevelPos levelPos, boolean debugging)
+ LevelPos levelPos, DebugMode debugging)
{
AxisAlignedBB bbox;
@@ -63,7 +64,7 @@ public class CubicLodTemplate extends AbstractLodTemplate
levelPos.posZ * width);
int color = DataPoint.getColor(data);
- if (LodConfig.CLIENT.debugMode.get())
+ if (debugging != DebugMode.OFF)
{
color = LodUtil.DEBUG_DETAIL_LEVEL_COLORS[levelPos.detailLevel].getRGB();
}
@@ -75,21 +76,6 @@ public class CubicLodTemplate extends AbstractLodTemplate
}
- /*
- * @Override public void addLodToBuffer(BufferBuilder buffer,
- * LodQuadTreeDimension lodDim, LodQuadTreeNode lod, double xOffset, double
- * yOffset, double zOffset, boolean debugging) { AxisAlignedBB bbox;
- *
- * bbox = generateBoundingBox( lod.getLodDataPoint().height,
- * lod.getLodDataPoint().depth, lod.width, xOffset, yOffset, zOffset);
- *
- * Color color = lod.getLodDataPoint().color;
- *
- * if (bbox != null) { addBoundingBoxToBuffer(buffer, bbox, color); }
- *
- * }
- */
-
private AxisAlignedBB generateBoundingBox(int height, int depth, int width, double xOffset, double yOffset, double zOffset)
{
// don't add an LOD if it is empty
@@ -121,25 +107,14 @@ public class CubicLodTemplate extends AbstractLodTemplate
// the side colors are different because
// when using fast lighting in Minecraft the north/south
// and east/west sides are different in a similar way
-/*
- int northSouthDarkenAmount = -25;
- int eastWestDarkenAmount = -50;
- int bottomDarkenAmount = -75;
-
- northSouthColor = ColorUtil.applyShade(c,northSouthDarkenAmount);
- eastWestColor = ColorUtil.applyShade(c,eastWestDarkenAmount);
- bottomColor = ColorUtil.applyShade(c,bottomDarkenAmount);*/
-/*
- float northSouthDarkenAmount = 0.80f;
- float eastWestDarkenAmount = 0.60f;
- float bottomDarkenAmount = 0.40f;*/
/**TODO OPTIMIZE THIS STEP*/
- topColor = ColorUtil.applyShade(c, Minecraft.getInstance().level.getShade(Direction.UP, true));
- bottomColor = ColorUtil.applyShade(c, Minecraft.getInstance().level.getShade(Direction.DOWN, true));
- northColor = ColorUtil.applyShade(c, Minecraft.getInstance().level.getShade(Direction.NORTH, true));
- southColor = ColorUtil.applyShade(c, Minecraft.getInstance().level.getShade(Direction.SOUTH, true));
- westColor = ColorUtil.applyShade(c, Minecraft.getInstance().level.getShade(Direction.WEST, true));
- eastColor = ColorUtil.applyShade(c, Minecraft.getInstance().level.getShade(Direction.EAST, true));
+ Minecraft mc = Minecraft.getInstance();
+ topColor = ColorUtil.applyShade(c, mc.level.getShade(Direction.UP, true));
+ bottomColor = ColorUtil.applyShade(c, mc.level.getShade(Direction.DOWN, true));
+ northColor = ColorUtil.applyShade(c, mc.level.getShade(Direction.NORTH, true));
+ southColor = ColorUtil.applyShade(c, mc.level.getShade(Direction.SOUTH, true));
+ westColor = ColorUtil.applyShade(c, mc.level.getShade(Direction.WEST, true));
+ eastColor = ColorUtil.applyShade(c, mc.level.getShade(Direction.EAST, true));
}
// apply the user specified saturation and brightness
diff --git a/src/main/java/com/seibel/lod/builders/lodTemplates/DynamicLodTemplate.java b/src/main/java/com/seibel/lod/builders/lodTemplates/DynamicLodTemplate.java
index dcaf81f25..0fc789f41 100644
--- a/src/main/java/com/seibel/lod/builders/lodTemplates/DynamicLodTemplate.java
+++ b/src/main/java/com/seibel/lod/builders/lodTemplates/DynamicLodTemplate.java
@@ -17,6 +17,7 @@
*/
package com.seibel.lod.builders.lodTemplates;
+import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.objects.LevelPos.LevelPos;
import net.minecraft.client.renderer.BufferBuilder;
@@ -35,7 +36,7 @@ public class DynamicLodTemplate extends AbstractLodTemplate
{
@Override
public void addLodToBuffer(BufferBuilder buffer, BlockPos playerBlockPos, short[] data, short[][][] adjData,
- LevelPos levelPos, boolean debugging)
+ LevelPos levelPos, DebugMode debugging)
{
System.err.println("DynamicLodTemplate not implemented!");
}
diff --git a/src/main/java/com/seibel/lod/builders/lodTemplates/TriangularLodTemplate.java b/src/main/java/com/seibel/lod/builders/lodTemplates/TriangularLodTemplate.java
index a3cf999ee..99c7b9877 100644
--- a/src/main/java/com/seibel/lod/builders/lodTemplates/TriangularLodTemplate.java
+++ b/src/main/java/com/seibel/lod/builders/lodTemplates/TriangularLodTemplate.java
@@ -17,6 +17,7 @@
*/
package com.seibel.lod.builders.lodTemplates;
+import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.objects.LevelPos.LevelPos;
import net.minecraft.client.renderer.BufferBuilder;
@@ -33,7 +34,7 @@ public class TriangularLodTemplate extends AbstractLodTemplate
{
@Override
public void addLodToBuffer(BufferBuilder buffer, BlockPos playerBlockPos, short[] data, short[][][] adjData,
- LevelPos levelPos, boolean debugging)
+ LevelPos levelPos, DebugMode debugging)
{
System.err.println("DynamicLodTemplate not implemented!");
}
diff --git a/src/main/java/com/seibel/lod/enums/DebugMode.java b/src/main/java/com/seibel/lod/enums/DebugMode.java
new file mode 100644
index 000000000..29f2204ff
--- /dev/null
+++ b/src/main/java/com/seibel/lod/enums/DebugMode.java
@@ -0,0 +1,50 @@
+/*
+ * This file is part of the LOD Mod, licensed under the GNU GPL v3 License.
+ *
+ * Copyright (C) 2020 James Seibel
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package com.seibel.lod.enums;
+
+/**
+ * off, detail, detail wireframe
+ *
+ * @author James Seibel
+ * @version 8-28-2021
+ */
+public enum DebugMode
+{
+ OFF,
+
+ /** LOD colors are based on their detail */
+ SHOW_DETAIL,
+
+ /** LOD colors are based on their detail, and draws in wireframe. */
+ SHOW_DETAIL_WIREFRAME;
+
+ /** used when cycling through the different modes */
+ private DebugMode next;
+ static
+ {
+ OFF.next = SHOW_DETAIL;
+ SHOW_DETAIL.next = SHOW_DETAIL_WIREFRAME;
+ SHOW_DETAIL_WIREFRAME.next = OFF;
+ }
+
+ /** returns the next debug mode */
+ public DebugMode getNext()
+ {
+ return this.next;
+ }
+}
diff --git a/src/main/java/com/seibel/lod/handlers/LodConfig.java b/src/main/java/com/seibel/lod/handlers/LodConfig.java
index 6f5c151f0..d2d2881ce 100644
--- a/src/main/java/com/seibel/lod/handlers/LodConfig.java
+++ b/src/main/java/com/seibel/lod/handlers/LodConfig.java
@@ -26,6 +26,7 @@ import org.apache.logging.log4j.LogManager;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.electronwill.nightconfig.core.io.WritingMode;
import com.seibel.lod.ModInfo;
+import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.enums.DistanceCalculatorType;
import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.enums.FogDistance;
@@ -56,7 +57,7 @@ public class LodConfig
public ForgeConfigSpec.EnumValue fogDrawOverride;
- public ForgeConfigSpec.BooleanValue debugMode;
+ public ForgeConfigSpec.EnumValue debugMode;
public ForgeConfigSpec.EnumValue lodTemplate;
@@ -111,10 +112,11 @@ public class LodConfig
debugMode = builder
.comment("\n\n"
- + " If false the LODs will draw with their normal colors. \n"
- + " If true LODs colors will be based on their detail \n"
- + " level. \n")
- .define("debugMode", false);
+ + " This can be changed using the F4 key. \n"
+ + " " + DebugMode.OFF.toString() + ": LODs will draw with their normal colors. \n"
+ + " " + DebugMode.SHOW_DETAIL.toString() + ": LOD colors will be based on their detail. \n"
+ + " " + DebugMode.SHOW_DETAIL_WIREFRAME.toString() + ": LOD colors will be based on their detail, drawn with wireframe. \n")
+ .defineEnum("debugMode", DebugMode.OFF);
lodTemplate = builder
.comment("\n\n"
diff --git a/src/main/java/com/seibel/lod/proxy/ClientProxy.java b/src/main/java/com/seibel/lod/proxy/ClientProxy.java
index 75441d634..13b127c81 100644
--- a/src/main/java/com/seibel/lod/proxy/ClientProxy.java
+++ b/src/main/java/com/seibel/lod/proxy/ClientProxy.java
@@ -259,7 +259,7 @@ public class ClientProxy
//f4 is key 293, the 1 action mean that the key just got pressed
if(event.getKey() == 293 && event.getAction() == 1)
{
- LodConfig.CLIENT.debugMode.set(!LodConfig.CLIENT.debugMode.get());
+ LodConfig.CLIENT.debugMode.set(LodConfig.CLIENT.debugMode.get().getNext());
}
}
diff --git a/src/main/java/com/seibel/lod/render/LodRenderer.java b/src/main/java/com/seibel/lod/render/LodRenderer.java
index 46d127d67..42e150b0b 100644
--- a/src/main/java/com/seibel/lod/render/LodRenderer.java
+++ b/src/main/java/com/seibel/lod/render/LodRenderer.java
@@ -31,6 +31,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.seibel.lod.builders.LodBufferBuilder;
+import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.enums.FogDistance;
import com.seibel.lod.enums.FogDrawOverride;
import com.seibel.lod.enums.FogQuality;
@@ -98,7 +99,7 @@ public class LodRenderer
* If true the LODs colors will be replaced with
* a checkerboard, this can be used for debugging.
*/
- public boolean debugging = false;
+ public DebugMode previousDebugMode = DebugMode.OFF;
private Minecraft mc;
private GameRenderer gameRender;
@@ -216,9 +217,9 @@ public class LodRenderer
}
// did the user change the debug setting?
- if (LodConfig.CLIENT.debugMode.get() != debugging)
+ if (LodConfig.CLIENT.debugMode.get() != previousDebugMode)
{
- debugging = LodConfig.CLIENT.debugMode.get();
+ previousDebugMode = LodConfig.CLIENT.debugMode.get();
regen = true;
}
@@ -275,19 +276,15 @@ public class LodRenderer
//===========================//
// set the required open GL settings
- if(LodConfig.CLIENT.debugMode.get()){
- GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
- }else{
- GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
- }
- //GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
- //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+
+ if (LodConfig.CLIENT.debugMode.get() == DebugMode.SHOW_DETAIL_WIREFRAME)
+ GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
+ else
+ GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glEnable(GL11.GL_DEPTH_TEST);
- //GL11.glEnable(GL11.GL_BLEND);
- //GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// disable the lights Minecraft uses
GL11.glDisable(GL11.GL_LIGHT0);