Skip to content

Commit c3a26ab

Browse files
committed
Add option to disable saving the hires-layer
1 parent b28ade1 commit c3a26ab

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/config/MapConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public class MapConfig implements MapSettings {
4646

4747
private boolean renderEdges = true;
4848

49+
private boolean saveHiresLayer = true;
50+
4951
private String storage = "file";
5052

5153
private boolean ignoreMissingLightData = false;
@@ -110,6 +112,11 @@ public boolean isRenderEdges() {
110112
return renderEdges;
111113
}
112114

115+
@Override
116+
public boolean isSaveHiresLayer() {
117+
return saveHiresLayer;
118+
}
119+
113120
public String getStorage() {
114121
return storage;
115122
}

BlueMapCommon/src/main/resources/de/bluecolored/bluemap/config/maps/map.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ ${max-y-comment<<#>>}max-y: ${max-y}
7676
# Default is true
7777
render-edges: true
7878

79+
# Whether the hires-layer will be saved to the storage.
80+
# Disabling this will speed up rendering and reduce the size of the map-files a lot.
81+
# But you will not be able to see the full 3d-models if you zoom in on the map.
82+
# Changing this to false will not remove any existing tiles, existing tiles just won't get updated anymore.
83+
# Changing this to true will require a re-render of the map.
84+
# Default is true
85+
save-hires-layer: true
86+
7987
# This defines the storage-config that will be used to save this map.
8088
# You can find your storage configs next to this config file in the 'storages'-folder.
8189
# Changing this value requires a re-render of the map. The map in the old storage will not be deleted.

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/BmMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void renderTile(Vector2i tile) {
117117

118118
long start = System.nanoTime();
119119

120-
hiresModelManager.render(world, tile, lowresTileManager);
120+
hiresModelManager.render(world, tile, lowresTileManager, mapSettings.isSaveHiresLayer());
121121

122122
long end = System.nanoTime();
123123
long delta = end - start;

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/HiresModelManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public HiresModelManager(Storage.TileStorage storage, HiresModelRenderer rendere
5757
/**
5858
* Renders the given world tile with the provided render-settings
5959
*/
60-
public void render(World world, Vector2i tile, TileMetaConsumer tileMetaConsumer) {
60+
public void render(World world, Vector2i tile, TileMetaConsumer tileMetaConsumer, boolean save) {
6161
Vector2i tileMin = tileGrid.getCellMin(tile);
6262
Vector2i tileMax = tileGrid.getCellMax(tile);
6363

@@ -67,7 +67,7 @@ public void render(World world, Vector2i tile, TileMetaConsumer tileMetaConsumer
6767
HiresTileModel model = HiresTileModel.instancePool().claimInstance();
6868

6969
renderer.render(world, modelMin, modelMax, model, tileMetaConsumer);
70-
save(model, tile);
70+
if (save) save(model, tile);
7171

7272
HiresTileModel.instancePool().recycleInstance(model);
7373
}

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/hires/RenderSettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,6 @@ default boolean isInsideRenderBoundaries(int x, int y, int z) {
9797
y <= max.getY();
9898
}
9999

100+
boolean isSaveHiresLayer();
101+
100102
}

0 commit comments

Comments
 (0)