From 4d58cc25e3e7c82981496f1a27320d6e4acce552 Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Sun, 17 Nov 2024 15:09:26 +0100 Subject: [PATCH] Add per-map view-settings and optimized flat-view only maps --- .../bluemap/common/WebFilesManager.java | 2 - .../bluemap/common/config/MapConfig.java | 5 +- .../bluemap/common/config/WebappConfig.java | 5 - .../bluecolored/bluemap/config/maps/map.conf | 19 +- .../de/bluecolored/bluemap/config/webapp.conf | 4 - .../components/ControlBar/ControlsSwitch.vue | 13 +- .../src/components/Menu/SettingsMenu.vue | 6 +- common/webapp/src/js/BlueMapApp.js | 22 +- common/webapp/src/js/map/Map.js | 19 +- .../bluemap/core/map/MapSettings.java | 18 + .../core/map/MapSettingsSerializer.java | 5 + .../core/map/hires/ArrayTileModel.java | 498 ++++++++++++++++++ .../core/map/hires/HiresModelManager.java | 13 +- .../core/map/hires/HiresModelRenderer.java | 6 +- .../bluemap/core/map/hires/PRBMWriter.java | 34 +- .../core/map/hires/RenderSettings.java | 4 +- .../bluemap/core/map/hires/TileModel.java | 454 ++-------------- .../bluemap/core/map/hires/VoidTileModel.java | 159 ++++++ .../blockmodel/BlockStateModelRenderer.java | 2 +- .../blockmodel/ResourceModelRenderer.java | 2 +- gradle/libs.versions.toml | 2 +- 21 files changed, 812 insertions(+), 480 deletions(-) create mode 100644 core/src/main/java/de/bluecolored/bluemap/core/map/hires/ArrayTileModel.java create mode 100644 core/src/main/java/de/bluecolored/bluemap/core/map/hires/VoidTileModel.java diff --git a/common/src/main/java/de/bluecolored/bluemap/common/WebFilesManager.java b/common/src/main/java/de/bluecolored/bluemap/common/WebFilesManager.java index e9db5ec3..99c730c6 100644 --- a/common/src/main/java/de/bluecolored/bluemap/common/WebFilesManager.java +++ b/common/src/main/java/de/bluecolored/bluemap/common/WebFilesManager.java @@ -123,7 +123,6 @@ private static class Settings { private boolean useCookies = true; - private boolean enableFreeFlight = true; private boolean defaultToFlatView = false; private String startLocation = null; @@ -150,7 +149,6 @@ private static class Settings { public void setFrom(WebappConfig config) { this.useCookies = config.isUseCookies(); - this.enableFreeFlight = config.isEnableFreeFlight(); this.defaultToFlatView = config.isDefaultToFlatView(); this.startLocation = config.getStartLocation().orElse(null); this.resolutionDefault = config.getResolutionDefault(); diff --git a/common/src/main/java/de/bluecolored/bluemap/common/config/MapConfig.java b/common/src/main/java/de/bluecolored/bluemap/common/config/MapConfig.java index 7497c641..16469aeb 100644 --- a/common/src/main/java/de/bluecolored/bluemap/common/config/MapConfig.java +++ b/common/src/main/java/de/bluecolored/bluemap/common/config/MapConfig.java @@ -75,7 +75,10 @@ public class MapConfig implements MapSettings { private boolean renderEdges = true; - private boolean saveHiresLayer = true; + private boolean enablePerspectiveView = true; + private boolean enableFlatView = true; + private boolean enableFreeFlightView = true; + private boolean enableHires = true; private String storage = "file"; diff --git a/common/src/main/java/de/bluecolored/bluemap/common/config/WebappConfig.java b/common/src/main/java/de/bluecolored/bluemap/common/config/WebappConfig.java index c61ba42d..cdb4166b 100644 --- a/common/src/main/java/de/bluecolored/bluemap/common/config/WebappConfig.java +++ b/common/src/main/java/de/bluecolored/bluemap/common/config/WebappConfig.java @@ -42,7 +42,6 @@ public class WebappConfig { private boolean useCookies = true; - private boolean enableFreeFlight = true; private boolean defaultToFlatView = false; private String startLocation = null; @@ -82,10 +81,6 @@ public boolean isUseCookies() { return useCookies; } - public boolean isEnableFreeFlight() { - return enableFreeFlight; - } - public boolean isDefaultToFlatView() { return defaultToFlatView; } diff --git a/common/src/main/resources/de/bluecolored/bluemap/config/maps/map.conf b/common/src/main/resources/de/bluecolored/bluemap/config/maps/map.conf index 176fd79e..8ba99c6d 100644 --- a/common/src/main/resources/de/bluecolored/bluemap/config/maps/map.conf +++ b/common/src/main/resources/de/bluecolored/bluemap/config/maps/map.conf @@ -96,13 +96,28 @@ min-inhabited-time: 0 # Default is true render-edges: true -# Whether the hires-layer will be saved to the storage. +# Whether the perspective view will be enabled for this map. +# Changing this to true requires a re-render of the map, only if the hires-layer is enabled and free-flight view is disabled. +# Default is true +enable-perspective-view: true + +# Whether the flat (isometric, top-down) view will be enabled for this map. +# Having only flat-view enabled while disabling free-flight and perspective will speed up the render and reduce the maps storage-size. +# Default is true +enable-flat-view: true + +# Whether the free-flight view will be enabled for this map. +# Changing this to true requires a re-render of the map, only if the hires-layer is enabled and perspective view is disabled. +# Default is true +enable-free-flight-view: true + +# Whether the hires-layer will be enabled. # Disabling this will speed up rendering and reduce the size of the map-files a lot. # But you will not be able to see the full 3d-models if you zoom in on the map. # Changing this to false will not remove any existing tiles, existing tiles just won't get updated anymore. # Changing this to true will require a re-render of the map. # Default is true -save-hires-layer: true +enable-hires: true # This defines the storage-config that will be used to save this map. # You can find your storage configs next to this config file in the 'storages'-folder. diff --git a/common/src/main/resources/de/bluecolored/bluemap/config/webapp.conf b/common/src/main/resources/de/bluecolored/bluemap/config/webapp.conf index 3f40d016..8032ef5a 100644 --- a/common/src/main/resources/de/bluecolored/bluemap/config/webapp.conf +++ b/common/src/main/resources/de/bluecolored/bluemap/config/webapp.conf @@ -22,10 +22,6 @@ update-settings-file: true # Default is true use-cookies: true -# If the free-flight-mode in the web-application is enabled or not. -# Default is true -enable-free-flight: true - # If the webapp will default to flat-view instead of perspective-view. # Default is false default-to-flat-view: false diff --git a/common/webapp/src/components/ControlBar/ControlsSwitch.vue b/common/webapp/src/components/ControlBar/ControlsSwitch.vue index 0bc4a315..756beb9c 100644 --- a/common/webapp/src/components/ControlBar/ControlsSwitch.vue +++ b/common/webapp/src/components/ControlBar/ControlsSwitch.vue @@ -1,6 +1,6 @@