mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
Actually subtract a tile-position not a block-position to get the correct center
This commit is contained in:
parent
1312f4bf96
commit
00b9b05431
@ -36,6 +36,7 @@
|
||||
|
||||
import com.flowpowered.math.vector.Vector2d;
|
||||
import com.flowpowered.math.vector.Vector2i;
|
||||
import com.flowpowered.math.vector.Vector3i;
|
||||
|
||||
public class RenderTask {
|
||||
|
||||
@ -59,15 +60,17 @@ public RenderTask(String name, MapType mapType) {
|
||||
this.renderedTiles = 0;
|
||||
}
|
||||
|
||||
public void optimizeQueue(Vector2i center) {
|
||||
public void optimizeQueue(Vector2i centerBlockPos) {
|
||||
//Find a good grid size to match the MCAWorlds chunk-cache size of 500
|
||||
Vector2d sortGridSize = new Vector2d(20, 20).div(mapType.getTileRenderer().getHiresModelManager().getTileSize().toDouble().div(16)).ceil().max(1, 1);
|
||||
|
||||
Vector2i centerTile = mapType.getTileRenderer().getHiresModelManager().posToTile(new Vector3i(centerBlockPos.getX(), 0, centerBlockPos.getY()));
|
||||
|
||||
synchronized (renderTiles) {
|
||||
ArrayList<Vector2i> tileList = new ArrayList<>(renderTiles);
|
||||
tileList.sort((v1, v2) -> {
|
||||
v1 = v1.sub(center);
|
||||
v2 = v2.sub(center);
|
||||
v1 = v1.sub(centerTile);
|
||||
v2 = v2.sub(centerTile);
|
||||
|
||||
Vector2i v1SortGridPos = v1.toDouble().div(sortGridSize).floor().toInt();
|
||||
Vector2i v2SortGridPos = v2.toDouble().div(sortGridSize).floor().toInt();
|
||||
|
Loading…
Reference in New Issue
Block a user