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 275dfd660..4aa0b7972 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 @@ -254,17 +254,21 @@ public class LodQuadTree extends QuadTree implements AutoClose // wait for the parent to disable before enabling this section, so we don't overdraw/overlap render sections if (!parentRenderSectionIsEnabled && renderSection.canRenderNow()) { - renderSection.enableRendering(); - - // delete/disable children, all of them will be a lower detail level than requested - quadNode.deleteAllChildren((childRenderSection) -> + // if rendering is already enabled we don't have to re-enable it + if (!renderSection.isRenderingEnabled()) { - if (childRenderSection != null) + renderSection.enableRendering(); + + // delete/disable children, all of them will be a lower detail level than requested + quadNode.deleteAllChildren((childRenderSection) -> { - childRenderSection.disableRendering(); - childRenderSection.disposeRenderData(); - } - }); + if (childRenderSection != null) + { + childRenderSection.disableRendering(); + childRenderSection.disposeRenderData(); + } + }); + } } return renderSection.canRenderNow(); } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java b/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java index 45ec19aa6..a5c05de82 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java @@ -104,6 +104,19 @@ public class LodRenderSection implements IDebugRenderable public void enableRendering() { + // FIXME this is a temporary fix for sections not building the first time, + // this may cause LODs to flash when first loading + // Problem reproduction steps: + // 1. connect to a multiplayer server + // 2. enter spectator + // 3. fly in one direction until section detail levels 7 and 8 appear + // 4. empty LODs should appear + if (!this.isRenderingEnabled) + { + // this only needs to be called when first enabling the section + this.markBufferDirty(); + } + this.isRenderingEnabled = true; } public void disableRendering() { this.isRenderingEnabled = false; }