mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
Add webapp defaults for webapp-settings.json and tweak config a small bit
This commit is contained in:
parent
388b4ecaac
commit
aa584f60aa
@ -141,8 +141,8 @@ private static class Settings {
|
|||||||
private int lowresSliderDefault = 2000;
|
private int lowresSliderDefault = 2000;
|
||||||
private int lowresSliderMin = 500;
|
private int lowresSliderMin = 500;
|
||||||
|
|
||||||
private String mapDataRoot = "maps/";
|
private String mapDataRoot = "maps";
|
||||||
private String liveDataRoot = "maps/";
|
private String liveDataRoot = "maps";
|
||||||
|
|
||||||
private Set<String> maps = new HashSet<>();
|
private Set<String> maps = new HashSet<>();
|
||||||
private Set<String> scripts = new HashSet<>();
|
private Set<String> scripts = new HashSet<>();
|
||||||
|
@ -60,11 +60,12 @@ public class WebappConfig {
|
|||||||
private int lowresSliderDefault = 2000;
|
private int lowresSliderDefault = 2000;
|
||||||
private int lowresSliderMin = 500;
|
private int lowresSliderMin = 500;
|
||||||
|
|
||||||
private String mapDataRoot = "maps/";
|
private String mapDataRoot = "maps";
|
||||||
private String liveDataRoot = "maps/";
|
private String liveDataRoot = "maps";
|
||||||
|
|
||||||
private Set<String> scripts = new HashSet<>();
|
private Set<String> scripts = new HashSet<>();
|
||||||
private Set<String> styles = new HashSet<>();
|
private Set<String> styles = new HashSet<>();
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,14 @@ lowres-slider-max: 7000
|
|||||||
lowres-slider-default: 2000
|
lowres-slider-default: 2000
|
||||||
lowres-slider-min: 500
|
lowres-slider-min: 500
|
||||||
|
|
||||||
|
# Here you can specify an alternative base url from where all map data is loaded.
|
||||||
|
# Default is "maps"
|
||||||
|
#map-data-root: "https://cdn.my-domain.com/mapdata/"
|
||||||
|
|
||||||
|
# Here you can specify an alternative base url from where all live data is loaded.
|
||||||
|
# Default is "maps"
|
||||||
|
#live-data-root: "https://cdn.my-domain.com/livedata/"
|
||||||
|
|
||||||
# Here you can add URLs to custom scripts (js) so they will be loaded by the webapp
|
# Here you can add URLs to custom scripts (js) so they will be loaded by the webapp
|
||||||
# You can place them somewhere in bluemap's webroot and add the (relative) link here
|
# You can place them somewhere in bluemap's webroot and add the (relative) link here
|
||||||
scripts: [
|
scripts: [
|
||||||
@ -69,11 +77,3 @@ scripts: [
|
|||||||
styles: [
|
styles: [
|
||||||
#"css/my-custom-style.css"
|
#"css/my-custom-style.css"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Here you can specify an alternative base url from where all map data is loaded.
|
|
||||||
# Default is "maps/"
|
|
||||||
#map-data-root: "https://cdn.my-domain.com/mapdata/"
|
|
||||||
|
|
||||||
# Here you can specify an alternative base url from where all live data is loaded.
|
|
||||||
# Default is "maps/"
|
|
||||||
#live-data-root: "https://cdn.my-domain.com/livedata/"
|
|
||||||
|
@ -300,7 +300,7 @@ export class BlueMapApp {
|
|||||||
// create maps
|
// create maps
|
||||||
if (settings.maps !== undefined){
|
if (settings.maps !== undefined){
|
||||||
let loadingPromises = settings.maps.map(mapId => {
|
let loadingPromises = settings.maps.map(mapId => {
|
||||||
let map = new BlueMapMap(mapId, settings.mapDataRoot + mapId + "/", settings.liveDataRoot + mapId + "/", this.loadBlocker, this.mapViewer.events);
|
let map = new BlueMapMap(mapId, settings.mapDataRoot + "/" + mapId + "/", settings.liveDataRoot + "/" + mapId + "/", this.loadBlocker, this.mapViewer.events);
|
||||||
maps.push(map);
|
maps.push(map);
|
||||||
|
|
||||||
return map.loadSettings(this.mapViewer.tileCacheHash)
|
return map.loadSettings(this.mapViewer.tileCacheHash)
|
||||||
@ -324,7 +324,32 @@ export class BlueMapApp {
|
|||||||
|
|
||||||
async getSettings() {
|
async getSettings() {
|
||||||
if (!this.settings){
|
if (!this.settings){
|
||||||
this.settings = await this.loadSettings();
|
let loaded = await this.loadSettings();
|
||||||
|
this.settings = {
|
||||||
|
version: "?",
|
||||||
|
useCookies: false,
|
||||||
|
enableFreeFlight: true,
|
||||||
|
defaultToFlatView: false,
|
||||||
|
resolutionDefault: 1.0,
|
||||||
|
minZoomDistance: 5,
|
||||||
|
maxZoomDistance: 100000,
|
||||||
|
hiresSliderMax: 500,
|
||||||
|
hiresSliderDefault: 100,
|
||||||
|
hiresSliderMin: 0,
|
||||||
|
lowresSliderMax: 7000,
|
||||||
|
lowresSliderDefault: 2000,
|
||||||
|
lowresSliderMin: 500,
|
||||||
|
mapDataRoot: "maps",
|
||||||
|
liveDataRoot: "maps",
|
||||||
|
maps: [
|
||||||
|
"world",
|
||||||
|
"world_the_end",
|
||||||
|
"world_nether"
|
||||||
|
],
|
||||||
|
scripts: [],
|
||||||
|
styles: [],
|
||||||
|
...loaded
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.settings;
|
return this.settings;
|
||||||
@ -353,7 +378,7 @@ export class BlueMapApp {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let loader = new FileLoader();
|
let loader = new FileLoader();
|
||||||
loader.setResponseType("json");
|
loader.setResponseType("json");
|
||||||
loader.load(map.data.liveDataRoot + "live/players.json?" + generateCacheHash(),
|
loader.load(map.data.liveDataRoot + "/live/players.json?" + generateCacheHash(),
|
||||||
fileData => {
|
fileData => {
|
||||||
if (!fileData) reject(`Failed to parse '${this.fileUrl}'!`);
|
if (!fileData) reject(`Failed to parse '${this.fileUrl}'!`);
|
||||||
else resolve(fileData);
|
else resolve(fileData);
|
||||||
@ -371,7 +396,7 @@ export class BlueMapApp {
|
|||||||
const map = this.mapViewer.map;
|
const map = this.mapViewer.map;
|
||||||
if (!map) return;
|
if (!map) return;
|
||||||
|
|
||||||
this.playerMarkerManager = new PlayerMarkerManager(this.mapViewer.markers, map.data.liveDataRoot + "live/players.json", map.data.mapDataRoot + "assets/playerheads/", this.events);
|
this.playerMarkerManager = new PlayerMarkerManager(this.mapViewer.markers, map.data.liveDataRoot + "/live/players.json", map.data.mapDataRoot + "assets/playerheads/", this.events);
|
||||||
this.playerMarkerManager.setAutoUpdateInterval(0);
|
this.playerMarkerManager.setAutoUpdateInterval(0);
|
||||||
return this.playerMarkerManager.update()
|
return this.playerMarkerManager.update()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -390,7 +415,7 @@ export class BlueMapApp {
|
|||||||
const map = this.mapViewer.map;
|
const map = this.mapViewer.map;
|
||||||
if (!map) return;
|
if (!map) return;
|
||||||
|
|
||||||
this.markerFileManager = new NormalMarkerManager(this.mapViewer.markers, map.data.liveDataRoot + "live/markers.json", this.events);
|
this.markerFileManager = new NormalMarkerManager(this.mapViewer.markers, map.data.liveDataRoot + "/live/markers.json", this.events);
|
||||||
return this.markerFileManager.update()
|
return this.markerFileManager.update()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.markerFileManager.setAutoUpdateInterval(1000 * 10);
|
this.markerFileManager.setAutoUpdateInterval(1000 * 10);
|
||||||
|
@ -123,12 +123,12 @@ export class Map {
|
|||||||
|
|
||||||
this.hiresMaterial = this.createHiresMaterial(hiresVertexShader, hiresFragmentShader, uniforms, textures);
|
this.hiresMaterial = this.createHiresMaterial(hiresVertexShader, hiresFragmentShader, uniforms, textures);
|
||||||
|
|
||||||
this.hiresTileManager = new TileManager(new TileLoader(`${this.data.mapDataRoot}tiles/0/`, this.hiresMaterial, this.data.hires, this.loadBlocker, tileCacheHash), this.onTileLoad("hires"), this.onTileUnload("hires"), this.events);
|
this.hiresTileManager = new TileManager(new TileLoader(`${this.data.mapDataRoot}/tiles/0/`, this.hiresMaterial, this.data.hires, this.loadBlocker, tileCacheHash), this.onTileLoad("hires"), this.onTileUnload("hires"), this.events);
|
||||||
this.hiresTileManager.scene.matrixWorldAutoUpdate = false;
|
this.hiresTileManager.scene.matrixWorldAutoUpdate = false;
|
||||||
|
|
||||||
this.lowresTileManager = [];
|
this.lowresTileManager = [];
|
||||||
for (let i = 0; i < this.data.lowres.lodCount; i++) {
|
for (let i = 0; i < this.data.lowres.lodCount; i++) {
|
||||||
this.lowresTileManager[i] = new TileManager(new LowresTileLoader(`${this.data.mapDataRoot}tiles/`, this.data.lowres, i + 1, lowresVertexShader, lowresFragmentShader, uniforms, async () => {}, tileCacheHash), this.onTileLoad("lowres"), this.onTileUnload("lowres"), this.events);
|
this.lowresTileManager[i] = new TileManager(new LowresTileLoader(`${this.data.mapDataRoot}/tiles/`, this.data.lowres, i + 1, lowresVertexShader, lowresFragmentShader, uniforms, async () => {}, tileCacheHash), this.onTileLoad("lowres"), this.onTileUnload("lowres"), this.events);
|
||||||
this.lowresTileManager[i].scene.matrixWorldAutoUpdate = false;
|
this.lowresTileManager[i].scene.matrixWorldAutoUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user