Overdraw should now be fixed

This commit is contained in:
Leonardo
2021-10-21 00:39:37 +02:00
parent 80448ce990
commit fedce10917
2 changed files with 15 additions and 12 deletions
@@ -494,24 +494,25 @@ public class LodBufferBuilder
int chunkXdist = LevelPosUtil.getChunkPos(detailLevel, posX) - playerChunkPos.x;
int chunkZdist = LevelPosUtil.getChunkPos(detailLevel, posZ) - playerChunkPos.z;
//We use this to check if the chunk is
boolean isItBorderPos;
if (LodConfig.CLIENT.graphics.advancedGraphicsOption.vanillaOverdraw.get() == VanillaOverdraw.NEVER)
isItBorderPos = LodUtil.isBorderChunk(vanillaRenderedChunks, chunkXdist + gameChunkRenderDistance + 1, chunkZdist + gameChunkRenderDistance + 1);
else
isItBorderPos = false;
boolean nearPlayer = Math.abs(chunkXdist) <= 1 && Math.abs(chunkZdist) <= 1;;
boolean smallRenderDistance = gameChunkRenderDistance <= 4;
boolean smallRenderDistance = gameChunkRenderDistance <= 4;
//We check if the position is
return (gameChunkRenderDistance >= Math.abs(chunkXdist)
&& gameChunkRenderDistance >= Math.abs(chunkZdist)
&& detailLevel <= LodUtil.CHUNK_DETAIL_LEVEL
&& vanillaRenderedChunks[chunkXdist + gameChunkRenderDistance + 1][chunkZdist + gameChunkRenderDistance + 1]
&& (!isItBorderPos || smallRenderDistance)
|| nearPlayer);
boolean vanillaRenderedPosition = gameChunkRenderDistance >= Math.abs(chunkXdist)
&& gameChunkRenderDistance >= Math.abs(chunkZdist)
&& detailLevel <= LodUtil.CHUNK_DETAIL_LEVEL
&& vanillaRenderedChunks[chunkXdist + gameChunkRenderDistance + 1][chunkZdist + gameChunkRenderDistance + 1];
return (vanillaRenderedPosition && (!(isItBorderPos && smallRenderDistance)));
}
@@ -47,6 +47,7 @@ import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.Heightmap;
import net.minecraft.world.server.ServerChunkProvider;
import net.minecraft.world.server.ServerWorld;
import org.lwjgl.system.CallbackI;
/**
* This class holds methods and constants that may be used in multiple places.
@@ -364,6 +365,8 @@ public class LodUtil
if (overdraw == VanillaOverdraw.DYNAMIC
&& chunkRenderDist <= MINIMUM_RENDER_DISTANCE_FOR_PARTIAL_OVERDRAW)
{
overdraw = VanillaOverdraw.NEVER;
/*
// The vanilla render distance isn't far enough
// for partial skipping to make sense...
if (!lodDim.dimension.hasCeiling() && (drawRes == HorizontalResolution.BLOCK))
@@ -381,7 +384,7 @@ public class LodUtil
// Or the user is using a LOW horizontal resolution
// and overdraw would be very noticeable.
overdraw = VanillaOverdraw.NEVER;
}
}*/
}
@@ -391,6 +394,7 @@ public class LodUtil
{
case ALWAYS:
// don't skip any positions
System.out.println("going to return");
return new HashSet<>();
case DYNAMIC:
@@ -433,13 +437,11 @@ public class LodUtil
{
if (x <= centerChunk.x - skipRadius || x >= centerChunk.x + skipRadius
|| z <= centerChunk.z - skipRadius || z >= centerChunk.z + skipRadius)
{
posToSkip.remove(new ChunkPos(x, z));
}
}
}
}
return posToSkip;
}