Add vanilla rendered chunk detection to improve edge rendering

In other words, we now render LODs where ever Minecraft isn't rendering chunks itself.
This commit is contained in:
James Seibel
2021-06-14 21:44:26 -05:00
parent a1c547b72e
commit 5a3b8f5baa
3 changed files with 61 additions and 11 deletions
@@ -101,7 +101,6 @@ public class LodBufferBuilder
int startZ = (-LodChunk.WIDTH * (numbChunksWide / 2)) + playerZChunkOffset;
Thread t = new Thread(()->
{
// index of the chunk currently being added to the
@@ -123,12 +122,12 @@ public class LodBufferBuilder
// z axis
for (int j = 0; j < numbChunksWide; j++)
{
// skip the middle
// (As the player moves some chunks will overlap or be missing,
// this is just how chunk loading/unloading works. This can hopefully
// be hidden with careful use of fog)
int middle = (numbChunksWide / 2);
if (isCoordInCenterArea(i, j, middle))
int chunkX = i + (startX / LodChunk.WIDTH);
int chunkZ = j + (startZ / LodChunk.WIDTH);
// skip any chunks that Minecraft is going to render
if(isCoordInCenterArea(i, j, (numbChunksWide / 2))
&& renderer.vanillaRenderedChunks.contains(new ChunkPos(chunkX, chunkZ)))
{
continue;
}
@@ -140,9 +139,6 @@ public class LodBufferBuilder
double yOffset = 0;
double zOffset = (LodChunk.WIDTH * j) + startZ;
int chunkX = i + (startX / LodChunk.WIDTH);
int chunkZ = j + (startZ / LodChunk.WIDTH);
LodChunk lod = lodDim.getLodFromCoordinates(chunkX, chunkZ);
if (lod == null || lod.isLodEmpty())