Add support for single map render via /dynmap fullrender world:map, /dynmap radiusrender radius mapname

This commit is contained in:
Mike Primm 2011-08-13 11:47:11 +08:00 committed by mikeprimm
parent b800984e3f
commit 4316e1f3e4
11 changed files with 60 additions and 29 deletions

View file

@ -119,7 +119,7 @@ public class HDMapManager {
/**
* Initialize shader states for all shaders for given tile
*/
public HDShaderState[] getShaderStateForTile(HDMapTile tile, MapChunkCache cache, MapIterator mapiter) {
public HDShaderState[] getShaderStateForTile(HDMapTile tile, MapChunkCache cache, MapIterator mapiter, String mapname) {
DynmapWorld w = MapManager.mapman.worldsLookup.get(tile.getWorld().getName());
if(w == null) return new HDShaderState[0];
ArrayList<HDShaderState> shaders = new ArrayList<HDShaderState>();
@ -127,6 +127,9 @@ public class HDMapManager {
if(map instanceof HDMap) {
HDMap hdmap = (HDMap)map;
if(hdmap.getPerspective() == tile.perspective) {
/* If limited to one map, and this isn't it, skip */
if((mapname != null) && (!hdmap.getName().equals(mapname)))
continue;
shaders.add(hdmap.getShader().getStateInstance(hdmap, cache, mapiter));
}
}

View file

@ -76,8 +76,8 @@ public class HDMapTile extends MapTile {
@Override
public boolean isBlockTypeDataNeeded() { return MapManager.mapman.hdmapman.isBlockTypeDataNeeded(this); }
public boolean render(MapChunkCache cache) {
return perspective.render(cache, this);
public boolean render(MapChunkCache cache, String mapname) {
return perspective.render(cache, this, mapname);
}
public List<DynmapChunk> getRequiredChunks() {

View file

@ -18,7 +18,7 @@ public interface HDPerspective {
/* Get chunks needed for given tile */
List<DynmapChunk> getRequiredChunks(MapTile tile);
/* Render given tile */
boolean render(MapChunkCache cache, HDMapTile tile);
boolean render(MapChunkCache cache, HDMapTile tile, String mapname);
public boolean isBiomeDataNeeded();
public boolean isHightestBlockYDataNeeded();

View file

@ -888,11 +888,11 @@ public class IsoHDPerspective implements HDPerspective {
}
@Override
public boolean render(MapChunkCache cache, HDMapTile tile) {
public boolean render(MapChunkCache cache, HDMapTile tile, String mapname) {
Color rslt = new Color();
MapIterator mapiter = cache.getIterator(0, 0, 0);
/* Build shader state object for each shader */
HDShaderState[] shaderstate = MapManager.mapman.hdmapman.getShaderStateForTile(tile, cache, mapiter);
HDShaderState[] shaderstate = MapManager.mapman.hdmapman.getShaderStateForTile(tile, cache, mapiter, mapname);
int numshaders = shaderstate.length;
if(numshaders == 0)
return false;