Cull beacons based on X/Z distance instead of 3D distance

This commit is contained in:
James Seibel
2024-09-01 17:28:08 -05:00
parent 1daa06fff4
commit c26631db57
2 changed files with 8 additions and 4 deletions
@@ -307,9 +307,7 @@ public class BeaconRenderHandler
{
Thread.sleep(MAX_CULLING_FREQUENCY_IN_MS);
}
catch (InterruptedException ignore)
{
}
catch (InterruptedException ignore) { }
try
{
@@ -331,7 +329,7 @@ public class BeaconRenderHandler
for (DhApiRenderableBox box : this.fullBeaconBoxList)
{
// if a beacon is outside the vanilla render distance render it
double distance = Vec3d.getDistance(cameraPos, box.minPos);
double distance = Vec3d.getHorizontalDistance(cameraPos, box.minPos);
if (distance > mcRenderDistance)
{
this.beaconBoxGroup.add(box);
@@ -164,5 +164,11 @@ public class Vec3d extends DhApiVec3d
+ Math.pow(a.y - b.y, 2)
+ Math.pow(a.z - b.z, 2);
}
/** Gets the distance between points A and B, ignoring Y height. */
public static double getHorizontalDistance(DhApiVec3d a, DhApiVec3d b)
{
return Math.sqrt(Math.pow(a.x - b.x, 2)
+ Math.pow(a.z - b.z, 2));
}
}