Add position finder debug config

This commit is contained in:
James Seibel
2026-04-29 07:35:16 -05:00
parent ec72762067
commit 3ef8bd7e20
6 changed files with 90 additions and 26 deletions
@@ -63,6 +63,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
import java.awt.*;
import java.io.File;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
@@ -160,7 +161,7 @@ public class ClientApi
//==============//
// world events //
//==============//
//region
//region world events
/**
* May be fired slightly before or after the associated
@@ -245,7 +246,7 @@ public class ClientApi
//==============//
// level events //
//==============//
//region
//region level events
public void clientLevelUnloadEvent(IClientLevelWrapper level)
{
@@ -364,7 +365,7 @@ public class ClientApi
//============//
// networking //
//============//
//region
//region networking
/**
* Forwards a decoded message into the registered handlers.
@@ -404,7 +405,7 @@ public class ClientApi
//===============//
// LOD rendering //
//===============//
//region
//region lod rendering
/** Should be called before {@link ClientApi#renderDeferredLodsForShaders} */
public void renderLods() { this.renderLodLayer(false); }
@@ -428,12 +429,16 @@ public class ClientApi
//===========//
//region
//DhApiTerrainDataRepo.asyncDebugMethod(
// RENDER_STATE.clientLevelWrapper,
// MC_CLIENT.getPlayerBlockPos().getX(),
// MC_CLIENT.getPlayerBlockPos().getY(),
// MC_CLIENT.getPlayerBlockPos().getZ()
//);
// only run these tasks once per frame
if (!renderingDeferredLayer)
{
//DhApiTerrainDataRepo.asyncDebugMethod(
// RENDER_STATE.clientLevelWrapper,
// MC_CLIENT.getPlayerBlockPos().getX(),
// MC_CLIENT.getPlayerBlockPos().getY(),
// MC_CLIENT.getPlayerBlockPos().getZ()
//);
}
//endregion
@@ -667,7 +672,7 @@ public class ClientApi
//================//
// fade rendering //
//================//
//region
//region fade rendering
/**
* The first fade pass.
@@ -737,7 +742,7 @@ public class ClientApi
//==========//
// keyboard //
//==========//
//region
//region keyboard
/** Trigger once on key press, with CLIENT PLAYER. */
public void keyPressedEvent(int glfwKey)
@@ -773,7 +778,7 @@ public class ClientApi
//======//
// chat //
//======//
//region
//region chat
private void sendQueuedChatMessages()
{
@@ -964,6 +964,7 @@ public class Config
public static ConfigCategory debugWireframe = new ConfigCategory.Builder().set(DebugWireframe.class).build();
public static ConfigCategory openGl = new ConfigCategory.Builder().set(OpenGl.class).build();
public static ConfigCategory columnBuilderDebugging = new ConfigCategory.Builder().set(ColumnBuilderDebugging.class).build();
public static ConfigCategory positionFinderDebugging = new ConfigCategory.Builder().set(PositionFinder.class).build();
public static ConfigCategory f3Screen = new ConfigCategory.Builder().set(F3Screen.class).build();
public static ConfigCategory exampleConfigScreen = new ConfigCategory.Builder().set(ExampleConfigScreen.class).build();
@@ -1095,6 +1096,36 @@ public class Config
}
public static class PositionFinder
{
//public static ConfigUIComment positionFinderHeader = new ConfigUIComment.Builder().setParentConfigClass(ColumnBuilderDebugging.class).build();
public static ConfigEntry<Boolean> positionFinderEnable = new ConfigEntry.Builder<Boolean>()
.set(false)
.build();
public static ConfigEntry<Integer> positionFinderDetailLevel = new ConfigEntry.Builder<Integer>()
.set((int) DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL)
.build();
public static ConfigEntry<Integer> positionFinderXPos = new ConfigEntry.Builder<Integer>()
.set(0)
.build();
public static ConfigEntry<Integer> positionFinderZPos = new ConfigEntry.Builder<Integer>()
.set(0)
.build();
public static ConfigEntry<Integer> positionFinderMinBlockY = new ConfigEntry.Builder<Integer>()
.set(-64)
.build();
public static ConfigEntry<Integer> positionFinderMaxBlockY = new ConfigEntry.Builder<Integer>()
.set(125)
.build();
public static ConfigEntry<Float> positionFinderMarginPercent = new ConfigEntry.Builder<Float>()
.set(0.0f)
.build();
}
public static class F3Screen
{
public static ConfigUIComment f3ScreenHeader = new ConfigUIComment.Builder().setParentConfigClass(F3Screen.class).build();
@@ -61,7 +61,7 @@ public class LodQuadBuilder
public static final int BYTES_PER_QUAD = BYTES_PER_VERTEX * 4;
public static final int[][][] DIRECTION_VERTEX_IBO_QUAD = new int[][][]
///region
//region
{
// X,Z //
{ // UP
@@ -109,7 +109,7 @@ public class LodQuadBuilder
{0, 0}, // 3
},
};
///endregion
//endregion
private int premergeCount = 0;
@@ -1202,17 +1202,6 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
{
this.populateListWithEnabledRenderSections(this.debugNodeList);
//// can be uncommented for debugging/finding a specific position
//debugRenderer.makeParticle(
// new AbstractDebugWireframeRenderer.BoxParticle(
// new AbstractDebugWireframeRenderer.Box(
// DhSectionPos.encode((byte)7, 3,-1)
// , -64, 400,
// 0.1f,
// Color.YELLOW),
// 0.5, 0f
// ));
for (int i = 0; i < this.debugNodeList.size(); i++)
{
LodRenderSection renderSection = this.debugNodeList.get(i);
@@ -26,6 +26,7 @@ import com.seibel.distanthorizons.core.dependencyInjection.ModAccessorInjector;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.logging.DhLogger;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.pos.DhSectionPos;
import com.seibel.distanthorizons.core.render.DhApiRenderProxy;
import com.seibel.distanthorizons.core.render.RenderBufferHandler;
import com.seibel.distanthorizons.core.render.RenderParams;
@@ -36,6 +37,8 @@ import com.seibel.distanthorizons.core.wrapperInterfaces.modAccessor.IIrisAccess
import com.seibel.distanthorizons.core.wrapperInterfaces.render.renderPass.*;
import com.seibel.distanthorizons.coreapi.DependencyInjection.ApiEventInjector;
import java.awt.*;
/**
* This is where all the magic happens. <br>
* This is where LODs are draw to the world.
@@ -288,6 +291,22 @@ public class LodRenderer
}
if (Config.Client.Advanced.Debugging.PositionFinder.positionFinderEnable.get())
{
// can be used to find specific positions when debugging
this.debugWireframeRenderer.renderBox(new AbstractDebugWireframeRenderer.Box(
DhSectionPos.encode(
Config.Client.Advanced.Debugging.PositionFinder.positionFinderDetailLevel.get().byteValue(),
Config.Client.Advanced.Debugging.PositionFinder.positionFinderXPos.get(),
Config.Client.Advanced.Debugging.PositionFinder.positionFinderZPos.get()),
Config.Client.Advanced.Debugging.PositionFinder.positionFinderMinBlockY.get(),
Config.Client.Advanced.Debugging.PositionFinder.positionFinderMaxBlockY.get(),
Config.Client.Advanced.Debugging.PositionFinder.positionFinderMarginPercent.get(),
Color.GREEN
));
}
//=============================//
// Apply to the MC Framebuffer //
@@ -533,6 +533,26 @@
"distanthorizons.config.client.advanced.debugging.positionFinderDebugging":
"Position Finder",
"distanthorizons.config.client.advanced.debugging.positionFinderDebugging.positionFinderEnable":
"Enable Position Finder",
"distanthorizons.config.client.advanced.debugging.positionFinderDebugging.positionFinderDetailLevel":
"Absolute Detail Level",
"distanthorizons.config.client.advanced.debugging.positionFinderDebugging.positionFinderXPos":
"Pos X",
"distanthorizons.config.client.advanced.debugging.positionFinderDebugging.positionFinderZPos":
"Pos Z",
"distanthorizons.config.client.advanced.debugging.positionFinderDebugging.positionFinderMinBlockY":
"Min Block Y",
"distanthorizons.config.client.advanced.debugging.positionFinderDebugging.positionFinderMaxBlockY":
"Max Block Y",
"distanthorizons.config.client.advanced.debugging.positionFinderDebugging.positionFinderMarginPercent":
"Margin %",
"distanthorizons.config.client.advanced.debugging.f3Screen":
"F3 Screen",