Allow selecting specific IDebugRenderable's for rendering

This commit is contained in:
s809
2023-09-19 21:32:59 +05:00
parent a80bb082b3
commit 08704aad2c
9 changed files with 57 additions and 14 deletions
@@ -46,6 +46,6 @@ public class DhApiDebuggingConfig implements IDhApiDebuggingConfig
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.Advanced.Debugging.lodOnlyMode); }
public IDhApiConfigValue<Boolean> debugWireframeRendering()
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.Advanced.Debugging.debugWireframeRendering); }
{ return new DhApiConfigValue<Boolean, Boolean>(Config.Client.Advanced.Debugging.DebugWireframeRendering.enableRendering); }
}
@@ -1083,6 +1083,8 @@ public class Config
public static class Debugging
{
public static ConfigCategory debugWireframeRendering = new ConfigCategory.Builder().set(DebugWireframeRendering.class).build();
public static ConfigEntry<ERendererMode> rendererMode = new ConfigEntry.Builder<ERendererMode>()
.set(ERendererMode.DEFAULT)
.comment(""
@@ -1131,15 +1133,43 @@ public class Config
+ " 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();
public static class DebugWireframeRendering
{
public static ConfigEntry<Boolean> enableRendering = 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();
public static ConfigEntry<Boolean> fullDataMetaFile = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment("Class: FullDataMetaFile")
.build();
public static ConfigEntry<Boolean> lodRenderSection = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment("Class: LodRenderSection")
.build();
public static ConfigEntry<Boolean> renderDataMetaFile = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment("Class: RenderDataMetaFile")
.build();
public static ConfigEntry<Boolean> worldGenerationQueue = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment("Class: WorldGenerationQueue")
.build();
public static ConfigEntry<Boolean> worldRemoteGenerationQueue = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment("Class: WorldRemoteGenerationQueue")
.build();
}
public static ConfigEntry<Boolean> enableWhiteWorld = new ConfigEntry.Builder<Boolean>()
.set(false)
@@ -431,6 +431,8 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile implements I
@Override
public void debugRender(DebugRenderer debugRenderer)
{
if (!Config.Client.Advanced.Debugging.DebugWireframeRendering.fullDataMetaFile.get()) return;
if (this.pos.getDetailLevel() > DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL)
{
return;
@@ -438,6 +438,8 @@ public class RenderDataMetaFile extends AbstractMetaDataContainerFile implements
@Override
public void debugRender(DebugRenderer debugRenderer)
{
if (!Config.Client.Advanced.Debugging.DebugWireframeRendering.renderDataMetaFile.get()) return;
Color color = Color.black;
ColumnRenderSource cached = this.cachedRenderDataSource.get();
@@ -722,6 +722,8 @@ public class WorldGenerationQueue implements IWorldGenerationQueue, IDebugRender
@Override
public void debugRender(DebugRenderer r)
{
if (!Config.Client.Advanced.Debugging.DebugWireframeRendering.worldGenerationQueue.get()) return;
//if (true) return;
waitingTasks.keySet().forEach((pos) -> {
//DhLodPos pos = t.pos;
@@ -1,5 +1,6 @@
package com.seibel.distanthorizons.core.generation;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor;
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.CompleteFullDataSource;
import com.seibel.distanthorizons.core.generation.tasks.IWorldGenTaskTracker;
@@ -257,7 +258,10 @@ public class WorldRemoteGenerationQueue implements IWorldGenerationQueue, IDebug
}
@Override
public void debugRender(DebugRenderer r) {
public void debugRender(DebugRenderer r)
{
if (!Config.Client.Advanced.Debugging.DebugWireframeRendering.worldRemoteGenerationQueue.get()) return;
for (Map.Entry<DhSectionPos, WorldGenQueueEntry> mapEntry : waitingTasks.entrySet())
{
r.renderBox(new DebugRenderer.Box(mapEntry.getKey(), -32f, 64f, 0.05f,
@@ -19,6 +19,7 @@
package com.seibel.distanthorizons.core.render;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dataObjects.render.ColumnRenderSource;
import com.seibel.distanthorizons.core.dataObjects.render.bufferBuilding.ColumnRenderBufferBuilder;
import com.seibel.distanthorizons.core.enums.EDhDirection;
@@ -99,6 +100,8 @@ public class LodRenderSection implements IDebugRenderable
public void debugRender(DebugRenderer debugRenderer)
{
if (!Config.Client.Advanced.Debugging.DebugWireframeRendering.lodRenderSection.get()) return;
Color color = Color.red;
if (this.renderSourceProvider == null) color = Color.black;
@@ -258,7 +258,7 @@ public class DebugRenderer
public static void makeParticle(BoxParticle particle)
{
if (INSTANCE == null) return;
if (!Config.Client.Advanced.Debugging.debugWireframeRendering.get()) return;
if (!Config.Client.Advanced.Debugging.DebugWireframeRendering.enableRendering.get()) return;
INSTANCE.particles.add(particle);
}
@@ -321,7 +321,7 @@ public class DebugRenderer
public void addRenderer(IDebugRenderable r)
{
if (!Config.Client.Advanced.Debugging.debugWireframeRendering.get()) return;
if (!Config.Client.Advanced.Debugging.DebugWireframeRendering.enableRendering.get()) return;
synchronized (renderers)
{
renderers.add(new WeakReference<>(r));
@@ -350,7 +350,7 @@ public class LodRenderer
this.shaderProgram.unbind();
if (Config.Client.Advanced.Debugging.debugWireframeRendering.get())
if (Config.Client.Advanced.Debugging.DebugWireframeRendering.enableRendering.get())
{
profiler.popPush("Debug wireframes");
// Note: this can be very slow if a lot of boxes are being rendered