small fix to the tree cutter

This commit is contained in:
Leonardo
2021-08-23 11:45:15 +02:00
parent 38e323a12f
commit b0ed460230
5 changed files with 24 additions and 20 deletions
@@ -318,7 +318,8 @@ public class LodBufferBuilder
if (LodConfig.CLIENT.distanceGenerationMode.get() != DistanceGenerationMode.NONE)
{
int requesting = maxChunkGenRequests;
/*
//we firstly make sure that the world is filled with half region wide block
for (byte detailGen = LodConfig.CLIENT.maxGenerationDetail.get().detailLevel; detailGen <= LodUtil.REGION_DETAIL_LEVEL; detailGen++)
{
@@ -337,6 +338,7 @@ public class LodBufferBuilder
requesting = maxChunkGenRequests - generationRequestList.size();
}
*/
//we then fill the world with the rest of the block
for (byte detailGen = LodConfig.CLIENT.maxGenerationDetail.get().detailLevel; detailGen <= LodUtil.REGION_DETAIL_LEVEL; detailGen++)
@@ -296,8 +296,8 @@ public class LodDimension
levelPos = new LevelPos(LodUtil.REGION_DETAIL_LEVEL, regionX, regionZ);
for(byte index = LodUtil.BLOCK_DETAIL_LEVEL; index <= LodUtil.REGION_DETAIL_LEVEL; index++){
if(DetailUtil.getDistanceGeneration(index+1) > levelPos.minDistance(posX, posZ)){
region = getRegion(levelPos.convert(DetailUtil.getLodDetail(index+1).detailLevel));
region.cuteTree(DetailUtil.getLodDetail(index).detailLevel);
region = getRegion(levelPos.convert(DetailUtil.getLodDetail(index).detailLevel));
region.cuteTree(DetailUtil.getLodDetail(index-1).detailLevel);
break;
}
}
@@ -387,7 +387,7 @@ public class LodDimension
for(int i=0; i<dataNumber; i++)
{
Map.Entry<LevelPos,Integer> min = Collections.min(listOfData, LevelPos.getPosAndDetailComparator());
Map.Entry<LevelPos,Integer> min = Collections.min(listOfData, LevelPos.getPosComparator());
listOfData.remove(min);
levelMinPosList.add(min);
}
@@ -417,7 +417,7 @@ public class LodDimension
region = getRegion(new LevelPos(LodUtil.REGION_DETAIL_LEVEL, regionPos.x, regionPos.z).convert(detailLevel));
if (region == null)
{
region = new LodRegion(LodConfig.CLIENT.maxGenerationDetail.get().detailLevel, regionPos);
region = new LodRegion(DetailUtil.getLodDetail(detailLevel).detailLevel, regionPos);
addOrOverwriteRegion(region);
} else
{
@@ -441,7 +441,7 @@ public class LodDimension
{
try
{
region = new LodRegion(LodConfig.CLIENT.maxGenerationDetail.get().detailLevel, regionPos);
region = new LodRegion(DetailUtil.getLodDetail(detailLevel).detailLevel, regionPos);
addOrOverwriteRegion(region);
}
catch (ArrayIndexOutOfBoundsException e)
@@ -218,7 +218,7 @@ public class LodRegion implements Serializable
for(int i=0; i<dataNumber; i++)
{
Map.Entry<LevelPos,Integer> min = Collections.min(levelPosList, LevelPos.getPosAndDetailComparator());
Map.Entry<LevelPos,Integer> min = Collections.min(levelPosList, LevelPos.getPosComparator());
levelPosList.remove(min);
levelMinPosList.add(min);
}
@@ -580,15 +580,15 @@ public class LodRegion implements Serializable
/**
* This will be used to save a level
*
* @param lod
* @param detailLevel
* @return
*/
public LevelContainer getLevel(byte lod)
public LevelContainer getLevel(byte detailLevel)
{
if(lod < minDetailLevel){
throw new IllegalArgumentException("getLevel asked for a level that does not exist: minimum " + minDetailLevel + " level requested " + lod);
if(detailLevel < minDetailLevel){
throw new IllegalArgumentException("getLevel asked for a level that does not exist: minimum " + minDetailLevel + " level requested " + detailLevel);
}
return new LevelContainer(lod, colors[lod], height[lod], depth[lod], generationType[lod], dataExistence[lod]);
return new LevelContainer(detailLevel, colors[detailLevel], height[detailLevel], depth[detailLevel], generationType[detailLevel], dataExistence[detailLevel]);
}
/**
@@ -616,7 +616,6 @@ public class LodRegion implements Serializable
{
if(minDetailLevel < detailLevel)
{
System.out.println("cutting at " + regionPosX + " " + regionPosZ + " " + detailLevel);
for (byte tempLod = 0; tempLod < detailLevel; tempLod++)
{
colors[tempLod] = new byte[0][0][0];
@@ -139,8 +139,8 @@ public class ClientProxy
// LodConfig.CLIENT.drawLODs.set(true);
LodConfig.CLIENT.debugMode.set(false);
LodConfig.CLIENT.maxDrawDetail.set(LodDetail.HALF);
LodConfig.CLIENT.maxGenerationDetail.set(LodDetail.FULL);
LodConfig.CLIENT.maxDrawDetail.set(LodDetail.SINGLE);
LodConfig.CLIENT.maxGenerationDetail.set(LodDetail.SINGLE);
LodConfig.CLIENT.fogDistance.set(FogDistance.FAR);
LodConfig.CLIENT.fogDrawOverride.set(FogDrawOverride.ALWAYS_DRAW_FOG_FANCY);
@@ -25,15 +25,15 @@ public class DetailUtil
private static LodDetail[] lodDetails = {
LodDetail.FULL,
LodDetail.FULL,
LodDetail.HALF,
LodDetail.HALF,
LodDetail.QUAD,
LodDetail.QUAD,
LodDetail.DOUBLE,
LodDetail.DOUBLE,
LodDetail.SINGLE,
LodDetail.SINGLE,
LodDetail.SINGLE,
LodDetail.SINGLE,
LodDetail.SINGLE,
LodDetail.SINGLE,
LodDetail.SINGLE};
public static int getDistanceRendering(int detail)
@@ -68,6 +68,9 @@ public class DetailUtil
public static LodDetail getLodDetail(int detail)
{
return lodDetails[detail];
if(detail < minDetail)
return lodDetails[minDetail];
else
return lodDetails[detail];
}
}