fixed a small error with the timer
This commit is contained in:
@@ -120,34 +120,26 @@ public class LodWorldGenerator
|
||||
if (nodeToGenerate == null)
|
||||
nodeToGenerate = new ConcurrentHashMap<>();
|
||||
|
||||
// start by generating half-region sized blocks...
|
||||
//int farRequest = maxChunkGenRequests / 4;
|
||||
//int nearRequest = maxChunkGenRequests * 3 /4;
|
||||
//we firstly make sure that the world is filled with half region wide block
|
||||
|
||||
Comparator<LevelPos> posComparator = LevelPos.getPosComparator(
|
||||
Comparator<LevelPos> posNearComparator = LevelPos.getPosComparator(
|
||||
playerBlockPosRounded.getX(),
|
||||
playerBlockPosRounded.getZ());
|
||||
Comparator<LevelPos> posLevelComparator = LevelPos.getPosAndDetailComparator(
|
||||
Comparator<LevelPos> posFarComparator = LevelPos.getPosAndDetailComparator(
|
||||
playerBlockPosRounded.getX(),
|
||||
playerBlockPosRounded.getZ());
|
||||
nodeToGenerateListNear = new TreeSet(posComparator);
|
||||
nodeToGenerateListFar = new TreeSet(posLevelComparator);
|
||||
// ...then once the world is filled with big sized blocks
|
||||
// fill in the rest
|
||||
//int nearRequesting = maxChunkGenRequests - maxChunkGenRequests / 4 + farRequesting;
|
||||
//we then fill the world with the rest of the block
|
||||
nodeToGenerateListNear = new TreeSet(posNearComparator);
|
||||
nodeToGenerateListFar = new TreeSet(posFarComparator);
|
||||
|
||||
lodDim.getDataToGenerate(
|
||||
nodeToGenerate,
|
||||
playerBlockPosRounded.getX(),
|
||||
playerBlockPosRounded.getZ());
|
||||
|
||||
// how many level positions to
|
||||
int requesting = maxChunkGenRequests;
|
||||
|
||||
//here we prepare two sorted set
|
||||
//the first contains the near pos to render
|
||||
//the second contain the far pos to render
|
||||
byte farDetail = (byte) 7;
|
||||
//We alternate the generation between fast and near to make everything more smooth
|
||||
for (LevelPos pos : nodeToGenerate.keySet())
|
||||
{
|
||||
if (!nodeToGenerate.get(pos).booleanValue())
|
||||
@@ -166,10 +158,12 @@ public class LodWorldGenerator
|
||||
int maxDistance;
|
||||
byte circle;
|
||||
LevelPos levelPos;
|
||||
int requesting = maxChunkGenRequests;
|
||||
int requestingFar = maxChunkGenRequests / 4;
|
||||
while (requesting > 0 && !nodeToGenerateListNear.isEmpty())
|
||||
{
|
||||
levelPos = nodeToGenerateListNear.first();
|
||||
System.out.println(levelPos);
|
||||
nodeToGenerate.remove(levelPos);
|
||||
nodeToGenerateListNear.remove(levelPos);
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ public class LodRenderer
|
||||
// should LODs be regenerated?
|
||||
long newTime = System.currentTimeMillis();
|
||||
//We check if the player has moved
|
||||
if (newTime - prevPlayerPosTime > 5000)
|
||||
if (newTime - prevPlayerPosTime > 2000)
|
||||
{
|
||||
if (previousPos.detailLevel == 0 ||
|
||||
player.xChunk != previousPos.posX ||
|
||||
@@ -233,12 +233,12 @@ public class LodRenderer
|
||||
prevPlayerPosTime = newTime;
|
||||
}
|
||||
//We check if the vanilla rendered chunks are changed
|
||||
if (newTime - prevVanillaChunkTime > 5000)
|
||||
if (newTime - prevVanillaChunkTime > 1000)
|
||||
{
|
||||
if (previousVanillaRenderedChunks.equals(vanillaRenderedChunks))
|
||||
if (!previousVanillaRenderedChunks.equals(vanillaRenderedChunks))
|
||||
{
|
||||
partialRegen = true;
|
||||
vanillaRenderedChunks = previousVanillaRenderedChunks;
|
||||
previousVanillaRenderedChunks = vanillaRenderedChunks;
|
||||
}
|
||||
prevVanillaChunkTime = newTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user