From 67637dbf10f753f2ef0927fa75dd373054d2bf68 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 6 Nov 2025 21:50:43 -0600 Subject: [PATCH] detail level renaming --- .../enums/config/EDhApiMaxHorizontalResolution.java | 5 +---- .../fullData/sources/FullDataSourceV2.java | 8 ++++---- .../fullDatafile/V2/FullDataSourceProviderV2.java | 10 +++++----- .../fullDatafile/V2/FullDataUpdatePropagatorV2.java | 2 +- .../distanthorizons/core/render/LodQuadTree.java | 11 +++++------ .../core/util/objects/quadTree/QuadTree.java | 2 +- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/api/src/main/java/com/seibel/distanthorizons/api/enums/config/EDhApiMaxHorizontalResolution.java b/api/src/main/java/com/seibel/distanthorizons/api/enums/config/EDhApiMaxHorizontalResolution.java index 65f4399c1..2ecadcc1c 100644 --- a/api/src/main/java/com/seibel/distanthorizons/api/enums/config/EDhApiMaxHorizontalResolution.java +++ b/api/src/main/java/com/seibel/distanthorizons/api/enums/config/EDhApiMaxHorizontalResolution.java @@ -64,10 +64,7 @@ public enum EDhApiMaxHorizontalResolution /** How wide each LOD DataPoint is */ public final int dataPointWidth; - /** - * This is the same as detailLevel in LodQuadTreeNode, - * lowest is 0 highest is 9 - */ + /** This is the same as detailLevel in LodQuadTreeNode */ public final byte detailLevel; /* Start/End X/Z give the block positions diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/FullDataSourceV2.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/FullDataSourceV2.java index 71f44b254..b092cff17 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/FullDataSourceV2.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/FullDataSourceV2.java @@ -395,7 +395,7 @@ public class FullDataSourceV2 // copy over application flag if either are set to continue propagating (BoolUtil.falseIfNull(this.applyToParent) || BoolUtil.falseIfNull(inputDataSource.applyToParent)) // don't propagate past the top of the tree - && (DhSectionPos.getDetailLevel(this.pos) < FullDataSourceProviderV2.TOP_SECTION_DETAIL_LEVEL); + && (DhSectionPos.getDetailLevel(this.pos) < FullDataSourceProviderV2.ROOT_SECTION_DETAIL_LEVEL); } // null check to prevent setting a flag we don't want to save in the DB @@ -404,7 +404,7 @@ public class FullDataSourceV2 this.applyToChildren = (BoolUtil.falseIfNull(this.applyToChildren) || BoolUtil.falseIfNull(inputDataSource.applyToChildren)) // don't propagate past the bottom of the tree - && (DhSectionPos.getDetailLevel(this.pos) > FullDataSourceProviderV2.MIN_SECTION_DETAIL_LEVEL); + && (DhSectionPos.getDetailLevel(this.pos) > FullDataSourceProviderV2.LEAF_SECTION_DETAIL_LEVEL); } } else if (inputDetailLevel + 1 == thisDetailLevel) @@ -415,7 +415,7 @@ public class FullDataSourceV2 this.applyToParent = dataChanged && (BoolUtil.falseIfNull(this.applyToParent) || BoolUtil.falseIfNull(inputDataSource.applyToParent)) - && (DhSectionPos.getDetailLevel(this.pos) < FullDataSourceProviderV2.TOP_SECTION_DETAIL_LEVEL); + && (DhSectionPos.getDetailLevel(this.pos) < FullDataSourceProviderV2.ROOT_SECTION_DETAIL_LEVEL); } else if (inputDetailLevel - 1 == thisDetailLevel) @@ -427,7 +427,7 @@ public class FullDataSourceV2 this.applyToChildren = dataChanged && (BoolUtil.falseIfNull(this.applyToChildren) || BoolUtil.falseIfNull(inputDataSource.applyToChildren)) - && (DhSectionPos.getDetailLevel(this.pos) > FullDataSourceProviderV2.MIN_SECTION_DETAIL_LEVEL); + && (DhSectionPos.getDetailLevel(this.pos) > FullDataSourceProviderV2.LEAF_SECTION_DETAIL_LEVEL); } else { diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/V2/FullDataSourceProviderV2.java b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/V2/FullDataSourceProviderV2.java index 15ff70549..67c3401ad 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/V2/FullDataSourceProviderV2.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/V2/FullDataSourceProviderV2.java @@ -63,17 +63,17 @@ public class FullDataSourceProviderV2 implements IDebugRenderable, AutoCloseable * The highest numerical detail level possible. * Used when determining which positions to update. * - * @see FullDataSourceProviderV2#MIN_SECTION_DETAIL_LEVEL + * @see FullDataSourceProviderV2#LEAF_SECTION_DETAIL_LEVEL */ - public static final byte TOP_SECTION_DETAIL_LEVEL + public static final byte ROOT_SECTION_DETAIL_LEVEL = DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL - + LodUtil.REGION_DETAIL_LEVEL; // TODO how big do we need to go? + + LodUtil.REGION_DETAIL_LEVEL; /** * The lowest numerical detail level possible. * - * @see FullDataSourceProviderV2#TOP_SECTION_DETAIL_LEVEL + * @see FullDataSourceProviderV2#ROOT_SECTION_DETAIL_LEVEL */ - public static final byte MIN_SECTION_DETAIL_LEVEL = DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL; + public static final byte LEAF_SECTION_DETAIL_LEVEL = DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL; diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/V2/FullDataUpdatePropagatorV2.java b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/V2/FullDataUpdatePropagatorV2.java index 8f47ac19f..0d783cdbe 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/V2/FullDataUpdatePropagatorV2.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/V2/FullDataUpdatePropagatorV2.java @@ -218,7 +218,7 @@ public class FullDataUpdatePropagatorV2 implements IDebugRenderable, AutoCloseab } - if (DhSectionPos.getDetailLevel(parentUpdatePos) < FullDataSourceProviderV2.TOP_SECTION_DETAIL_LEVEL) + if (DhSectionPos.getDetailLevel(parentUpdatePos) < FullDataSourceProviderV2.ROOT_SECTION_DETAIL_LEVEL) { parentDataSource.applyToParent = true; } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java b/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java index 3fa3dd9e3..4191cc995 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java @@ -279,9 +279,8 @@ public class LodQuadTree extends QuadTree implements IDebugRen // and disabling render sections // //===============================// - //byte expectedDetailLevel = DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL + 3; // can be used instead of the following logic for testing byte expectedDetailLevel = this.calculateExpectedDetailLevel(playerPos, sectionPos); - expectedDetailLevel = (byte) Math.min(expectedDetailLevel, this.minRenderDetailLevel); + expectedDetailLevel = (byte) Math.min(expectedDetailLevel, this.minRootRenderDetailLevel); expectedDetailLevel += DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL; if (DhSectionPos.getDetailLevel(sectionPos) > expectedDetailLevel) @@ -529,11 +528,11 @@ public class LodQuadTree extends QuadTree implements IDebugRen int detailLevel = (int) (Math.log(distance / this.detailDropOffDistanceUnit) / this.detailDropOffLogBase); - return (byte) MathUtil.clamp(this.maxRenderDetailLevel, detailLevel, Byte.MAX_VALUE - 1); + return (byte) MathUtil.clamp(this.maxLeafRenderDetailLevel, detailLevel, Byte.MAX_VALUE - 1); } private double getDrawDistanceFromDetail(int detail) { - if (detail <= this.maxRenderDetailLevel) + if (detail <= this.maxLeafRenderDetailLevel) { return 0; } @@ -552,14 +551,14 @@ public class LodQuadTree extends QuadTree implements IDebugRen this.detailDropOffDistanceUnit = Config.Client.Advanced.Graphics.Quality.horizontalQuality.get().distanceUnitInBlocks * LodUtil.CHUNK_WIDTH; this.detailDropOffLogBase = Math.log(Config.Client.Advanced.Graphics.Quality.horizontalQuality.get().quadraticBase); - this.maxRenderDetailLevel = Config.Client.Advanced.Graphics.Quality.maxHorizontalResolution.get().detailLevel; + this.maxLeafRenderDetailLevel = Config.Client.Advanced.Graphics.Quality.maxHorizontalResolution.get().detailLevel; // The minimum detail level is done to prevent single corner sections rendering 1 detail level lower than the others. // If not done corners may not be flush with the other LODs, which looks bad. byte minSectionDetailLevel = this.getDetailLevelFromDistance(this.blockRenderDistanceDiameter); // get the minimum allowed detail level minSectionDetailLevel -= 1; // -1 so corners can't render lower than their adjacent neighbors. space minSectionDetailLevel = (byte) Math.min(minSectionDetailLevel, this.treeRootDetailLevel); // don't allow rendering lower detail sections than what the tree contains - this.minRenderDetailLevel = (byte) Math.max(minSectionDetailLevel, this.maxRenderDetailLevel); // respect the user's selected max resolution if it is lower detail (IE they want 2x2 block, but minSectionDetailLevel is specifically for 1x1 block render resolution) + this.minRootRenderDetailLevel = (byte) Math.max(minSectionDetailLevel, this.maxLeafRenderDetailLevel); // respect the user's selected max resolution if it is lower detail (IE they want 2x2 block, but minSectionDetailLevel is specifically for 1x1 block render resolution) } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/util/objects/quadTree/QuadTree.java b/core/src/main/java/com/seibel/distanthorizons/core/util/objects/quadTree/QuadTree.java index 8812ec36c..c61e3f868 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/util/objects/quadTree/QuadTree.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/util/objects/quadTree/QuadTree.java @@ -59,7 +59,7 @@ public class QuadTree */ public final byte treeLeafDetailLevel; - private final int diameterInBlocks; // diameterInBlocks + private final int diameterInBlocks; /** contain the actual data in the quad tree structure */ private final MovableGridRingList> topRingList;