Tile rendering is now mostly parallel up to 4 procs.
The initial recursive call for tile generation will spawn up to 3 extra processes to work on each quadrant. It's not perfect yet since some quadrants may have more or less work to do, and only 4 total workers are supported. Also, it waits for all chunks are finished before it dives into the tiles, to prevent it from using more resources than requested.
This commit is contained in:
7
gmap.py
7
gmap.py
@@ -35,8 +35,11 @@ def main():
|
||||
# Translate chunks from diagonal coordinate system
|
||||
mincol, maxcol, minrow, maxrow, chunks = world.convert_coords(all_chunks)
|
||||
|
||||
print "processing chunks in background"
|
||||
print "Rendering chunks"
|
||||
results = world.render_chunks_async(chunks, False, options.procs)
|
||||
for i, (col, row, filename) in enumerate(chunks):
|
||||
results[col, row].wait()
|
||||
print "{0}/{1} chunks rendered".format(i, len(chunks))
|
||||
|
||||
print "Writing out html file"
|
||||
if not os.path.exists(destdir):
|
||||
@@ -49,7 +52,7 @@ def main():
|
||||
tiledir = os.path.join(destdir, "tiles")
|
||||
if not os.path.exists(tiledir):
|
||||
os.mkdir(tiledir)
|
||||
world.generate_quadtree(results, mincol, maxcol, minrow, maxrow, tiledir)
|
||||
world.generate_quadtree(results, mincol, maxcol, minrow, maxrow, tiledir, options.procs)
|
||||
|
||||
print "DONE"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user