mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 21:25:46 +01:00
Clean up HDMap dither, fix tile update events
This commit is contained in:
parent
ee8718d083
commit
4f73d2cbd6
@ -188,6 +188,7 @@ public class MapManager {
|
||||
found.clear();
|
||||
rendered.clear();
|
||||
rendercnt = 0;
|
||||
timeaccum = 0;
|
||||
map_index++; /* Next map */
|
||||
if(map_index >= world.maps.size()) { /* Last one done? */
|
||||
sender.sendMessage("Full render of '" + world.world.getName() + "' finished.");
|
||||
|
@ -16,6 +16,7 @@ import org.dynmap.kzedmap.KzedMapTile;
|
||||
import org.dynmap.kzedmap.DefaultTileRenderer.BiomeColorOption;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.Vector3D;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
public class DefaultHDShader implements HDShader {
|
||||
@ -103,11 +104,11 @@ public class DefaultHDShader implements HDShader {
|
||||
/**
|
||||
* Reset renderer state for new ray
|
||||
*/
|
||||
public void reset(int x, int y) {
|
||||
public void reset(int x, int y, Vector3D raystart, double scale) {
|
||||
color.setTransparent();
|
||||
if(daycolor != null)
|
||||
daycolor.setTransparent();
|
||||
pixelodd = x ^ y;
|
||||
pixelodd = (x & 0x3) + (y<<1);
|
||||
}
|
||||
protected Color[] getBlockColors(int blocktype, int blockdata) {
|
||||
if((blockdata != 0) && (colorScheme.datacolors[blocktype] != null))
|
||||
@ -136,10 +137,10 @@ public class DefaultHDShader implements HDShader {
|
||||
seq = 1;
|
||||
else if((laststep == BlockStep.Z_PLUS) || (laststep == BlockStep.Z_MINUS))
|
||||
seq = 3;
|
||||
else if(((mapiter.getX() ^ mapiter.getZ() ^ pixelodd) & 0x01) == 0)
|
||||
seq = 0;
|
||||
else
|
||||
else if(((pixelodd + mapiter.getY()) & 0x03) == 0)
|
||||
seq = 2;
|
||||
else
|
||||
seq = 0;
|
||||
|
||||
Color c = colors[seq];
|
||||
if (c.getAlpha() > 0) {
|
||||
|
@ -373,7 +373,7 @@ public class HDMap extends MapType {
|
||||
map_to_world.transform(top); /* Transform to world coordinates */
|
||||
map_to_world.transform(bottom);
|
||||
for(int i = 0; i < shaders.length; i++) {
|
||||
shaderstate[i].reset(x, y);
|
||||
shaderstate[i].reset(x, y, top, scale);
|
||||
}
|
||||
raytrace(cache, mapiter, top, bottom, shaderstate, shaderdone);
|
||||
for(int i = 0; i < shaders.length; i++) {
|
||||
@ -402,7 +402,8 @@ public class HDMap extends MapType {
|
||||
boolean tile_update = false;
|
||||
String shadername = shaders[i].getName();
|
||||
if(rendered[i]) {
|
||||
File f = new File(t.getDynmapWorld().worldtilepath, t.getFilename(shadername));
|
||||
String fname = t.getFilename(shadername);
|
||||
File f = new File(t.getDynmapWorld().worldtilepath, fname);
|
||||
FileLockManager.getWriteLock(f);
|
||||
try {
|
||||
if((!f.exists()) || (crc != hashman.getImageHashCode(tile.getKey(), shadername, t.tx, t.ty))) {
|
||||
@ -417,7 +418,7 @@ public class HDMap extends MapType {
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + f.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(f.getPath()));
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(fname));
|
||||
hashman.updateHashCode(tile.getKey(), shadername, t.tx, t.ty, crc);
|
||||
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
||||
tile_update = true;
|
||||
@ -433,7 +434,8 @@ public class HDMap extends MapType {
|
||||
MapManager.mapman.updateStatistics(tile, shadername, true, tile_update, !rendered[i]);
|
||||
/* Handle day image, if needed */
|
||||
if(dayim[i] != null) {
|
||||
f = new File(t.getDynmapWorld().worldtilepath, t.getDayFilename(shadername));
|
||||
fname = t.getDayFilename(shadername);
|
||||
f = new File(t.getDynmapWorld().worldtilepath, fname);
|
||||
FileLockManager.getWriteLock(f);
|
||||
shadername = shadername+"_day";
|
||||
tile_update = false;
|
||||
@ -450,7 +452,7 @@ public class HDMap extends MapType {
|
||||
} catch (java.lang.NullPointerException e) {
|
||||
Debug.error("Failed to save image (NullPointerException): " + f.getPath(), e);
|
||||
}
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(f.getPath()));
|
||||
MapManager.mapman.pushUpdate(tile.getWorld(), new Client.Tile(fname));
|
||||
hashman.updateHashCode(tile.getKey(), shadername, t.tx, t.ty, crc);
|
||||
tile.getDynmapWorld().enqueueZoomOutUpdate(f);
|
||||
tile_update = true;
|
||||
|
@ -1,8 +1,7 @@
|
||||
package org.dynmap.hdmap;
|
||||
|
||||
import org.dynmap.Color;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.Vector3D;
|
||||
|
||||
/**
|
||||
* This interface is used to define the operational state of a renderer during raytracing
|
||||
@ -12,7 +11,7 @@ public interface HDShaderState {
|
||||
/**
|
||||
* Reset renderer state for new ray - passes in pixel coordinate for ray
|
||||
*/
|
||||
void reset(int x, int y);
|
||||
void reset(int x, int y, Vector3D raystart, double scale);
|
||||
/**
|
||||
* Process next ray step - called for each block on route
|
||||
* @param blocktype - block type of current block
|
||||
|
Loading…
Reference in New Issue
Block a user