This commit is contained in:
Lukas Rieger (Blue) 2024-09-28 11:37:44 +02:00
commit 388b4ecaac
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
6 changed files with 89 additions and 34 deletions

View File

@ -141,6 +141,9 @@ private static class Settings {
private int lowresSliderDefault = 2000;
private int lowresSliderMin = 500;
private String mapDataRoot = "maps/";
private String liveDataRoot = "maps/";
private Set<String> maps = new HashSet<>();
private Set<String> scripts = new HashSet<>();
private Set<String> styles = new HashSet<>();
@ -163,6 +166,9 @@ public void setFrom(WebappConfig config) {
this.lowresSliderDefault = config.getLowresSliderDefault();
this.lowresSliderMin = config.getLowresSliderMin();
this.mapDataRoot = config.getMapDataRoot();
this.liveDataRoot = config.getLiveDataRoot();
this.styles.clear();
this.scripts.clear();

View File

@ -60,6 +60,9 @@ public class WebappConfig {
private int lowresSliderDefault = 2000;
private int lowresSliderMin = 500;
private String mapDataRoot = "maps/";
private String liveDataRoot = "maps/";
private Set<String> scripts = new HashSet<>();
private Set<String> styles = new HashSet<>();
public boolean isEnabled() {
@ -126,6 +129,14 @@ public int getLowresSliderMin() {
return lowresSliderMin;
}
public String getMapDataRoot() {
return mapDataRoot;
}
public String getLiveDataRoot() {
return liveDataRoot;
}
public Set<String> getScripts() {
return scripts;
}

View File

@ -69,3 +69,11 @@ scripts: [
styles: [
#"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/"

View File

@ -4,26 +4,39 @@
title: "Meny"
tooltip: "Meny"
}
map: {
unloaded: "Ingen karta laddad."
loading: "Laddar karta..."
errored: "Ett fel uppstod när kartan skulle laddas!"
}
maps: {
title: "Kartor"
button: "Kartor"
tooltip: "Kart lista"
tooltip: "Kartlista"
}
markers: {
title: "Markörer"
button: "Markörer"
tooltip: "Markör lista"
tooltip: "Markörslista"
marker: "Markör | Markörer"
markerSet: "Placera markör | Palcera markör"
markerSet: "Placera markör | Placera markör"
searchPlaceholder: "Sök..."
followPlayerTitle: "Följ spelare"
sort {
title: "Sortering"
by {
default: "standard"
label: "namn"
distance: "distans"
}
}
}
settings: {
title: "Inställningar"
button: "Inställningar"
}
goFullscreen: {
button: "Sätt på helskärm"
button: "Öppna i helskärm"
}
resetCamera: {
button: "Återställ kamera"
@ -45,23 +58,33 @@
title: "Upplösning"
high: "Hög (SSAA x2)"
normal: "Normal (Ursprunglig x1)"
low: "låg (Uppskalning x0.5)"
low: "Låg (Uppskalning x0.5)"
}
mapControls: {
title: "Kartkontroller"
showZoomButtons: "Visa zoom-knappar"
}
freeFlightControls: {
title: "Kontroller för fritt flyg"
title: "Kontroller för fri flygning"
mouseSensitivity: "Muskänslighet"
invertMouseY: "Invertera mus Y"
}
renderDistance: {
title: "Renderings avstånd"
hiresLayer: "Hög upplösnings lager"
lowersLayer: "Låg upplösnings lager"
hiresLayer: "Högupplösningslager"
lowersLayer: "Lågupplösningslager"
loadHiresWhileMoving: "Ladda högupplösningslager under rörelse"
off: "Off"
}
theme: {
title: "Teman"
default: "Standard (System/Webläsare)"
default: "Standard (System/Webbläsare)"
dark: "Mörkt"
light: "Ljust"
contrast: "Kontrast"
}
chunkBorders: {
button: "Visa chunkgränser"
}
debug: {
button: "Felsökning"
@ -71,15 +94,20 @@
}
players: {
title: "Spelare"
tooltip: "Spelare lista"
tooltip: "Spelarlista"
}
compass: {
tooltip: "Kompass / Vänd mot norr"
}
screenshot: {
title: "Skärmdump"
button: "Ta en skärmdump"
clipboard: "Kopiera till urklipp"
}
controls: {
title: "Visa / kontroller"
title: "Visningsläge"
perspective: {
button: "Perspective"
button: "Perspektiv"
tooltip: "Perspektiv-vy"
}
flatView: {
@ -87,8 +115,8 @@
tooltip: "Ortografisk / platt vy"
}
freeFlight: {
button: "Fritt flyg"
tooltip: "Fritt flyg / Åskådarläge"
button: "Fri flygning"
tooltip: "Fri flygning / Åskådarläge"
}
}
language: {
@ -96,7 +124,7 @@
}
blockTooltip: {
block: "Block"
position: "Placera"
position: "Position"
chunk: "Chunk"
region: {
region: "Område"
@ -117,24 +145,24 @@
<h2>Muskontroller:</h2>
<table>
<tr><th>Styra</th><td><kbd>vänster klick</kbd> + dra</td></tr>
<tr><th>zoom</th><td><kbd>mushjul</kbd> (scroll)</td></tr>
<tr><th>rotera / luta</th><td><kbd>Höger klick</kbd> + dra</td></tr>
<tr><th>Zoom</th><td><kbd>mushjul</kbd> (scroll)</td></tr>
<tr><th>Rotera / luta</th><td><kbd>Höger klick</kbd> + dra</td></tr>
</table>
</p>
<p>
<h2>Tangentbordskontroller:</h2>
<table>
<tr><th>Styra</th><td><kbd>wasd</kbd> / <kbd>piltangenter</kbd></td></tr>
<tr><th>zoom</th><td><kbd>+</kbd>/<kbd>-</kbd> eller <kbd>Ins</kbd>/<kbd>Home</kbd></td></tr>
<tr><th>rotera / luta</th><td><kbd>Vänster-Alt</kbd> + <kbd>wasd</kbd> / <kbd>piltangenter</kbd> eller <kbd>Delete</kbd>/<kbd>End</kbd>/<kbd>Page Up</kbd>/<kbd>Page Down</kbd></td></tr>
<tr><th>Zoom</th><td><kbd>+</kbd>/<kbd>-</kbd> eller <kbd>Ins</kbd>/<kbd>Home</kbd></td></tr>
<tr><th>Rotera / luta</th><td><kbd>Vänster-Alt</kbd> + <kbd>wasd</kbd> / <kbd>piltangenter</kbd> eller <kbd>Delete</kbd>/<kbd>End</kbd>/<kbd>Page Up</kbd>/<kbd>Page Down</kbd></td></tr>
</table>
</p>
<p>
<h2>Pekkontroller:</h2>
<table>
<tr><th>Styra</th><td>rör + dra</td></tr>
<tr><th>zoom</th><td>rör med två fingrar + nypa</td></tr>
<tr><th>rotera / luta</th><td>rör med två fingrar + rotera / flytta upp / ner</td></tr>
<tr><th>Zoom</th><td>rör med två fingrar + nypa</td></tr>
<tr><th>Rotera / luta</th><td>rör med två fingrar + rotera / flytta upp / ner</td></tr>
</table>
</p>
<br><hr>

View File

@ -71,6 +71,8 @@ export class BlueMapApp {
* lowresSliderDefault: number,
* lowresSliderMin: number,
* startLocation: string,
* mapDataRoot: string,
* liveDataRoot: string,
* maps: string[],
* scripts: string[],
* styles: string[]
@ -86,8 +88,6 @@ export class BlueMapApp {
this.lastCameraMove = 0;
this.dataUrl = "maps/";
this.mainMenu = reactive(new MainMenu());
this.appState = reactive({
@ -300,7 +300,7 @@ export class BlueMapApp {
// create maps
if (settings.maps !== undefined){
let loadingPromises = settings.maps.map(mapId => {
let map = new BlueMapMap(mapId, this.dataUrl + 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);
return map.loadSettings(this.mapViewer.tileCacheHash)
@ -353,7 +353,7 @@ export class BlueMapApp {
return new Promise((resolve, reject) => {
let loader = new FileLoader();
loader.setResponseType("json");
loader.load(map.data.dataUrl + "live/players.json?" + generateCacheHash(),
loader.load(map.data.liveDataRoot + "live/players.json?" + generateCacheHash(),
fileData => {
if (!fileData) reject(`Failed to parse '${this.fileUrl}'!`);
else resolve(fileData);
@ -371,7 +371,7 @@ export class BlueMapApp {
const map = this.mapViewer.map;
if (!map) return;
this.playerMarkerManager = new PlayerMarkerManager(this.mapViewer.markers, map.data.dataUrl + "live/players.json", map.data.dataUrl + "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);
return this.playerMarkerManager.update()
.then(() => {
@ -390,7 +390,7 @@ export class BlueMapApp {
const map = this.mapViewer.map;
if (!map) return;
this.markerFileManager = new NormalMarkerManager(this.mapViewer.markers, map.data.dataUrl + "live/markers.json", this.events);
this.markerFileManager = new NormalMarkerManager(this.mapViewer.markers, map.data.liveDataRoot + "live/markers.json", this.events);
return this.markerFileManager.update()
.then(() => {
this.markerFileManager.setAutoUpdateInterval(1000 * 10);

View File

@ -45,11 +45,12 @@ export class Map {
/**
* @param id {string}
* @param dataUrl {string}
* @param mapDataRoot {string}
* @param liveDataRoot {string}
* @param loadBlocker {function: Promise<void>}
* @param events {EventTarget}
*/
constructor(id, dataUrl, loadBlocker, events = null) {
constructor(id, mapDataRoot, liveDataRoot, loadBlocker, events = null) {
Object.defineProperty( this, 'isMap', { value: true } );
this.loadBlocker = loadBlocker;
@ -58,9 +59,10 @@ export class Map {
this.data = reactive({
id: id,
sorting: 1000000,
dataUrl: dataUrl,
settingsUrl: dataUrl + "settings.json",
texturesUrl: dataUrl + "textures.json",
mapDataRoot: mapDataRoot,
liveDataRoot: liveDataRoot,
settingsUrl: mapDataRoot + "settings.json",
texturesUrl: mapDataRoot + "textures.json",
name: id,
startPos: {x: 0, z: 0},
skyColor: new Color(),
@ -121,12 +123,12 @@ export class Map {
this.hiresMaterial = this.createHiresMaterial(hiresVertexShader, hiresFragmentShader, uniforms, textures);
this.hiresTileManager = new TileManager(new TileLoader(`${this.data.dataUrl}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.lowresTileManager = [];
for (let i = 0; i < this.data.lowres.lodCount; i++) {
this.lowresTileManager[i] = new TileManager(new LowresTileLoader(`${this.data.dataUrl}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;
}