Add debug wireframe renderer config for toggling the debug renderer

This commit is contained in:
TomTheFurry
2023-06-09 18:41:11 +08:00
parent 46432e772c
commit a003ecf378
2 changed files with 14 additions and 1 deletions
@@ -978,7 +978,16 @@ public class Config
+ " This setting is only for fun and debugging. \n"
+ " Mod compatibility is not guaranteed.")
.build();
public static ConfigEntry<Boolean> debugWireframeRendering = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment(""
+ "If enabled, various wireframes for debugging internal functions will be drawn. \n"
+ "\n"
+ "NOTE: There WILL be performance hit! \n"
+ " Additionally, only stuff that's loaded after you enable this \n"
+ " will render their debug wireframes.")
.build();
// can be set to public to show in the config file and UI
@@ -2,6 +2,7 @@ package com.seibel.lod.core.render.renderer;
import com.seibel.lod.api.enums.config.EGpuUploadMethod;
import com.seibel.lod.api.enums.config.ELoggerMode;
import com.seibel.lod.core.config.Config;
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
import com.seibel.lod.core.logging.ConfigBasedLogger;
import com.seibel.lod.core.logging.ConfigBasedSpamLogger;
@@ -112,6 +113,7 @@ public class DebugRenderer {
private final Map<Object, IDebugRender> renderers = Collections.synchronizedMap(new WeakHashMap<>());
public void addRenderer(Object o, IDebugRender r) {
if (!Config.Client.Advanced.Debugging.debugWireframeRendering.get()) return;
renderers.put(o, r);
}
@@ -142,6 +144,8 @@ public class DebugRenderer {
}
public void render(Mat4f transform) {
if (!Config.Client.Advanced.Debugging.debugWireframeRendering.get()) return;
transform_this_frame = transform;
Vec3d cam = MC_RENDER.getCameraExactPosition();
camf = new Vec3f((float)cam.x, (float)cam.y, (float)cam.z);