diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/DefaultHDLighting.java b/DynmapCore/src/main/java/org/dynmap/hdmap/DefaultHDLighting.java index a17d4860..97cac694 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/DefaultHDLighting.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/DefaultHDLighting.java @@ -10,11 +10,26 @@ import static org.dynmap.JSONUtils.s; public class DefaultHDLighting implements HDLighting { private String name; + protected final boolean grayscale; + protected final Color graytone; public DefaultHDLighting(DynmapCore core, ConfigurationNode configuration) { name = (String) configuration.get("name"); + grayscale = configuration.getBoolean("grayscale", false); + graytone = configuration.getColor("graytone", null); } + protected void checkGrayscale(Color[] outcolor) { + if (grayscale) { + outcolor[0].setGrayscale(); + if (graytone != null) outcolor[0].blendColor(graytone); + if (outcolor.length > 1) { + outcolor[1].setGrayscale(); + if (graytone != null) outcolor[1].blendColor(graytone); + } + } + } + /* Get lighting name */ public String getName() { return name; } @@ -22,6 +37,7 @@ public class DefaultHDLighting implements HDLighting { public void applyLighting(HDPerspectiveState ps, HDShaderState ss, Color incolor, Color[] outcolor) { for(int i = 0; i < outcolor.length; i++) outcolor[i].setColor(incolor); + checkGrayscale(outcolor); } /* Test if Biome Data is needed for this renderer */ diff --git a/DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java b/DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java index 7731c825..90df1716 100644 --- a/DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java +++ b/DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java @@ -15,8 +15,6 @@ public class ShadowHDLighting extends DefaultHDLighting { protected final int lightscale[]; /* scale skylight level (light = lightscale[skylight] */ protected final boolean night_and_day; /* If true, render both day (prefix+'-day') and night (prefix) tiles */ protected final boolean smooth; - protected final boolean grayscale; - protected final Color graytone; protected final boolean useWorldBrightnessTable; public ShadowHDLighting(DynmapCore core, ConfigurationNode configuration) { @@ -46,8 +44,6 @@ public class ShadowHDLighting extends DefaultHDLighting { lightscale[i] = i - (15-v); } smooth = configuration.getBoolean("smooth-lighting", MapManager.mapman.getSmoothLighting()); - grayscale = configuration.getBoolean("grayscale", false); - graytone = configuration.getColor("graytone", null); } private void applySmoothLighting(HDPerspectiveState ps, HDShaderState ss, Color incolor, Color[] outcolor, int[] shadowscale) { @@ -219,18 +215,7 @@ public class ShadowHDLighting extends DefaultHDLighting { } return lightlevel; } - - private void checkGrayscale(Color[] outcolor) { - if (grayscale) { - outcolor[0].setGrayscale(); - if (graytone != null) outcolor[0].blendColor(graytone); - if (outcolor.length > 1) { - outcolor[1].setGrayscale(); - if (graytone != null) outcolor[1].blendColor(graytone); - } - } - } - + /* Apply lighting to given pixel colors (1 outcolor if normal, 2 if night/day) */ public void applyLighting(HDPerspectiveState ps, HDShaderState ss, Color incolor, Color[] outcolor) { int[] shadowscale = null; diff --git a/DynmapCore/src/main/resources/lightings.txt b/DynmapCore/src/main/resources/lightings.txt index b149594b..ff841405 100644 --- a/DynmapCore/src/main/resources/lightings.txt +++ b/DynmapCore/src/main/resources/lightings.txt @@ -93,11 +93,10 @@ lightings: grayscale: true graytone: '#C09A53' smooth-lighting: true - # No shadows day mode - grayscale parchment - - class: org.dynmap.hdmap.ShadowHDLighting + # Default day mode - grayscale parchment + - class: org.dynmap.hdmap.DefaultHDLighting name: parchment-noshadow grayscale: true graytone: '#C09A53' - shadowstrength: 0.0 \ No newline at end of file