cleaned up some comments
This commit is contained in:
27
world.py
27
world.py
@@ -295,13 +295,19 @@ def render_worldtile(chunkmap, colstart, colend, rowstart, rowend, oldhash):
|
||||
def get_quadtree_depth(colstart, colend, rowstart, rowend):
|
||||
"""Determines the zoom depth of a requested quadtree.
|
||||
|
||||
Return value is an integer >= 0. Higher integers mean higher resolution maps.
|
||||
Return value is an integer >= 0. Higher integers mean higher resolution
|
||||
maps. This is one less than the maximum zoom (level 0 is a single tile,
|
||||
level 1 is 2 tiles wide by 2 tiles high, etc.)
|
||||
|
||||
"""
|
||||
# Pulled out of generate_quadtree. Original comment follows:
|
||||
# This determines how many zoom levels we need to encompass the entire map.
|
||||
# We need to make sure that each recursive call splits both dimensions
|
||||
# evenly into a power of 2 tiles wide and high, so this function determines
|
||||
# how many splits to make, and generate_quadtree() uses this to adjust the
|
||||
# row and column limits so that everything splits just right.
|
||||
#
|
||||
# This first call has a special job. No matter the input, we need to
|
||||
# make sure that each recursive call splits both dimensions evenly
|
||||
# into a power of 2 tiles wide and high.
|
||||
# This comment makes more sense if you consider it inlined in its call from
|
||||
# generate_quadtree()
|
||||
# Since a single tile has 3 columns of chunks and 5 rows of chunks, this
|
||||
# split needs to be sized into the void so that it is some number of rows
|
||||
# in the form 2*2^p. And columns must be in the form 4*2^p
|
||||
@@ -324,23 +330,20 @@ def generate_quadtree(chunkmap, colstart, colend, rowstart, rowend, prefix):
|
||||
"""Base call for quadtree_recurse. This sets up the recursion and generates
|
||||
a quadtree given a chunkmap and the ranges.
|
||||
|
||||
This returns the power of 2 tiles wide and high the image is. This is one
|
||||
less than the maximum zoom (level 0 is a single tile, level 1 is 2 tiles
|
||||
wide by 2 tiles high, etc.)
|
||||
|
||||
"""
|
||||
p = get_quadtree_depth(colstart, colend, rowstart, rowend);
|
||||
colmid = (colstart + colend) // 2
|
||||
rowmid = (rowstart + rowend) // 2
|
||||
|
||||
# Modify the lower and upper bounds to be sized correctly
|
||||
# Modify the lower and upper bounds to be sized correctly. See comments in
|
||||
# get_quadtree_depth()
|
||||
colstart = colmid - 2*2**p
|
||||
colend = colmid + 2*2**p
|
||||
rowstart = rowmid - 4*2**p
|
||||
rowend = rowmid + 4*2**p
|
||||
|
||||
print " power is", p
|
||||
print " new bounds: {0},{1} {2},{3}".format(colstart, colend, rowstart, rowend)
|
||||
#print " power is", p
|
||||
#print " new bounds: {0},{1} {2},{3}".format(colstart, colend, rowstart, rowend)
|
||||
|
||||
quadtree_recurse(chunkmap, colstart, colend, rowstart, rowend, prefix, "base")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user