Merge branch 'master' into smooth-lighting
This commit is contained in:
@@ -111,7 +111,7 @@ body {
|
||||
border: 2px solid #000;
|
||||
font-size: 12pt;
|
||||
width: 20em;
|
||||
background-colour: #fff;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
#searchControl>input.inactive {
|
||||
|
||||
@@ -248,27 +248,27 @@ var overviewer = {
|
||||
overviewer.collections.mapTypes[i].name,
|
||||
overviewer.collections.mapTypes[i]);
|
||||
}
|
||||
|
||||
// Jump to the hash if given
|
||||
|
||||
// Jump to the hash if given
|
||||
overviewer.util.initHash();
|
||||
|
||||
// Add live hash update listeners
|
||||
// Note: It is important to add them after jumping to the hash
|
||||
|
||||
// Add live hash update listeners
|
||||
// Note: It is important to add them after jumping to the hash
|
||||
google.maps.event.addListener(overviewer.map, 'dragend', function() {
|
||||
overviewer.util.updateHash();
|
||||
});
|
||||
|
||||
|
||||
google.maps.event.addListener(overviewer.map, 'zoom_changed', function() {
|
||||
overviewer.util.updateHash();
|
||||
});
|
||||
|
||||
// Make the link again whenever the map changes
|
||||
|
||||
// Make the link again whenever the map changes
|
||||
google.maps.event.addListener(overviewer.map, 'maptypeid_changed', function() {
|
||||
$('#'+overviewerConfig.CONST.mapDivId).css(
|
||||
'background-color', overviewer.util.getMapTypeBackgroundColor(
|
||||
overviewer.map.getMapTypeId()));
|
||||
//smuggled this one in here for maptypeid hash generation --CounterPillow
|
||||
overviewer.util.updateHash();
|
||||
//smuggled this one in here for maptypeid hash generation --CounterPillow
|
||||
overviewer.util.updateHash();
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -843,12 +843,12 @@ var overviewer = {
|
||||
|
||||
var searchInput = document.createElement("input");
|
||||
searchInput.type = "text";
|
||||
searchInput.value = "Sign Search";
|
||||
searchInput.title = "Sign Search";
|
||||
searchInput.value = "Sign Search";
|
||||
searchInput.title = "Sign Search";
|
||||
$(searchInput).addClass("inactive");
|
||||
|
||||
/* Hey dawg, I heard you like functions.
|
||||
* So we defined a function inside your function.
|
||||
|
||||
/* Hey dawg, I heard you like functions.
|
||||
* So we defined a function inside your function.
|
||||
*/
|
||||
searchInput.onfocus = function() {
|
||||
if (searchInput.value == "Sign Search") {
|
||||
@@ -856,7 +856,7 @@ var overviewer = {
|
||||
$(searchInput).removeClass("inactive").addClass("active");
|
||||
}
|
||||
};
|
||||
searchInput.onblur = function() {
|
||||
searchInput.onblur = function() {
|
||||
if (searchInput.value == "") {
|
||||
searchInput.value = "Sign Search";
|
||||
$(searchInput).removeClass("active").addClass("inactive");
|
||||
@@ -957,8 +957,8 @@ var overviewer = {
|
||||
'initHash': function() {
|
||||
if(window.location.hash.split("/").length > 1) {
|
||||
overviewer.util.goToHash();
|
||||
// Clean up the hash.
|
||||
overviewer.util.updateHash();
|
||||
// Clean up the hash.
|
||||
overviewer.util.updateHash();
|
||||
|
||||
// Add a marker indicating the user-supplied position
|
||||
var coordinates = overviewer.util.fromLatLngToWorld(overviewer.map.getCenter().lat(), overviewer.map.getCenter().lng());
|
||||
@@ -968,7 +968,7 @@ var overviewer = {
|
||||
'y': coordinates.y,
|
||||
'z': coordinates.z,
|
||||
'type': 'querypos'}]);
|
||||
}
|
||||
}
|
||||
},
|
||||
'setHash': function(x, y, z, zoom, maptype) {
|
||||
window.location.replace("#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + maptype);
|
||||
@@ -976,7 +976,7 @@ var overviewer = {
|
||||
'updateHash': function() {
|
||||
var coordinates = overviewer.util.fromLatLngToWorld(overviewer.map.getCenter().lat(), overviewer.map.getCenter().lng());
|
||||
var zoom = overviewer.map.getZoom();
|
||||
var maptype = overviewer.map.getMapTypeId();
|
||||
var maptype = overviewer.map.getMapTypeId();
|
||||
if (zoom == overviewerConfig.map.maxZoom) {
|
||||
zoom = 'max';
|
||||
} else if (zoom == overviewerConfig.map.minZoom) {
|
||||
@@ -988,19 +988,19 @@ var overviewer = {
|
||||
overviewer.util.setHash(coordinates.x, coordinates.y, coordinates.z, zoom, maptype);
|
||||
},
|
||||
'goToHash': function() {
|
||||
// Note: the actual data begins at coords[1], coords[0] is empty.
|
||||
// Note: the actual data begins at coords[1], coords[0] is empty.
|
||||
var coords = window.location.hash.split("/");
|
||||
var latlngcoords = overviewer.util.fromWorldToLatLng(parseInt(coords[1]), parseInt(coords[2]), parseInt(coords[3]));
|
||||
var zoom;
|
||||
var maptype = '';
|
||||
// The if-statements try to prevent unexpected behaviour when using incomplete hashes, e.g. older links
|
||||
if (coords.length > 4) {
|
||||
zoom = coords[4];
|
||||
}
|
||||
if (coords.length > 5) {
|
||||
maptype = coords[5];
|
||||
}
|
||||
|
||||
var zoom;
|
||||
var maptype = '';
|
||||
// The if-statements try to prevent unexpected behaviour when using incomplete hashes, e.g. older links
|
||||
if (coords.length > 4) {
|
||||
zoom = coords[4];
|
||||
}
|
||||
if (coords.length > 5) {
|
||||
maptype = coords[5];
|
||||
}
|
||||
|
||||
if (zoom == 'max') {
|
||||
zoom = overviewerConfig.map.maxZoom;
|
||||
} else if (zoom == 'min') {
|
||||
@@ -1015,14 +1015,14 @@ var overviewer = {
|
||||
zoom = overviewerConfig.map.defaultZoom;
|
||||
}
|
||||
}
|
||||
// If the maptype isn't set, set the default one.
|
||||
if (maptype == '') {
|
||||
// We can now set the map to use the 'coordinate' map type
|
||||
overviewer.map.setMapTypeId(overviewer.util.getDefaultMapTypeId());
|
||||
} else {
|
||||
overviewer.map.setMapTypeId(maptype);
|
||||
}
|
||||
|
||||
// If the maptype isn't set, set the default one.
|
||||
if (maptype == '') {
|
||||
// We can now set the map to use the 'coordinate' map type
|
||||
overviewer.map.setMapTypeId(overviewer.util.getDefaultMapTypeId());
|
||||
} else {
|
||||
overviewer.map.setMapTypeId(maptype);
|
||||
}
|
||||
|
||||
overviewer.map.setCenter(latlngcoords);
|
||||
overviewer.map.setZoom(zoom);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
var overviewerConfig = {
|
||||
/**
|
||||
* These are things that will probably not need to be changed by the user,
|
||||
* but are there because otherwise changing them is a giant PITA.
|
||||
* These are things that will probably not need to be changed, but are there
|
||||
* because otherwise changing them is a giant PITA. If you, the user, sees
|
||||
* that its crucial for you to change these settings then the document
|
||||
* repository might be able to assist you.
|
||||
* http://docs.overviewer.org/en/latest/options/#customizing-web-assets
|
||||
*/
|
||||
'CONST': {
|
||||
/**
|
||||
* Height and width of the tiles in pixels (I think).
|
||||
* Height and width of the tiles in pixels.
|
||||
*/
|
||||
'tileSize': 384,
|
||||
/**
|
||||
@@ -88,6 +91,11 @@ var overviewerConfig = {
|
||||
'center': {spawn_coords},
|
||||
/**
|
||||
* Set this to tell browsers how long they should cache tiles in minutes.
|
||||
* Essentially if set to 0, the url for tiles will end in .png
|
||||
* if not set to 0 it will amend a number derived from the current time
|
||||
* to the end of the url, like .png?c=123456. This is a great method for
|
||||
* preventing browsers from caching the images. 0 saves bandwidth, not 0
|
||||
* prevents caching.
|
||||
*/
|
||||
'cacheMinutes': 0,
|
||||
/**
|
||||
|
||||
@@ -80,7 +80,7 @@ class QuadtreeGen(object):
|
||||
|
||||
if depth is None:
|
||||
# Determine quadtree depth (midpoint is always 0,0)
|
||||
for p in xrange(15):
|
||||
for p in xrange(64):
|
||||
# Will 2^p tiles wide and high suffice?
|
||||
|
||||
# X has twice as many chunks as tiles, then halved since this is a
|
||||
@@ -92,10 +92,12 @@ class QuadtreeGen(object):
|
||||
if xradius >= worldobj.maxcol and -xradius <= worldobj.mincol and \
|
||||
yradius >= worldobj.maxrow and -yradius <= worldobj.minrow:
|
||||
break
|
||||
|
||||
if p < 15:
|
||||
self.p = p
|
||||
else:
|
||||
raise ValueError("Your map is waaaay too big! Use the 'zoom' option in 'settings.py'.")
|
||||
raise ValueError("Your map is waaaay too big! Use the 'zoom' option in 'settings.py'. Overviewer is estimating %i zoom levels, but you probably want less." % (p,))
|
||||
|
||||
self.p = p
|
||||
else:
|
||||
self.p = depth
|
||||
xradius = 2**depth
|
||||
|
||||
@@ -108,15 +108,16 @@ class RenderNode(object):
|
||||
raise ValueError("there must be at least one quadtree to work on")
|
||||
|
||||
self.options = options
|
||||
# A list of quadtree.QuadTree objects representing each rendermode
|
||||
# requested
|
||||
self.quadtrees = quadtrees
|
||||
#List of changed tiles
|
||||
self.rendered_tiles = []
|
||||
|
||||
#bind an index value to the quadtree so we can find it again
|
||||
#and figure out which worlds are where
|
||||
i = 0
|
||||
self.worlds = []
|
||||
for q in quadtrees:
|
||||
for i, q in enumerate(quadtrees):
|
||||
q._render_index = i
|
||||
i += 1
|
||||
if q.world not in self.worlds:
|
||||
@@ -163,18 +164,23 @@ class RenderNode(object):
|
||||
else:
|
||||
pool.map_async(bool,xrange(multiprocessing.cpu_count()),1)
|
||||
|
||||
# 1 quadtree object per rendermode requested
|
||||
quadtrees = self.quadtrees
|
||||
|
||||
# do per-quadtree init
|
||||
|
||||
max_p = 0
|
||||
# Determine the total number of tiles by adding up the number of tiles
|
||||
# from each quadtree. Also find the max zoom level (max_p). Even though
|
||||
# each quadtree will always have the same zoom level, this bit of code
|
||||
# does not make that assumption.
|
||||
max_p = 0
|
||||
total = 0
|
||||
for q in quadtrees:
|
||||
total += 4**q.p
|
||||
if q.p > max_p:
|
||||
max_p = q.p
|
||||
self.max_p = max_p
|
||||
# Render the highest level of tiles from the chunks
|
||||
|
||||
# The next sections of code render the highest zoom level of tiles. The
|
||||
# section after render the other levels.
|
||||
results = collections.deque()
|
||||
complete = 0
|
||||
logging.info("Rendering highest zoom level of tiles now.")
|
||||
@@ -247,7 +253,8 @@ class RenderNode(object):
|
||||
|
||||
self.print_statusline(complete, total, 1, True)
|
||||
|
||||
# Now do the other layers
|
||||
# The highest zoom level has been rendered.
|
||||
# Now do the lower zoom levels
|
||||
for zoom in xrange(self.max_p-1, 0, -1):
|
||||
level = self.max_p - zoom + 1
|
||||
assert len(results) == 0
|
||||
@@ -295,21 +302,21 @@ class RenderNode(object):
|
||||
requested, a new task is added to the pool and a result returned.
|
||||
"""
|
||||
if batch_size < len(self.quadtrees):
|
||||
batch_size = len(self.quadtrees)
|
||||
batch_size = len(self.quadtrees)
|
||||
batch = []
|
||||
jobcount = 0
|
||||
jobcount = 0
|
||||
# roundrobin add tiles to a batch job (thus they should all roughly work on similar chunks)
|
||||
iterables = [q.get_worldtiles() for q in self.quadtrees]
|
||||
for job in roundrobin(iterables):
|
||||
# fixup so the worker knows which quadtree this is
|
||||
job[0] = job[0]._render_index
|
||||
job[0] = job[0]._render_index
|
||||
# Put this in the batch to be submited to the pool
|
||||
batch.append(job)
|
||||
jobcount += 1
|
||||
if jobcount >= batch_size:
|
||||
jobcount = 0
|
||||
jobcount = 0
|
||||
yield pool.apply_async(func=render_worldtile_batch, args= [batch])
|
||||
batch = []
|
||||
batch = []
|
||||
if jobcount > 0:
|
||||
yield pool.apply_async(func=render_worldtile_batch, args= [batch])
|
||||
|
||||
@@ -341,6 +348,7 @@ class RenderNode(object):
|
||||
|
||||
@catch_keyboardinterrupt
|
||||
def render_worldtile_batch(batch):
|
||||
# batch is a list. Each item is [quadtree_id, colstart, colend, rowstart, rowend, tilepath]
|
||||
global child_rendernode
|
||||
rendernode = child_rendernode
|
||||
count = 0
|
||||
|
||||
@@ -35,7 +35,7 @@ def _find_file(filename, mode="rb", verbose=False):
|
||||
|
||||
* the textures_path given in the config file (if present)
|
||||
* The program dir (same dir as overviewer.py)
|
||||
* The overviewer_core textures dir
|
||||
* The overviewer_core/data/textures dir
|
||||
* On Darwin, in /Applications/Minecraft
|
||||
* Inside minecraft.jar, which is looked for at these locations
|
||||
|
||||
@@ -302,9 +302,9 @@ def _build_block(top, side, blockID=None):
|
||||
composite.alpha_over(img, otherside, (12,6), otherside)
|
||||
composite.alpha_over(img, top, (0,9), top)
|
||||
else:
|
||||
composite.alpha_over(img, top, (0,0), top)
|
||||
composite.alpha_over(img, side, (0,6), side)
|
||||
composite.alpha_over(img, otherside, (12,6), otherside)
|
||||
composite.alpha_over(img, top, (0,0), top)
|
||||
|
||||
# Manually touch up 6 pixels that leave a gap because of how the
|
||||
# shearing works out. This makes the blocks perfectly tessellate-able
|
||||
|
||||
Reference in New Issue
Block a user