Move the sorting out of the save() method

This commit is contained in:
Lukas Rieger (Blue) 2022-10-21 18:46:31 +02:00
parent 685a7bf85e
commit 9efeaedf18
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
2 changed files with 6 additions and 4 deletions

View File

@ -67,7 +67,11 @@ public void render(World world, Vector2i tile, TileMetaConsumer tileMetaConsumer
HiresTileModel model = HiresTileModel.instancePool().claimInstance();
renderer.render(world, modelMin, modelMax, model, tileMetaConsumer);
if (save) save(model, tile);
if (save){
model.sort();
save(model, tile);
}
HiresTileModel.instancePool().recycleInstance(model);
}

View File

@ -395,8 +395,6 @@ private void setCapacity(int capacity) {
}
public void writeBufferGeometryJson(OutputStream out) throws IOException {
sort();
Gson gson = new GsonBuilder().create();
JsonWriter json = gson.newJsonWriter(new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8), 81920));
@ -615,7 +613,7 @@ private void writeRounded(JsonWriter json, double value) throws IOException {
else json.value(d);
}
private void sort() {
public void sort() {
if (size <= 1) return; // nothing to sort
// initialize material-index-sort