Tweeks to tracker

This commit is contained in:
mcrcortex
2025-04-08 14:26:39 +10:00
parent 6ccef6d1a5
commit 7af77296ed
3 changed files with 11 additions and 4 deletions

View File

@@ -27,10 +27,9 @@ public class RenderDistanceTracker {
}
public void setRenderDistance(int renderDistance) {
this.tracker.unload();
this.tracker.process(Integer.MAX_VALUE, this::add, this::rem);
this.renderDistance = renderDistance;
this.tracker = new RingTracker(renderDistance, ((int)this.posX)>>9, ((int)this.posZ)>>9, true);
this.tracker.unload();//Mark all as unload
this.tracker = new RingTracker(this.tracker, renderDistance, ((int)this.posX)>>9, ((int)this.posZ)>>9, true);//Steal from previous tracker
}
public void setCenterAndProcess(double x, double z) {

View File

@@ -55,7 +55,7 @@ public class VoxyRenderSystem {
this.renderer = new RenderService(world, threadPool);
this.postProcessing = new PostProcessing();
this.renderDistanceTracker = new RenderDistanceTracker(10,
this.renderDistanceTracker = new RenderDistanceTracker(20,
MinecraftClient.getInstance().world.getBottomSectionCoord()>>5,
(MinecraftClient.getInstance().world.getTopSectionCoord()-1)>>5,
this.renderer::addTopLevelNode,

View File

@@ -16,10 +16,18 @@ public class RingTracker {
private int centerZ;
public RingTracker(int radius, int centerX, int centerZ, boolean fill) {
this(null, radius, centerX, centerZ, fill);
}
public RingTracker(RingTracker stealFrom, int radius, int centerX, int centerZ, boolean fill) {
this.centerX = centerX;
this.centerZ = centerZ;
this.radius = radius;
this.boundDist = generateBoundingHalfCircleDistance(radius);
if (stealFrom != null) {
this.operations.putAll(stealFrom.operations);
stealFrom.operations.clear();
}
if (fill) {
this.fillRing(true);
}