mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-27 20:58:40 +01:00
Provide grayscale and graytone in default lighting
This commit is contained in:
parent
2c3adfb451
commit
28f2935fc5
@ -10,11 +10,26 @@ import static org.dynmap.JSONUtils.s;
|
|||||||
|
|
||||||
public class DefaultHDLighting implements HDLighting {
|
public class DefaultHDLighting implements HDLighting {
|
||||||
private String name;
|
private String name;
|
||||||
|
protected final boolean grayscale;
|
||||||
|
protected final Color graytone;
|
||||||
|
|
||||||
public DefaultHDLighting(DynmapCore core, ConfigurationNode configuration) {
|
public DefaultHDLighting(DynmapCore core, ConfigurationNode configuration) {
|
||||||
name = (String) configuration.get("name");
|
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 */
|
/* Get lighting name */
|
||||||
public String getName() { return 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) {
|
public void applyLighting(HDPerspectiveState ps, HDShaderState ss, Color incolor, Color[] outcolor) {
|
||||||
for(int i = 0; i < outcolor.length; i++)
|
for(int i = 0; i < outcolor.length; i++)
|
||||||
outcolor[i].setColor(incolor);
|
outcolor[i].setColor(incolor);
|
||||||
|
checkGrayscale(outcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test if Biome Data is needed for this renderer */
|
/* Test if Biome Data is needed for this renderer */
|
||||||
|
@ -15,8 +15,6 @@ public class ShadowHDLighting extends DefaultHDLighting {
|
|||||||
protected final int lightscale[]; /* scale skylight level (light = lightscale[skylight] */
|
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 night_and_day; /* If true, render both day (prefix+'-day') and night (prefix) tiles */
|
||||||
protected final boolean smooth;
|
protected final boolean smooth;
|
||||||
protected final boolean grayscale;
|
|
||||||
protected final Color graytone;
|
|
||||||
protected final boolean useWorldBrightnessTable;
|
protected final boolean useWorldBrightnessTable;
|
||||||
|
|
||||||
public ShadowHDLighting(DynmapCore core, ConfigurationNode configuration) {
|
public ShadowHDLighting(DynmapCore core, ConfigurationNode configuration) {
|
||||||
@ -46,8 +44,6 @@ public class ShadowHDLighting extends DefaultHDLighting {
|
|||||||
lightscale[i] = i - (15-v);
|
lightscale[i] = i - (15-v);
|
||||||
}
|
}
|
||||||
smooth = configuration.getBoolean("smooth-lighting", MapManager.mapman.getSmoothLighting());
|
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) {
|
private void applySmoothLighting(HDPerspectiveState ps, HDShaderState ss, Color incolor, Color[] outcolor, int[] shadowscale) {
|
||||||
@ -219,18 +215,7 @@ public class ShadowHDLighting extends DefaultHDLighting {
|
|||||||
}
|
}
|
||||||
return lightlevel;
|
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) */
|
/* 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) {
|
public void applyLighting(HDPerspectiveState ps, HDShaderState ss, Color incolor, Color[] outcolor) {
|
||||||
int[] shadowscale = null;
|
int[] shadowscale = null;
|
||||||
|
@ -93,11 +93,10 @@ lightings:
|
|||||||
grayscale: true
|
grayscale: true
|
||||||
graytone: '#C09A53'
|
graytone: '#C09A53'
|
||||||
smooth-lighting: true
|
smooth-lighting: true
|
||||||
# No shadows day mode - grayscale parchment
|
# Default day mode - grayscale parchment
|
||||||
- class: org.dynmap.hdmap.ShadowHDLighting
|
- class: org.dynmap.hdmap.DefaultHDLighting
|
||||||
name: parchment-noshadow
|
name: parchment-noshadow
|
||||||
grayscale: true
|
grayscale: true
|
||||||
graytone: '#C09A53'
|
graytone: '#C09A53'
|
||||||
shadowstrength: 0.0
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user