Added maximumheight to configuration for somewhat better nether rendering.

This commit is contained in:
FrozenCow 2011-02-13 22:33:33 +01:00
parent 9a2b9ccac0
commit f3a1d53277
4 changed files with 21 additions and 12 deletions

View File

@ -24,8 +24,10 @@ maps:
renderers: renderers:
- class: org.dynmap.kzedmap.DefaultTileRenderer - class: org.dynmap.kzedmap.DefaultTileRenderer
prefix: t prefix: t
maximumheight: 127
- class: org.dynmap.kzedmap.CaveTileRenderer - class: org.dynmap.kzedmap.CaveTileRenderer
prefix: ct prefix: ct
maximumheight: 127
web: web:
# Interval the browser should poll for updates. # Interval the browser should poll for updates.

View File

@ -15,6 +15,7 @@ import org.dynmap.debug.Debug;
public class DefaultTileRenderer implements MapTileRenderer { public class DefaultTileRenderer implements MapTileRenderer {
protected static Color translucent = new Color(0, 0, 0, 0); protected static Color translucent = new Color(0, 0, 0, 0);
private String name; private String name;
protected int maximumHeight = 127;
@Override @Override
public String getName() { public String getName() {
@ -23,6 +24,12 @@ public class DefaultTileRenderer implements MapTileRenderer {
public DefaultTileRenderer(Map<String, Object> configuration) { public DefaultTileRenderer(Map<String, Object> configuration) {
name = (String) configuration.get("prefix"); name = (String) configuration.get("prefix");
Object o = configuration.get("maximumheight");
if (o != null) {
maximumHeight = Integer.parseInt(String.valueOf(o));
if (maximumHeight > 127)
maximumHeight = 127;
}
} }
public boolean render(KzedMapTile tile, File outputFile) { public boolean render(KzedMapTile tile, File outputFile) {
@ -32,9 +39,9 @@ public class DefaultTileRenderer implements MapTileRenderer {
WritableRaster r = im.getRaster(); WritableRaster r = im.getRaster();
boolean isempty = true; boolean isempty = true;
int ix = tile.mx; int ix = KzedMap.anchorx + tile.px / 2 + tile.py / 2;
int iy = tile.my; int iy = maximumHeight;
int iz = tile.mz; int iz = KzedMap.anchorz + tile.px / 2 - tile.py / 2;
int jx, jz; int jx, jz;

View File

@ -152,11 +152,16 @@ public class KzedMap extends MapType {
public DynmapChunk[] getRequiredChunks(MapTile tile) { public DynmapChunk[] getRequiredChunks(MapTile tile) {
if (tile instanceof KzedMapTile) { if (tile instanceof KzedMapTile) {
KzedMapTile t = (KzedMapTile) tile; KzedMapTile t = (KzedMapTile) tile;
int x1 = t.mx - KzedMap.tileHeight / 2;
int x2 = t.mx + KzedMap.tileWidth / 2 + KzedMap.tileHeight / 2; int ix = KzedMap.anchorx + t.px / 2 + t.py / 2;
int iy = 127;
int iz = KzedMap.anchorz + t.px / 2 - t.py / 2;
int x1 = ix - KzedMap.tileHeight / 2;
int x2 = ix + KzedMap.tileWidth / 2 + KzedMap.tileHeight / 2;
int z1 = t.mz - KzedMap.tileHeight / 2; int z1 = iz - KzedMap.tileHeight / 2;
int z2 = t.mz + KzedMap.tileWidth / 2 + KzedMap.tileHeight / 2; int z2 = iz + KzedMap.tileWidth / 2 + KzedMap.tileHeight / 2;
int x, z; int x, z;

View File

@ -8,7 +8,6 @@ public class KzedMapTile extends MapTile {
public KzedMap map; public KzedMap map;
public MapTileRenderer renderer; public MapTileRenderer renderer;
public int px, py; public int px, py;
public int mx, my, mz;
// Hack. // Hack.
public File file = null; public File file = null;
@ -19,10 +18,6 @@ public class KzedMapTile extends MapTile {
this.renderer = renderer; this.renderer = renderer;
this.px = px; this.px = px;
this.py = py; this.py = py;
mx = KzedMap.anchorx + px / 2 + py / 2;
my = KzedMap.anchory;
mz = KzedMap.anchorz + px / 2 - py / 2;
} }
@Override @Override