Skip to content

Commit f08c794

Browse files
committed
Add setting for a default sky-light per map
1 parent 8b1c5ab commit f08c794

File tree

6 files changed

+14
-1
lines changed

6 files changed

+14
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public class MapConfig implements MapSettings {
5454
private String voidColor = "#000000";
5555

5656
private float ambientLight = 0;
57+
private float skyLight = 1;
5758

5859
private int removeCavesBelowY = 55;
5960
private int caveDetectionOceanFloor = 10000;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ sky-color: "${sky-color}"
3838
# Default is "#000000"
3939
void-color: "${void-color}"
4040

41+
# Defines the initial sky-light-strength the map will be set to when it is opened.
42+
# 0 is no sky-light, 1 is fully lighted.
43+
# You can change this at any time.
44+
# Default is 1
45+
sky-light: 1
46+
4147
# Defines the ambient light-strength that every block is receiving, regardless of the sunlight/blocklight.
4248
# 0 is no ambient light, 1 is fully lighted.
4349
# You can change this at any time.

common/webapp/src/js/MapViewer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ export class MapViewer {
413413
this.data.uniforms.skyColor.value = map.data.skyColor;
414414
this.data.uniforms.voidColor.value = map.data.voidColor;
415415
this.data.uniforms.ambientLight.value = map.data.ambientLight;
416+
this.data.uniforms.sunlightStrength.value = map.data.skyLight;
416417
this.data.uniforms.hiresTileMap.value.map = map.hiresTileManager.tileMap.texture;
417418
this.data.uniforms.hiresTileMap.value.scale.set(map.data.hires.tileSize.x, map.data.hires.tileSize.z);
418419
this.data.uniforms.hiresTileMap.value.translate.set(map.data.hires.translate.x, map.data.hires.translate.z);

common/webapp/src/js/map/Map.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export class Map {
6868
skyColor: new Color(),
6969
voidColor: new Color(0, 0, 0),
7070
ambientLight: 0,
71+
skyLight: 1,
7172
hires: {
7273
tileSize: {x: 32, z: 32},
7374
scale: {x: 1, z: 1},
@@ -181,6 +182,7 @@ export class Map {
181182
}
182183

183184
this.data.ambientLight = worldSettings.ambientLight ? worldSettings.ambientLight : this.data.ambientLight;
185+
this.data.skyLight = worldSettings.skyLight ? worldSettings.skyLight : this.data.skyLight;
184186

185187
if (worldSettings.hires === undefined) worldSettings.hires = {};
186188
if (worldSettings.lowres === undefined) worldSettings.lowres = {};

core/src/main/java/de/bluecolored/bluemap/core/map/MapSettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ public interface MapSettings extends RenderSettings {
5050

5151
int getLodFactor();
5252

53+
float getSkyLight();
54+
5355
}

core/src/main/java/de/bluecolored/bluemap/core/map/MapSettingsSerializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ public JsonElement serialize(BmMap map, Type typeOfSrc, JsonSerializationContext
7979
Color voidColor = new Color().parse(map.getMapSettings().getVoidColor());
8080
root.add("voidColor", context.serialize(voidColor));
8181

82-
// ambientLight
82+
// light
8383
root.addProperty("ambientLight", map.getMapSettings().getAmbientLight());
84+
root.addProperty("skyLight", map.getMapSettings().getSkyLight());
8485

8586
return root;
8687
}

0 commit comments

Comments
 (0)