Add setting for a default sky-light per map

This commit is contained in:
Lukas Rieger (Blue) 2024-11-12 20:59:26 +01:00
parent 8b1c5ab3c2
commit f08c7946a0
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
6 changed files with 14 additions and 1 deletions

View File

@ -54,6 +54,7 @@ public class MapConfig implements MapSettings {
private String voidColor = "#000000"; private String voidColor = "#000000";
private float ambientLight = 0; private float ambientLight = 0;
private float skyLight = 1;
private int removeCavesBelowY = 55; private int removeCavesBelowY = 55;
private int caveDetectionOceanFloor = 10000; private int caveDetectionOceanFloor = 10000;

View File

@ -38,6 +38,12 @@ sky-color: "${sky-color}"
# Default is "#000000" # Default is "#000000"
void-color: "${void-color}" void-color: "${void-color}"
# Defines the initial sky-light-strength the map will be set to when it is opened.
# 0 is no sky-light, 1 is fully lighted.
# You can change this at any time.
# Default is 1
sky-light: 1
# Defines the ambient light-strength that every block is receiving, regardless of the sunlight/blocklight. # Defines the ambient light-strength that every block is receiving, regardless of the sunlight/blocklight.
# 0 is no ambient light, 1 is fully lighted. # 0 is no ambient light, 1 is fully lighted.
# You can change this at any time. # You can change this at any time.

View File

@ -413,6 +413,7 @@ export class MapViewer {
this.data.uniforms.skyColor.value = map.data.skyColor; this.data.uniforms.skyColor.value = map.data.skyColor;
this.data.uniforms.voidColor.value = map.data.voidColor; this.data.uniforms.voidColor.value = map.data.voidColor;
this.data.uniforms.ambientLight.value = map.data.ambientLight; this.data.uniforms.ambientLight.value = map.data.ambientLight;
this.data.uniforms.sunlightStrength.value = map.data.skyLight;
this.data.uniforms.hiresTileMap.value.map = map.hiresTileManager.tileMap.texture; this.data.uniforms.hiresTileMap.value.map = map.hiresTileManager.tileMap.texture;
this.data.uniforms.hiresTileMap.value.scale.set(map.data.hires.tileSize.x, map.data.hires.tileSize.z); this.data.uniforms.hiresTileMap.value.scale.set(map.data.hires.tileSize.x, map.data.hires.tileSize.z);
this.data.uniforms.hiresTileMap.value.translate.set(map.data.hires.translate.x, map.data.hires.translate.z); this.data.uniforms.hiresTileMap.value.translate.set(map.data.hires.translate.x, map.data.hires.translate.z);

View File

@ -68,6 +68,7 @@ export class Map {
skyColor: new Color(), skyColor: new Color(),
voidColor: new Color(0, 0, 0), voidColor: new Color(0, 0, 0),
ambientLight: 0, ambientLight: 0,
skyLight: 1,
hires: { hires: {
tileSize: {x: 32, z: 32}, tileSize: {x: 32, z: 32},
scale: {x: 1, z: 1}, scale: {x: 1, z: 1},
@ -181,6 +182,7 @@ export class Map {
} }
this.data.ambientLight = worldSettings.ambientLight ? worldSettings.ambientLight : this.data.ambientLight; this.data.ambientLight = worldSettings.ambientLight ? worldSettings.ambientLight : this.data.ambientLight;
this.data.skyLight = worldSettings.skyLight ? worldSettings.skyLight : this.data.skyLight;
if (worldSettings.hires === undefined) worldSettings.hires = {}; if (worldSettings.hires === undefined) worldSettings.hires = {};
if (worldSettings.lowres === undefined) worldSettings.lowres = {}; if (worldSettings.lowres === undefined) worldSettings.lowres = {};

View File

@ -50,4 +50,6 @@ public interface MapSettings extends RenderSettings {
int getLodFactor(); int getLodFactor();
float getSkyLight();
} }

View File

@ -79,8 +79,9 @@ public JsonElement serialize(BmMap map, Type typeOfSrc, JsonSerializationContext
Color voidColor = new Color().parse(map.getMapSettings().getVoidColor()); Color voidColor = new Color().parse(map.getMapSettings().getVoidColor());
root.add("voidColor", context.serialize(voidColor)); root.add("voidColor", context.serialize(voidColor));
// ambientLight // light
root.addProperty("ambientLight", map.getMapSettings().getAmbientLight()); root.addProperty("ambientLight", map.getMapSettings().getAmbientLight());
root.addProperty("skyLight", map.getMapSettings().getSkyLight());
return root; return root;
} }