temporary fix for LodRenderSections not appearing

This commit is contained in:
James Seibel
2023-07-31 20:51:40 -05:00
parent 3179ba0db8
commit 8f6ee82fc7
2 changed files with 26 additions and 9 deletions
@@ -254,17 +254,21 @@ public class LodQuadTree extends QuadTree<LodRenderSection> 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();
}
@@ -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; }