quad tree region/comment cleanup
This commit is contained in:
@@ -372,8 +372,6 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
|||||||
//=========================//
|
//=========================//
|
||||||
//region
|
//region
|
||||||
|
|
||||||
// also handles disabling beacons
|
|
||||||
|
|
||||||
for (QuadNode<LodRenderSection> node : this.tickNodeHolder.getDisableNodes())
|
for (QuadNode<LodRenderSection> node : this.tickNodeHolder.getDisableNodes())
|
||||||
{
|
{
|
||||||
if (node == null || node.value == null) { continue; }
|
if (node == null || node.value == null) { continue; }
|
||||||
@@ -476,7 +474,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
|||||||
//=========================//
|
//=========================//
|
||||||
// tick - recursive update //
|
// tick - recursive update //
|
||||||
//=========================//
|
//=========================//
|
||||||
///region
|
//region
|
||||||
|
|
||||||
private void recursivelyUpdateRenderSectionNode(
|
private void recursivelyUpdateRenderSectionNode(
|
||||||
@NotNull DhBlockPos2D playerPos,
|
@NotNull DhBlockPos2D playerPos,
|
||||||
@@ -490,7 +488,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
|||||||
// get/create the node //
|
// get/create the node //
|
||||||
// and render section //
|
// and render section //
|
||||||
//=====================//
|
//=====================//
|
||||||
///region
|
//region
|
||||||
|
|
||||||
// create the node
|
// create the node
|
||||||
if (quadNode == null)
|
if (quadNode == null)
|
||||||
@@ -511,7 +509,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
|||||||
quadNode.setValue(sectionPos, renderSection);
|
quadNode.setValue(sectionPos, renderSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
///endregion
|
//endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -519,7 +517,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
|||||||
// handle enabling, loading, //
|
// handle enabling, loading, //
|
||||||
// and disabling render sections //
|
// and disabling render sections //
|
||||||
//===============================//
|
//===============================//
|
||||||
///region
|
//region
|
||||||
|
|
||||||
// load every node for rendering
|
// load every node for rendering
|
||||||
if (!renderSection.gpuUploadInProgress()
|
if (!renderSection.gpuUploadInProgress()
|
||||||
@@ -548,7 +546,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
|||||||
throw new IllegalStateException("LodQuadTree shouldn't be updating renderSections below the expected detail level: [" + expectedDetailLevel + "].");
|
throw new IllegalStateException("LodQuadTree shouldn't be updating renderSections below the expected detail level: [" + expectedDetailLevel + "].");
|
||||||
}
|
}
|
||||||
|
|
||||||
///endregion
|
//endregion
|
||||||
}
|
}
|
||||||
private void onDetailLevelTooHigh(
|
private void onDetailLevelTooHigh(
|
||||||
@NotNull DhBlockPos2D playerPos,
|
@NotNull DhBlockPos2D playerPos,
|
||||||
@@ -622,7 +620,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///endregion
|
//endregion
|
||||||
|
|
||||||
//=====================//
|
//=====================//
|
||||||
// tick - work queuing //
|
// tick - work queuing //
|
||||||
|
|||||||
+1
-1
@@ -325,7 +325,7 @@ public class QuadNode<T>
|
|||||||
|
|
||||||
public void deleteAllChildren() { this.deleteAllChildren(null); }
|
public void deleteAllChildren() { this.deleteAllChildren(null); }
|
||||||
/** @param removedItemConsumer is only fired for non-null nodes, however the value passed in may be null */
|
/** @param removedItemConsumer is only fired for non-null nodes, however the value passed in may be null */
|
||||||
public void deleteAllChildren(Consumer<? super T> removedItemConsumer)
|
public void deleteAllChildren(@Nullable Consumer<? super T> removedItemConsumer)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
+6
-3
@@ -355,7 +355,7 @@ public class QuadTree<T>
|
|||||||
//region
|
//region
|
||||||
|
|
||||||
public void setCenterBlockPos(DhBlockPos2D newCenterPos) { this.setCenterBlockPos(newCenterPos, null); }
|
public void setCenterBlockPos(DhBlockPos2D newCenterPos) { this.setCenterBlockPos(newCenterPos, null); }
|
||||||
public void setCenterBlockPos(DhBlockPos2D newCenterPos, Consumer<? super T> removedItemConsumer)
|
public void setCenterBlockPos(DhBlockPos2D newCenterPos, @Nullable Consumer<? super T> removedItemConsumer)
|
||||||
{
|
{
|
||||||
this.centerBlockPos = newCenterPos;
|
this.centerBlockPos = newCenterPos;
|
||||||
|
|
||||||
@@ -373,11 +373,14 @@ public class QuadTree<T>
|
|||||||
// remove out of bounds root nodes
|
// remove out of bounds root nodes
|
||||||
this.topRingList.moveTo(expectedCenterPos.getX(), expectedCenterPos.getY(), (quadNode) ->
|
this.topRingList.moveTo(expectedCenterPos.getX(), expectedCenterPos.getY(), (quadNode) ->
|
||||||
{
|
{
|
||||||
if (quadNode != null && removedItemConsumer != null)
|
if (quadNode != null)
|
||||||
{
|
{
|
||||||
quadNode.deleteAllChildren(removedItemConsumer);
|
quadNode.deleteAllChildren(removedItemConsumer);
|
||||||
|
|
||||||
removedItemConsumer.accept(quadNode.value);
|
if (removedItemConsumer != null)
|
||||||
|
{
|
||||||
|
removedItemConsumer.accept(quadNode.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user