From 8b35f4d3b77ad8fa748393d24ae0e7eae9f068ec Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sat, 18 Jun 2011 16:05:47 -0500 Subject: [PATCH] Alter 'textured' setting for flat map to have none/smooth/dither opts --- configuration.txt | 20 ++++++++++---------- src/main/java/org/dynmap/ColorScheme.java | 6 ++++-- src/main/java/org/dynmap/flat/FlatMap.java | 15 ++++++++++++--- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/configuration.txt b/configuration.txt index c1f6bb39..ead88f0b 100644 --- a/configuration.txt +++ b/configuration.txt @@ -136,8 +136,8 @@ templates: title: "Flat" prefix: flat colorscheme: default - # The textured setting makes the flat render toning much more consistent with the other maps: set to 'false' for the original flat texture - textured: true + # The textured setting makes the flat render toning much more consistent with the other maps: set to 'none' for the original flat texture, 'smooth' for blended tile top colors, 'dither' for dither pattern + textured: smooth # # To render a world as a "night view", set shadowstrength and ambientlight # shadowstrength: 1.0 # ambientlight: 4 @@ -206,8 +206,8 @@ templates: colorscheme: default # Map background color (day or night) background: "#300806" - # The textured setting makes the flat render toning much more consistent with the other maps: set to 'false' for the original flat texture - textured: true + # The textured setting makes the flat render toning much more consistent with the other maps: set to 'none' for the original flat texture, 'smooth' for blended tile top colors, 'dither' for dither pattern + textured: smooth - class: org.dynmap.kzedmap.KzedMap renderers: - class: org.dynmap.kzedmap.DefaultTileRenderer @@ -237,8 +237,8 @@ templates: backgroundday: "#153E7E" # Background color for map during the night backgroundnight: "#000000" - # The textured setting makes the flat render toning much more consistent with the other maps: set to 'false' for the original flat texture - textured: true + # The textured setting makes the flat render toning much more consistent with the other maps: set to 'none' for the original flat texture, 'smooth' for blended tile top colors, 'dither' for dither pattern + textured: smooth - class: org.dynmap.kzedmap.KzedMap renderers: - class: org.dynmap.kzedmap.DefaultTileRenderer @@ -303,8 +303,8 @@ worlds: # title: "Flat" # prefix: flat # colorscheme: default - # # The textured setting makes the flat render toning much more consistent with the other maps: set to 'false' for the original flat texture - # textured: true + # # The textured setting makes the flat render toning much more consistent with the other maps: set to 'none' for the original flat texture, 'smooth' for blended tile top colors, 'dither' for dither pattern + # textured: smooth # # To render a world as a "night view", set shadowstrength and ambientlight # shadowstrength: 1.0 # ambientlight: 4 @@ -372,8 +372,8 @@ worlds: # title: "Flat" # prefix: flat # colorscheme: default - # # The textured setting makes the flat render toning much more consistent with the other maps: set to 'false' for the original flat texture - # textured: true + # # The textured setting makes the flat render toning much more consistent with the other maps: set to 'none' for the original flat texture, 'smooth' for blended tile top colors, 'dither' for dither pattern + # textured: smooth # - class: org.dynmap.kzedmap.KzedMap # renderers: # - class: org.dynmap.kzedmap.DefaultTileRenderer diff --git a/src/main/java/org/dynmap/ColorScheme.java b/src/main/java/org/dynmap/ColorScheme.java index 86520dbb..8b606eb6 100644 --- a/src/main/java/org/dynmap/ColorScheme.java +++ b/src/main/java/org/dynmap/ColorScheme.java @@ -69,14 +69,16 @@ public class ColorScheme { else { id = new Integer(split[0]); } - Color[] c = new Color[4]; + Color[] c = new Color[5]; /* store colors by raycast sequence number */ c[0] = new Color(Integer.parseInt(split[1]), Integer.parseInt(split[2]), Integer.parseInt(split[3]), Integer.parseInt(split[4])); c[3] = new Color(Integer.parseInt(split[5]), Integer.parseInt(split[6]), Integer.parseInt(split[7]), Integer.parseInt(split[8])); c[1] = new Color(Integer.parseInt(split[9]), Integer.parseInt(split[10]), Integer.parseInt(split[11]), Integer.parseInt(split[12])); c[2] = new Color(Integer.parseInt(split[13]), Integer.parseInt(split[14]), Integer.parseInt(split[15]), Integer.parseInt(split[16])); - + /* Blended color - for 'smooth' option on flat map */ + c[4] = new Color((c[0].getRed()+c[2].getRed())/2, (c[0].getGreen()+c[2].getGreen())/2, (c[0].getBlue()+c[2].getBlue())/2, (c[0].getAlpha()+c[2].getAlpha())/2); + if(dat != null) { Color[][] dcolor = datacolors[id]; /* Existing list? */ if(dcolor == null) { diff --git a/src/main/java/org/dynmap/flat/FlatMap.java b/src/main/java/org/dynmap/flat/FlatMap.java index 102cbee5..68e6497b 100644 --- a/src/main/java/org/dynmap/flat/FlatMap.java +++ b/src/main/java/org/dynmap/flat/FlatMap.java @@ -37,7 +37,8 @@ public class FlatMap extends MapType { private int shadowscale[] = null; private boolean night_and_day; /* If true, render both day (prefix+'-day') and night (prefix) tiles */ protected boolean transparency; - private boolean textured = false; + private enum Texture { NONE, SMOOTH, DITHER }; + private Texture textured = Texture.NONE; public FlatMap(ConfigurationNode configuration) { this.configuration = configuration; @@ -70,7 +71,13 @@ public class FlatMap extends MapType { } night_and_day = configuration.getBoolean("night-and-day", false); transparency = configuration.getBoolean("transparency", false); /* Default off */ - textured = configuration.getBoolean("textured", false); + String tex = configuration.getString("textured", "none"); + if(tex.equals("none")) + textured = Texture.NONE; + else if(tex.equals("dither")) + textured = Texture.DITHER; + else + textured = Texture.SMOOTH; } @Override @@ -176,7 +183,9 @@ public class FlatMap extends MapType { if (colors == null) continue; Color c; - if(textured && (((x+y) & 0x01) == 1)) { + if(textured == Texture.SMOOTH) + c = colors[4]; + else if((textured == Texture.DITHER) && (((x+y) & 0x01) == 1)) { c = colors[2]; } else {