fixed chunk double-render bug and artifacts at the top of each tile
This commit is contained in:
10
chunk.py
10
chunk.py
@@ -575,13 +575,15 @@ class ChunkRenderer(object):
|
||||
img = Image.new("RGBA", (384, 1728), (38,92,255,0))
|
||||
|
||||
for x,y,z,imgx,imgy in iterate_chunkblocks(xoff,yoff):
|
||||
blockid = blocks[x,y,z]
|
||||
|
||||
if imgx > img.size[0] + 12 or imgx < -12:
|
||||
# make sure we're drawing within the image boundaries
|
||||
# 24 == approximate width, height of one block
|
||||
if imgx >= img.size[0] + 24 or imgx <= -24:
|
||||
continue
|
||||
if imgy > img.size[1] + 12 or imgy < -12:
|
||||
if imgy >= img.size[1] + 24 or imgy <= -24:
|
||||
continue
|
||||
|
||||
blockid = blocks[x,y,z]
|
||||
|
||||
# the following blocks don't have textures that can be pre-computed from the blockid
|
||||
# alone. additional data is required.
|
||||
# TODO torches, redstone torches, crops, ladders, stairs,
|
||||
|
||||
10
quadtree.py
10
quadtree.py
@@ -430,6 +430,12 @@ class QuadtreeGen(object):
|
||||
chunklist = []
|
||||
for row in xrange(rowstart-16, rowend+1):
|
||||
for col in xrange(colstart, colend+1):
|
||||
# due to how chunks are arranged, we can only allow
|
||||
# even row, even column or odd row, odd column
|
||||
# otherwise, you end up with duplicates!
|
||||
if row % 2 != col % 2:
|
||||
continue
|
||||
|
||||
# return (col, row, chunkx, chunky, regionpath)
|
||||
chunkx, chunky = self.world.unconvert_coords(col, row)
|
||||
c = self.world.get_region_path(chunkx, chunky)
|
||||
@@ -589,7 +595,9 @@ def render_worldtile(quadtree, chunks, colstart, colend, rowstart, rowend, path)
|
||||
# their region files
|
||||
def chunk_exists(chunk):
|
||||
_, _, chunkx, chunky, region = chunk
|
||||
return nbt.load_from_region(region, chunkx, chunky) != None
|
||||
with open(region, 'rb') as region:
|
||||
r = nbt.MCRFileReader(region)
|
||||
return r.load_chunk(chunkx, chunky) != None
|
||||
chunks = filter(chunk_exists, chunks)
|
||||
|
||||
if not chunks:
|
||||
|
||||
Reference in New Issue
Block a user