Close #20 (allow the LOD distance to be changed in the config)

This commit is contained in:
James Seibel
2021-05-31 15:29:26 -05:00
parent ccb58024a1
commit 4de5c287fc
3 changed files with 23 additions and 13 deletions
@@ -93,6 +93,7 @@ public class ClientProxy
// LodConfig.CLIENT.debugMode.set(false);
// LodConfig.CLIENT.lodDetail.set(LodDetail.DOUBLE);
// LodConfig.CLIENT.lodColorStyle.set(LodColorStyle.TOP);
// LodConfig.CLIENT.lodChunkRadiusMultiplier.set(12);
// Note to self:
// if "unspecified" shows up in the pie chart, it is
@@ -57,9 +57,6 @@ public class LodRender
private GameRenderer gameRender;
private IProfiler profiler;
private float farPlaneDistance;
/** this is the radius of the LODs */
private static final int LOD_CHUNK_DISTANCE_RADIUS = 6;
private ReflectionHandler reflectionHandler;
@@ -167,7 +164,7 @@ public class LodRender
farPlaneDistance = renderDistWidth * LodChunk.WIDTH;
// set how big the LODs will be and how far they will go
int totalLength = (int) farPlaneDistance * LOD_CHUNK_DISTANCE_RADIUS * 2;
int totalLength = (int) farPlaneDistance * LodConfig.CLIENT.lodChunkRadiusMultiplier.get() * 2;
int numbChunksWide = (totalLength / LodChunk.WIDTH);
@@ -363,8 +360,8 @@ public class LodRender
if (fogQuality == FogQuality.FANCY)
{
RenderSystem.fogEnd(farPlaneDistance * 0.3f * LOD_CHUNK_DISTANCE_RADIUS);
RenderSystem.fogStart(farPlaneDistance * 0.35f * LOD_CHUNK_DISTANCE_RADIUS);
RenderSystem.fogEnd(farPlaneDistance * 1.75f);
RenderSystem.fogStart(farPlaneDistance * 1.95f);
}
else if(fogQuality == FogQuality.FAST)
{
@@ -380,13 +377,13 @@ public class LodRender
{
if (fogQuality == FogQuality.FANCY)
{
RenderSystem.fogStart(farPlaneDistance * 0.78f * LOD_CHUNK_DISTANCE_RADIUS);
RenderSystem.fogEnd(farPlaneDistance * 1.0f * LOD_CHUNK_DISTANCE_RADIUS);
RenderSystem.fogStart(farPlaneDistance * 0.78f * LodConfig.CLIENT.lodChunkRadiusMultiplier.get());
RenderSystem.fogEnd(farPlaneDistance * 1.0f * LodConfig.CLIENT.lodChunkRadiusMultiplier.get());
}
else if(fogQuality == FogQuality.FAST)
{
RenderSystem.fogStart(farPlaneDistance * 0.5f * LOD_CHUNK_DISTANCE_RADIUS);
RenderSystem.fogEnd(farPlaneDistance * 0.75f * LOD_CHUNK_DISTANCE_RADIUS);
RenderSystem.fogStart(farPlaneDistance * 0.5f * LodConfig.CLIENT.lodChunkRadiusMultiplier.get());
RenderSystem.fogEnd(farPlaneDistance * 0.75f * LodConfig.CLIENT.lodChunkRadiusMultiplier.get());
}
}
@@ -466,7 +463,7 @@ public class LodRender
getFov(partialTicks, true),
(float)this.mc.getMainWindow().getFramebufferWidth() / (float)this.mc.getMainWindow().getFramebufferHeight(),
0.5F,
this.farPlaneDistance * LOD_CHUNK_DISTANCE_RADIUS * 2);
this.farPlaneDistance * LodConfig.CLIENT.lodChunkRadiusMultiplier.get() * 2);
// add the screen space distortions
projectionMatrix.mul(matrixStack.getLast().getMatrix());
@@ -22,7 +22,7 @@ import net.minecraftforge.fml.config.ModConfig;
/**
*
* @author James Seibel
* @version 05-05-2021
* @version 05-31-2021
*/
@Mod.EventBusSubscriber
public class LodConfig
@@ -38,9 +38,13 @@ public class LodConfig
public ForgeConfigSpec.EnumValue<LodTemplate> lodTemplate;
public ForgeConfigSpec.EnumValue<LodDetail> lodDetail;
public ForgeConfigSpec.EnumValue<LodColorStyle> lodColorStyle;
/** this is multiplied by the default view distance
* to determine how far out to generate/render LODs */
public ForgeConfigSpec.IntValue lodChunkRadiusMultiplier;
Client(ForgeConfigSpec.Builder builder)
{
builder.comment(ModInfo.MODNAME + " configuration settings").push("client");
@@ -90,6 +94,14 @@ public class LodConfig
+ " " + LodColorStyle.INDIVIDUAL_SIDES.toString() + ": For each side of the LOD use the color corresponding to that side. ")
.defineEnum("lodColorStyle", LodColorStyle.TOP);
lodChunkRadiusMultiplier = builder
.comment("\n"
+ " This is multiplied by the default view distance \n"
+ " to determine how far out to generate/render LODs. \n"
+ " A value of 2 means that there is 1 render distance worth \n"
+ " of LODs in each cardinal direction.")
.defineInRange("lodChunkRadiusMultiplier", 6, 2, 1023);
builder.pop();
}
}