Add DebugMode: DRAW_WIREFRAME

This commit is contained in:
tom lee
2022-02-06 22:07:37 +08:00
parent bb8df761bb
commit a73da4102a
7 changed files with 21 additions and 7 deletions
@@ -52,7 +52,7 @@ public class CubicLodTemplate
int blockWidth = 1 << detailLevel;
int color;
if (debugging != DebugMode.OFF)
if (debugging != DebugMode.OFF && debugging != DebugMode.SHOW_WIREFRAME)
{
if (debugging == DebugMode.SHOW_DETAIL || debugging == DebugMode.SHOW_DETAIL_WIREFRAME)
color = LodUtil.DEBUG_DETAIL_LEVEL_COLORS[detailLevel].getRGB();
@@ -29,6 +29,9 @@ public enum DebugMode
{
/** LODs are rendered normally */
OFF,
/** LOD draws in wireframe. */
SHOW_WIREFRAME,
/** LOD colors are based on their detail */
SHOW_DETAIL,
@@ -47,7 +50,8 @@ public enum DebugMode
static
{
OFF.next = SHOW_DETAIL;
OFF.next = SHOW_WIREFRAME;
SHOW_WIREFRAME.next = SHOW_DETAIL;
SHOW_DETAIL.next = SHOW_DETAIL_WIREFRAME;
SHOW_DETAIL_WIREFRAME.next = SHOW_GENMODE;
SHOW_GENMODE.next = SHOW_GENMODE_WIREFRAME;
@@ -268,7 +268,8 @@ public class VertexOptimizer
*/
public int getColor(LodDirection lodDirection)
{
if (CONFIG.client().advanced().debugging().getDebugMode() != DebugMode.SHOW_DETAIL)
if (CONFIG.client().advanced().debugging().getDebugMode() != DebugMode.SHOW_DETAIL &&
CONFIG.client().advanced().debugging().getDebugMode() != DebugMode.SHOW_WIREFRAME)
return colorMap[DIRECTION_INDEX.get(lodDirection)];
else
return ColorUtil.applyShade(color, MC.getShade(lodDirection));
@@ -158,8 +158,8 @@ public class GLProxy
private GLProxy()
{
boolean enableDebugLogging = CONFIG.client().advanced().debugging().getDebugMode() == DebugMode.SHOW_DETAIL;
// boolean enableDebugLogging = CONFIG.client().advanced().debugging().getDebugMode() == DebugMode.SHOW_DETAIL;
boolean enableDebugLogging = false;
// this must be created on minecraft's render context to work correctly
ClientApi.LOGGER.info("Creating " + GLProxy.class.getSimpleName() + "... If this is the last message you see in the log there must have been a OpenGL error.");
@@ -242,10 +242,16 @@ public class LodRenderer
drawBindBuff.end("drawBindBuff");
// set the required open GL settings
LagSpikeCatcher drawSetPolygon = new LagSpikeCatcher();
if (CONFIG.client().advanced().debugging().getDebugMode() == DebugMode.SHOW_DETAIL_WIREFRAME || CONFIG.client().advanced().debugging().getDebugMode() == DebugMode.SHOW_GENMODE_WIREFRAME)
if (CONFIG.client().advanced().debugging().getDebugMode() == DebugMode.SHOW_DETAIL_WIREFRAME
|| CONFIG.client().advanced().debugging().getDebugMode() == DebugMode.SHOW_GENMODE_WIREFRAME
|| CONFIG.client().advanced().debugging().getDebugMode() == DebugMode.SHOW_WIREFRAME) {
GL32.glPolygonMode(GL32.GL_FRONT_AND_BACK, GL32.GL_LINE);
else
GL32.glDisable(GL32.GL_CULL_FACE);
}
else {
GL32.glPolygonMode(GL32.GL_FRONT_AND_BACK, GL32.GL_FILL);
GL32.glEnable(GL32.GL_CULL_FACE);
}
drawSetPolygon.end("drawSetPolygon");
LagSpikeCatcher drawEnableCull = new LagSpikeCatcher();
GL32.glEnable(GL32.GL_CULL_FACE);
@@ -353,6 +359,7 @@ public class LodRenderer
shaderProgram.unbind();
lightmapTexture.free();
GL32.glEnable(GL32.GL_CULL_FACE);
GL32.glPolygonMode(GL32.GL_FRONT_AND_BACK, GL32.GL_FILL);
if (currentBlend)
GL32.glEnable(GL32.GL_BLEND);
@@ -558,6 +558,7 @@ public interface ILodConfigWrapperSingleton
+ " Should specialized colors/rendering modes be used? \n"
+ "\n"
+ " " + DebugMode.OFF + ": Fake chunks will be drawn with their normal colors. \n"
+ " " + DebugMode.SHOW_WIREFRAME + ": Fake chunks will be drawn as wireframes. \n"
+ " " + DebugMode.SHOW_DETAIL + ": Fake chunks color will be based on their detail level. \n"
+ " " + DebugMode.SHOW_DETAIL_WIREFRAME + ": Fake chunks color will be based on their detail level, drawn as a wireframe. \n"
+ " " + DebugMode.SHOW_GENMODE + ": Fake chunks color will be based on their distant generation mode. \n"
@@ -126,6 +126,7 @@
"DistantHorizons.config.enum.BlocksToAvoid.NO_COLLISION": "No collision",
"DistantHorizons.config.enum.BlocksToAvoid.BOTH": "Both",
"DistantHorizons.config.enum.DebugMode.OFF": "Off",
"DistantHorizons.config.enum.DebugMode.SHOW_WIREFRAME": "Show wireframe",
"DistantHorizons.config.enum.DebugMode.SHOW_DETAIL": "Show detail",
"DistantHorizons.config.enum.DebugMode.SHOW_DETAIL_WIREFRAME": "Show detail with wireframe",
"DistantHorizons.config.enum.DebugMode.SHOW_GENMODE": "Show generation mode",