Fix LodQuadTree not updating for low detail world gen

This commit is contained in:
James Seibel
2023-05-27 10:30:29 -05:00
parent 3d9f21df25
commit 0cd04df689
@@ -87,17 +87,24 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements AutoClose
}
private void updateAllRenderSections(DhBlockPos2D playerPos)
{
// reload any sections that need reloading
// reload any sections that need it
DhSectionPos[] reloadSectionArray = this.sectionsToReload.keySet().toArray(new DhSectionPos[0]);
this.sectionsToReload.clear();
for (DhSectionPos pos : reloadSectionArray)
{
try
{
LodRenderSection renderSection = this.getValue(pos);
if (renderSection != null)
// walk up the tree until we hit the root node or a position that is outside the tree
// this is done so any high detail level changes flow up to the lower detail render sections as well
while (pos.sectionDetailLevel <= this.treeMaxDetailLevel)
{
renderSection.reload(this.renderSourceProvider);
LodRenderSection renderSection = this.getValue(pos);
if (renderSection != null)
{
renderSection.reload(this.renderSourceProvider);
}
pos = pos.getParentPos();
}
}
catch (IndexOutOfBoundsException e) { /* the section is now out of bounds, it doesn't need to be reloaded */ }