Add overdraw offset setting

This commit is contained in:
tom lee
2022-03-21 17:29:10 +08:00
parent 260ba1a70e
commit 6a5263a8f4
4 changed files with 22 additions and 6 deletions
@@ -33,7 +33,10 @@ public class LodBox {
//If the adj pos is at the same level we cull the faces normally, otherwise we divide the face in two and cull the two part separately
//NORTH face vertex creation
if (adjData[LodDirection.NORTH.ordinal() - 2].length == 1)
if (adjData[LodDirection.NORTH.ordinal() - 2] == null) {
builder.addQuadAdj(LodDirection.NORTH, x, y, z, xSize, ySize, ColorUtil.rgbToInt(0, 0, 0), (byte) 15, (byte) 15);
} else if (adjData[LodDirection.NORTH.ordinal() - 2].length == 1)
{
makeAdjQuads(builder, adjData[LodDirection.NORTH.ordinal() - 2][0], LodDirection.NORTH, x, y, z, xSize, ySize,
color, skyLightTop, blockLight);
@@ -45,7 +48,9 @@ public class LodBox {
}
//SOUTH face vertex creation
if (adjData[LodDirection.SOUTH.ordinal() - 2].length == 1)
if (adjData[LodDirection.SOUTH.ordinal() - 2] == null) {
builder.addQuadAdj(LodDirection.SOUTH, x, y, maxZ, xSize, ySize, ColorUtil.rgbToInt(0, 0, 0), (byte) 15, (byte) 15);
} else if (adjData[LodDirection.SOUTH.ordinal() - 2].length == 1)
{
makeAdjQuads(builder, adjData[LodDirection.SOUTH.ordinal() - 2][0], LodDirection.SOUTH, x, y, maxZ, xSize, ySize,
color, skyLightTop, blockLight);
@@ -58,7 +63,10 @@ public class LodBox {
}
//WEST face vertex creation
if (adjData[LodDirection.WEST.ordinal() - 2].length == 1)
if (adjData[LodDirection.WEST.ordinal() - 2] == null) {
builder.addQuadAdj(LodDirection.WEST, x, y, z, zSize, ySize, ColorUtil.rgbToInt(0, 0, 0), (byte) 15, (byte) 15);
} else if (adjData[LodDirection.WEST.ordinal() - 2].length == 1)
{
makeAdjQuads(builder, adjData[LodDirection.WEST.ordinal() - 2][0], LodDirection.WEST, x, y, z, zSize, ySize, color,
skyLightTop, blockLight);
@@ -71,7 +79,10 @@ public class LodBox {
}
//EAST face vertex creation
if (adjData[LodDirection.EAST.ordinal() - 2].length == 1)
if (adjData[LodDirection.EAST.ordinal() - 2] == null) {
builder.addQuadAdj(LodDirection.EAST, maxX, y, z, zSize, ySize, ColorUtil.rgbToInt(0, 0, 0), (byte) 15, (byte) 15);
} else if (adjData[LodDirection.EAST.ordinal() - 2].length == 1)
{
makeAdjQuads(builder, adjData[LodDirection.EAST.ordinal() - 2][0], LodDirection.EAST, maxX, y, z, zSize, ySize,
color, skyLightTop, blockLight);
@@ -282,7 +282,7 @@ public class RenderRegion implements AutoCloseable
|| DataPointUtil.isVoid(posData[0]))
continue;
long[][][] adjData = new long[4][1][];
long[][][] adjData = new long[4][][];
// We extract the adj data in the four cardinal direction
@@ -339,6 +339,7 @@ public class RenderRegion implements AutoCloseable
}
if (adjDetail == detailLevel || adjDetail > detailLevel) {
adjData[lodDirection.ordinal() - 2] = new long[1][];
adjData[lodDirection.ordinal() - 2][0] = adjRegion.getAllData(adjDetail,
LevelPosUtil.convert(detailLevel, xAdj, adjDetail),
LevelPosUtil.convert(detailLevel, zAdj, adjDetail));
@@ -338,7 +338,7 @@ public class LodUtil
public static int computeOverdrawOffset(LodDimension lodDim) {
int chunkRenderDist = MC_RENDER.getRenderDistance() + 1;
VanillaOverdraw overdraw = null;//CONFIG.client().graphics().advancedGraphics().getVanillaOverdraw();
VanillaOverdraw overdraw = CONFIG.client().graphics().advancedGraphics().getVanillaOverdraw();
if (overdraw == VanillaOverdraw.ALWAYS) return Integer.MAX_VALUE;
int offset;
if (overdraw == VanillaOverdraw.NEVER) {
@@ -144,6 +144,10 @@
"Vanilla overdraw",
"DistantHorizons.config.client.graphics.advancedGraphics.vanillaOverdraw.@tooltip":
"Determines how often fake chunks will be rendered on top of regular chunks.\n\n§6Dynamic:§r attempts to pick the best option based on vanilla render distance and dimension.\n§6Always:§r prevents holes in the world, but may look odd for transparent blocks or in caves.\n§6Border:§r renders fake chunks on the border of the vanilla render distance, preventing gaps when the player isn't moving.\n§6Never:§r fake chunks will never overlap the vanilla render distance, but there may be holes in the world.",
"DistantHorizons.config.client.graphics.advancedGraphics.overdrawOffset":
"Overdraw Offset",
"DistantHorizons.config.client.graphics.advancedGraphics.overdrawOffset.@tooltip":
"If on Vanilla Overdraw mode of NEVER, how much should should the border be offset? \n\n '1': The start of lods will be shifted inwards by 1 chunk, causing 1 chunk of overdraw. \n'-1': The start fo lods will be shifted outwards by 1 chunk, causing 1 chunk of gap. \n\nThis setting can be used to deal with gaps due to our vanilla rendered chunk \n detection not being perfect. \n",
"DistantHorizons.config.client.graphics.advancedGraphics.useExtendedNearClipPlane":
"Use extended near clip plane",
"DistantHorizons.config.client.graphics.advancedGraphics.useExtendedNearClipPlane.@tooltip":