Added new render/generation distance calculator
This commit is contained in:
@@ -145,7 +145,7 @@ public class LodWorldGenerator
|
||||
DetailDistanceUtil.getDistanceGeneration(detailGen),
|
||||
DetailDistanceUtil.getDistanceGeneration(detailGen + 1),
|
||||
DetailDistanceUtil.getDistanceGenerationMode(detailGen).complexity,
|
||||
(byte) 9,
|
||||
(byte) 7,
|
||||
farRequesting);
|
||||
for(LevelPos levelPos : levelPosListToGen){
|
||||
generationRequestList.add(new GenerationRequest(levelPos,DetailDistanceUtil.getDistanceGenerationMode(detailGen), DetailDistanceUtil.getLodDetail(detailGen)));
|
||||
|
||||
@@ -11,4 +11,7 @@ public enum DistanceCalculatorType
|
||||
|
||||
/** different Lod detail render and generate quadratically to the distance */
|
||||
QUADRATIC,
|
||||
|
||||
/** we calculate the distance based on game render distance and mod render distance*/
|
||||
RENDER_DEPENDANT;
|
||||
}
|
||||
@@ -151,8 +151,13 @@ public class LodConfig
|
||||
+ "\n"
|
||||
+ " " + DistanceCalculatorType.QUADRATIC + " \n"
|
||||
+ " with LINEAR calculator the quality of block decrease \n"
|
||||
+ " quadratically to the distance of the player \n"
|
||||
|
||||
+ "\n"
|
||||
+ " " + DistanceCalculatorType.RENDER_DEPENDANT + " \n"
|
||||
+ " with LINEAR calculator the quality of block decrease \n"
|
||||
+ " quadratically to the distance of the player \n")
|
||||
.defineEnum("lodDistanceComputation", DistanceCalculatorType.LINEAR);
|
||||
.defineEnum("lodDistanceComputation", DistanceCalculatorType.RENDER_DEPENDANT);
|
||||
|
||||
lodQuality = builder
|
||||
.comment("\n\n"
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.seibel.lod.util;
|
||||
import com.seibel.lod.enums.DistanceGenerationMode;
|
||||
import com.seibel.lod.enums.LodDetail;
|
||||
import com.seibel.lod.handlers.LodConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class DetailDistanceUtil
|
||||
{
|
||||
@@ -89,11 +90,20 @@ public class DetailDistanceUtil
|
||||
switch (LodConfig.CLIENT.lodDistanceCalculatorType.get())
|
||||
{
|
||||
case LINEAR:
|
||||
initial = Math.min(maxDistance/maxDetail, 1024);
|
||||
initial = Math.min(maxDistance*2/maxDetail, 1024);
|
||||
return (detail * initial);
|
||||
case QUADRATIC:
|
||||
initial = LodConfig.CLIENT.lodQuality.get() * 128;
|
||||
return (int) (Math.pow(2, detail) * initial);
|
||||
case RENDER_DEPENDANT:
|
||||
int realRenderDistance = Minecraft.getInstance().options.renderDistance * 16;
|
||||
int border = 128;
|
||||
byte detailAtBorder = (byte) 4;
|
||||
if(detail > detailAtBorder){
|
||||
return (detail * (border-realRenderDistance)/detailAtBorder + realRenderDistance);
|
||||
}else{
|
||||
return ((maxDetail - detail) * (maxDistance-border)/(maxDetail - detailAtBorder) + border);
|
||||
}
|
||||
}
|
||||
return distance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user