From a003ecf378c41a77209f63aee89ea964a0d52a0f Mon Sep 17 00:00:00 2001 From: TomTheFurry Date: Fri, 9 Jun 2023 18:41:11 +0800 Subject: [PATCH] Add debug wireframe renderer config for toggling the debug renderer --- .../main/java/com/seibel/lod/core/config/Config.java | 11 ++++++++++- .../lod/core/render/renderer/DebugRenderer.java | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/seibel/lod/core/config/Config.java b/core/src/main/java/com/seibel/lod/core/config/Config.java index 8ae2b1ccc..688fb9fb6 100644 --- a/core/src/main/java/com/seibel/lod/core/config/Config.java +++ b/core/src/main/java/com/seibel/lod/core/config/Config.java @@ -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 debugWireframeRendering = new ConfigEntry.Builder() + .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 diff --git a/core/src/main/java/com/seibel/lod/core/render/renderer/DebugRenderer.java b/core/src/main/java/com/seibel/lod/core/render/renderer/DebugRenderer.java index 82a4ddaea..370619796 100644 --- a/core/src/main/java/com/seibel/lod/core/render/renderer/DebugRenderer.java +++ b/core/src/main/java/com/seibel/lod/core/render/renderer/DebugRenderer.java @@ -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 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);