From 13d6232790e7be3feda8c07842b09288b5a1c3eb Mon Sep 17 00:00:00 2001 From: cola98765 Date: Thu, 30 Dec 2021 12:04:02 +0100 Subject: [PATCH] made connected lods dependant on Vertical Quality config. --- .../core/builders/lodBuilding/LodBuilder.java | 15 ++----- .../core/enums/config/VerticalQuality.java | 44 ++++--------------- 2 files changed, 13 insertions(+), 46 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java b/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java index b5a4ea775..285fca205 100644 --- a/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java +++ b/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java @@ -249,7 +249,7 @@ public class LodBuilder yAbs = chunk.getMaxY(xRel,zRel) - MIN_WORLD_HEIGHT; int count = 0; boolean topBlock = true; - if (yAbs <= 0); + if (yAbs <= 0) dataToMerge[index * verticalData] = DataPointUtil.createVoidDataPoint(generation); while (yAbs > 0) { @@ -261,18 +261,11 @@ public class LodBuilder yAbs = height - 1; // We search light on above air block - depth = determineBottomPointFrom(chunk, config, xAbs, yAbs, zAbs, count < timesToEdgeDetect && !hasCeiling); + depth = determineBottomPointFrom(chunk, config, xAbs, yAbs, zAbs, count < this.config.client().graphics().quality().getVerticalQuality().maxConnectedLods && !hasCeiling); if (hasCeiling && topBlock) - { yAbs = depth; - light = getLightValue(chunk, xAbs,yAbs + MIN_WORLD_HEIGHT, zAbs, true, hasSkyLight, true); - color = generateLodColor(chunk, config, xAbs, yAbs, zAbs); - } - else - { - light = getLightValue(chunk, xAbs, yAbs + MIN_WORLD_HEIGHT, zAbs, hasCeiling, hasSkyLight, topBlock); - color = generateLodColor(chunk, config, xAbs, yAbs, zAbs); - } + light = getLightValue(chunk, xAbs,yAbs + MIN_WORLD_HEIGHT, zAbs, hasCeiling, hasSkyLight, topBlock); + color = generateLodColor(chunk, config, xAbs, yAbs, zAbs); lightBlock = light & 0b1111; lightSky = (light >> 4) & 0b1111; isDefault = ((light >> 8)) == 1; diff --git a/src/main/java/com/seibel/lod/core/enums/config/VerticalQuality.java b/src/main/java/com/seibel/lod/core/enums/config/VerticalQuality.java index 494f78620..a1c449b26 100644 --- a/src/main/java/com/seibel/lod/core/enums/config/VerticalQuality.java +++ b/src/main/java/com/seibel/lod/core/enums/config/VerticalQuality.java @@ -31,53 +31,27 @@ import org.jetbrains.annotations.Nullable; public enum VerticalQuality { LOW( - new int[] { 2, - 2, - 2, - 2, - 1, - 1, - 1, - 1, - 1, - 1, - 1 } + new int[] { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 }, + 0 ), MEDIUM( - new int[] { 4, - 4, - 2, - 2, - 2, - 1, - 1, - 1, - 1, - 1, - 1 } + new int[] { 4, 4, 2, 2, 2, 1, 1, 1, 1, 1, 1 }, + 1 ), HIGH( - new int[] { - 8, - 8, - 4, - 4, - 2, - 2, - 2, - 1, - 1, - 1, - 1 } + new int[] { 8, 8, 4, 4, 2, 2, 2, 1, 1, 1, 1 }, + 2 ); public final int[] maxVerticalData; + public final int maxConnectedLods; - VerticalQuality(int[] maxVerticalData) + VerticalQuality(int[] maxVerticalData, int maxConnectedLods) { this.maxVerticalData = maxVerticalData; + this.maxConnectedLods = maxConnectedLods; } // Note: return null if out of range