Add showBlockMaterial debug rendering and fix a couple block materials

This commit is contained in:
James Seibel
2024-01-21 21:35:05 -06:00
parent 779431b123
commit 9c8d77a4f3
6 changed files with 114 additions and 11 deletions
@@ -48,6 +48,9 @@ public enum EDebugRendering
/** LOD colors are based on their gen mode. */
SHOW_GENMODE,
/** Block Materials are often used by Iris shaders to determine how LODs should be rendered */
SHOW_BLOCK_MATERIAL,
/** Only draw overlapping LOD quads. */
SHOW_OVERLAPPING_QUADS,
@@ -62,8 +65,8 @@ public enum EDebugRendering
case OFF:
return SHOW_DETAIL;
case SHOW_DETAIL:
return SHOW_GENMODE;
case SHOW_GENMODE:
return SHOW_BLOCK_MATERIAL;
case SHOW_BLOCK_MATERIAL:
return SHOW_OVERLAPPING_QUADS;
case SHOW_OVERLAPPING_QUADS:
return SHOW_RENDER_SOURCE_FLAG;
@@ -88,4 +91,5 @@ public enum EDebugRendering
return OFF;
}
}
}
@@ -1114,11 +1114,11 @@ public class Config
.comment(""
+ "Should specialized colors/rendering modes be used? \n"
+ "\n"
+ EDebugRendering.OFF + ": Fake chunks will be drawn with their normal colors. \n"
+ EDebugRendering.SHOW_DETAIL + ": Fake chunks color will be based on their detail level. \n"
+ EDebugRendering.SHOW_GENMODE + ": Fake chunks color will be based on their distant generation mode. \n"
+ EDebugRendering.SHOW_OVERLAPPING_QUADS + ": Fake chunks will be drawn with total white, but overlapping quads will be drawn with red. \n"
+ " but overlapping quads will be drawn with red, drawn as a wireframe.")
+ EDebugRendering.OFF + ": LODs will be drawn with their normal colors. \n"
+ EDebugRendering.SHOW_DETAIL + ": LODs' color will be based on their detail level. \n"
+ EDebugRendering.SHOW_BLOCK_MATERIAL + ": LODs' color will be based on their material. \n"
+ EDebugRendering.SHOW_OVERLAPPING_QUADS + ": LODs will be drawn with total white, but overlapping quads will be drawn with red. \n"
+ "")
.build();
public static ConfigEntry<Boolean> renderWireframe = new ConfigEntry.Builder<Boolean>()
@@ -27,6 +27,7 @@ import com.seibel.distanthorizons.core.util.LodUtil;
import com.seibel.distanthorizons.core.util.RenderDataPointUtil;
import com.seibel.distanthorizons.api.enums.rendering.EDebugRendering;
import com.seibel.distanthorizons.core.dataObjects.render.columnViews.ColumnArrayView;
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
/**
@@ -60,6 +61,8 @@ public class CubicLodTemplate
throw new IllegalArgumentException("Negative y size for the data! Data: " + RenderDataPointUtil.toString(data));
}
byte blockMaterialId = RenderDataPointUtil.getBlockMaterialId(data);
int color;
@@ -91,6 +94,64 @@ public class CubicLodTemplate
fullBright = true;
break;
}
case SHOW_BLOCK_MATERIAL:
{
switch (blockMaterialId)
{
case IBlockStateWrapper.IrisBlockMaterial.UNKOWN:
case IBlockStateWrapper.IrisBlockMaterial.AIR: // shouldn't normally be rendered, but just in case
color = ColorUtil.HOT_PINK;
break;
case IBlockStateWrapper.IrisBlockMaterial.LEAVES:
color = ColorUtil.GREEN;
break;
case IBlockStateWrapper.IrisBlockMaterial.STONE:
color = ColorUtil.GRAY;
break;
case IBlockStateWrapper.IrisBlockMaterial.WOOD:
color = ColorUtil.BROWN;
break;
case IBlockStateWrapper.IrisBlockMaterial.METAL:
color = ColorUtil.DARK_GRAY;
break;
case IBlockStateWrapper.IrisBlockMaterial.DIRT:
color = ColorUtil.LIGHT_BROWN;
break;
case IBlockStateWrapper.IrisBlockMaterial.LAVA:
color = ColorUtil.ORANGE;
break;
case IBlockStateWrapper.IrisBlockMaterial.DEEPSLATE:
color = ColorUtil.BLACK;
break;
case IBlockStateWrapper.IrisBlockMaterial.SNOW:
color = ColorUtil.WHITE;
break;
case IBlockStateWrapper.IrisBlockMaterial.SAND:
color = ColorUtil.TAN;
break;
case IBlockStateWrapper.IrisBlockMaterial.TERRACOTTA:
color = ColorUtil.DARK_ORANGE;
break;
case IBlockStateWrapper.IrisBlockMaterial.NETHER_STONE:
color = ColorUtil.DARK_RED;
break;
case IBlockStateWrapper.IrisBlockMaterial.WATER:
color = ColorUtil.BLUE;
break;
case IBlockStateWrapper.IrisBlockMaterial.ILLUMINATED:
color = ColorUtil.YELLOW;
break;
default:
// undefined color
color = ColorUtil.CYAN;
break;
}
fullBright = true;
break;
}
case SHOW_OVERLAPPING_QUADS:
{
color = ColorUtil.WHITE;
@@ -107,8 +168,6 @@ public class CubicLodTemplate
throw new IllegalArgumentException("Unknown debug mode: " + debugging);
}
byte blockMaterialId = RenderDataPointUtil.getBlockMaterialId(data);
ColumnBox.addBoxQuadsToBuilder(
quadBuilder, // buffer
width, ySize, width, // setWidth
@@ -39,17 +39,22 @@ public class ColorUtil
public static final int BLACK = rgbToInt(0, 0, 0);
public static final int WHITE = rgbToInt(255, 255, 255);
public static final int RED = rgbToInt(255, 0, 0);
public static final int DARK_RED = rgbToInt(100, 0, 0);
public static final int GREEN = rgbToInt(0, 255, 0);
public static final int BLUE = rgbToInt(0, 0, 255);
public static final int YELLOW = rgbToInt(255, 255, 0);
public static final int CYAN = rgbToInt(0, 255, 255);
public static final int MAGENTA = rgbToInt(255, 0, 255);
public static final int ORANGE = rgbToInt(255, 128, 0);
public static final int DARK_ORANGE = rgbToInt(125, 62, 0);
public static final int TAN = rgbToInt(183, 165, 119);
public static final int PINK = rgbToInt(255, 128, 128);
public static final int HOT_PINK = rgbToInt(255, 105, 180);
public static final int GRAY = rgbToInt(128, 128, 128);
public static final int LIGHT_GRAY = rgbToInt(192, 192, 192);
public static final int DARK_GRAY = rgbToInt(64, 64, 64);
public static final int BROWN = rgbToInt(128, 64, 0);
public static final int BROWN = rgbToInt(68, 46, 24);
public static final int LIGHT_BROWN = rgbToInt(130, 112, 67);
public static final int PURPLE = rgbToInt(128, 0, 128);
@@ -24,11 +24,44 @@ import com.seibel.distanthorizons.api.interfaces.block.IDhApiBlockStateWrapper;
/** A Minecraft version independent way of handling Blocks. */
public interface IBlockStateWrapper extends IDhApiBlockStateWrapper
{
//===========//
// constants //
//===========//
int FULLY_TRANSPARENT = 0;
int FULLY_OPAQUE = 16;
int FULLY_OPAQUE = 16;
/** contains the indices used by Iris to determine how different block types should be rendered */
class IrisBlockMaterial
{
public static final byte UNKOWN = 0;
public static final byte LEAVES = 1;
public static final byte STONE = 2;
public static final byte WOOD = 3;
public static final byte METAL = 4;
public static final byte DIRT = 5;
public static final byte LAVA = 6;
public static final byte DEEPSLATE = 7;
public static final byte SNOW = 8;
public static final byte SAND = 9;
public static final byte TERRACOTTA = 10;
public static final byte NETHER_STONE = 11;
public static final byte WATER = 12;
// unlisted numbers are unused
/** shouldn't normally be needed, but just in case */
public static final byte AIR = 14;
public static final byte ILLUMINATED = 15; // Max value
}
//=========//
// methods //
//=========//
String getSerialString();
/**
@@ -785,6 +785,8 @@
"Show detail",
"distanthorizons.config.enum.EDebugRendering.SHOW_GENMODE":
"Show generation mode",
"distanthorizons.config.enum.EDebugRendering.SHOW_BLOCK_MATERIAL":
"Show Material",
"distanthorizons.config.enum.EDebugRendering.SHOW_OVERLAPPING_QUADS":
"Show overlapping quads",
"distanthorizons.config.enum.EDebugRendering.SHOW_RENDER_SOURCE_FLAG":