More logging & fix 1.16 getminbuildheight & improve blockdetailmap caching for waterlogged blocks
This commit is contained in:
@@ -23,10 +23,12 @@ import java.time.Duration;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.seibel.lod.core.builders.lodBuilding.LodBuilder;
|
||||
import com.seibel.lod.core.enums.rendering.RendererType;
|
||||
import com.seibel.lod.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.lod.core.logging.ConfigBasedSpamLogger;
|
||||
import com.seibel.lod.core.render.RenderSystemTest;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import com.seibel.lod.core.handlers.LodDimensionFinder;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
@@ -209,13 +211,14 @@ public class ClientApi
|
||||
|
||||
LagSpikeCatcher updateToBeLoadedChunk = new LagSpikeCatcher();
|
||||
for (long pos : toBeLoaded) {
|
||||
if (generating.size() >= 8) {
|
||||
if (generating.size() >= 1) {
|
||||
//ApiShared.LOGGER.info("Lod Generating Full! Remining: "+toBeLoaded.size());
|
||||
break;
|
||||
}
|
||||
IChunkWrapper chunk = world.tryGetChunk(FACTORY.createChunkPos(pos));
|
||||
if (chunk == null) {
|
||||
toBeLoaded.remove(pos);
|
||||
LodBuilder.EVENT_LOGGER.debug("Manual Chunk: {} not ready. Remaining queue: {}", FACTORY.createChunkPos(pos), toBeLoaded.size());
|
||||
continue;
|
||||
}
|
||||
if (!chunk.isLightCorrect()) continue;
|
||||
@@ -225,11 +228,12 @@ public class ClientApi
|
||||
//ApiShared.LOGGER.info("Lod Generation trying "+pos+". Remining: " +toBeLoaded.size());
|
||||
ApiShared.lodBuilder.generateLodNodeAsync(chunk, ApiShared.lodWorld,
|
||||
world.getDimensionType(), DistanceGenerationMode.FULL, true, true, () -> {
|
||||
//ApiShared.LOGGER.info("Lod Generation for "+pos+" done. Remining: " +toBeLoaded.size());
|
||||
generating.remove(pos);
|
||||
LodBuilder.EVENT_LOGGER.debug("Manual Chunk: {} done. Remaining queue: {}", FACTORY.createChunkPos(pos), toBeLoaded.size());
|
||||
}, () -> {
|
||||
generating.remove(pos);
|
||||
toBeLoaded.add(pos);
|
||||
LodBuilder.EVENT_LOGGER.debug("Manual Chunk: {} not ready. Remaining queue: {}", FACTORY.createChunkPos(pos), toBeLoaded.size());
|
||||
});
|
||||
}
|
||||
updateToBeLoadedChunk.end("updateToBeLoadedChunk");
|
||||
|
||||
@@ -113,7 +113,7 @@ public class LodBuilder
|
||||
return;
|
||||
}
|
||||
|
||||
Thread thread = new Thread(() ->
|
||||
Runnable thread = () ->
|
||||
{
|
||||
boolean retryNeeded = false;
|
||||
try
|
||||
@@ -147,7 +147,7 @@ public class LodBuilder
|
||||
else
|
||||
retryCallback.run();
|
||||
}
|
||||
});
|
||||
};
|
||||
lodGenThreadPool.execute(thread);
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ public class LodBuilder
|
||||
// generate the LODs
|
||||
int maxVerticalData = DetailDistanceUtil.getMaxVerticalData((byte)0);
|
||||
long[] data = new long[maxVerticalData*16*16];
|
||||
boolean isAllVoid = true;
|
||||
|
||||
if (!config.quickFillWithVoid) {
|
||||
for (int i = 0; i < 16*16; i++)
|
||||
@@ -180,8 +181,7 @@ public class LodBuilder
|
||||
int subX = i/16;
|
||||
int subZ = i%16;
|
||||
writeVerticalData(data, i*maxVerticalData, maxVerticalData, chunk, config, subX, subZ);
|
||||
//if (DataPointUtil.isVoid(data[i*maxVerticalData]))
|
||||
// ApiShared.LOGGER.debug("Datapoint is Void: {}, {}", chunk.getMinX()+subX, chunk.getMinZ()+subZ);
|
||||
isAllVoid &= DataPointUtil.isVoid(data[i*maxVerticalData]);
|
||||
if (!DataPointUtil.doesItExist(data[i*maxVerticalData]))
|
||||
throw new RuntimeException("writeVerticalData result: Datapoint does not exist at "+ chunk.getMinX()+subX +", "+ chunk.getMinZ()+subZ);
|
||||
if (DataPointUtil.getGenerationMode(data[i*maxVerticalData]) != config.distanceGenerationMode.complexity)
|
||||
@@ -193,9 +193,12 @@ public class LodBuilder
|
||||
data[i*maxVerticalData] = DataPointUtil.createVoidDataPoint(config.distanceGenerationMode.complexity);
|
||||
}
|
||||
}
|
||||
if (isAllVoid) EVENT_LOGGER.debug("The chunk {} is completely void.", chunk);
|
||||
|
||||
// This MUST be done after the data is generated, to ensure that during the generation, the data is valid.
|
||||
if (!canGenerateLodFromChunk(chunk)) // TODO Why are we calling this again? - James
|
||||
return false;
|
||||
|
||||
return false; // Answer: Because concurrency change may cause the chunk to have invalid data, like light.
|
||||
|
||||
if (genAll) {
|
||||
return writeAllLodNodeData(lodDim, region, chunk.getChunkPosX(), chunk.getChunkPosZ(), data, config, override);
|
||||
} else {
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.seibel.lod.core.objects.opengl;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import com.seibel.lod.core.api.ApiShared;
|
||||
import com.seibel.lod.core.util.UnitBytes;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
import org.lwjgl.opengl.GL44;
|
||||
|
||||
@@ -118,6 +119,7 @@ public class LodVertexBuffer implements AutoCloseable
|
||||
int bbSize = bb.limit()-bb.position();
|
||||
if (bbSize > maxExpensionSize)
|
||||
throw new IllegalArgumentException("maxExpensionSize is "+maxExpensionSize+" but buffer size is "+bbSize+"!");
|
||||
GLProxy.GL_LOGGER.debug("Uploading {} buffer with {} vertices.", new UnitBytes(bbSize), vertCount);
|
||||
// If size is zero, just ignore it.
|
||||
if (bbSize == 0) return;
|
||||
boolean useBuffStorage = uploadMethod.useBufferStorage;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockDetailWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
||||
/**
|
||||
* @author James Seibel
|
||||
@@ -75,11 +76,12 @@ public interface IChunkWrapper extends IBindable
|
||||
}
|
||||
|
||||
boolean doesNearbyChunksExist();
|
||||
String toString();
|
||||
|
||||
|
||||
|
||||
/** This is a bad hash algorithm, but can be used for rough debugging. */
|
||||
public default int roughHashCode()
|
||||
default int roughHashCode()
|
||||
{
|
||||
int hash = 31;
|
||||
int primeMultiplier = 227;
|
||||
|
||||
Reference in New Issue
Block a user