Updated comments with how the traversals will work
This commit is contained in:
@@ -251,44 +251,47 @@ class TileSet(object):
|
|||||||
# tree in post-traversal order and yield each tile path.
|
# tree in post-traversal order and yield each tile path.
|
||||||
|
|
||||||
# For 0 our caller has explicitly requested not to check mtimes on
|
# For 0 our caller has explicitly requested not to check mtimes on
|
||||||
# disk, to speed up the chunk scan.
|
# disk, to speed things up. So the mode 0 chunk scan only looks at
|
||||||
|
# chunk mtimes and the last render mtime, and has marked only the
|
||||||
|
# render-tiles that need rendering. Mode 0 then iterates over all dirty
|
||||||
|
# render-tiles and upper-tiles that depend on them. It does not check
|
||||||
|
# mtimes of upper-tiles, so this is only a good option if the last
|
||||||
|
# render was not interrupted.
|
||||||
|
|
||||||
# For 2, the chunk scan holds every tile that should exist and
|
# For mode 2, this is a forcerender, the caller has requested we render
|
||||||
# therefore every upper tile that should exist as well. In both 0 and 2
|
# everything. The mode 2 chunk scan marks every tile as needing
|
||||||
# the dirtytile tree is authoritive on every tile that needs rendering.
|
# rendering, and disregards mtimes completely. Mode 2 then iterates
|
||||||
|
# over all render-tiles and upper-tiles that depend on them, which is
|
||||||
|
# every tile that should exist.
|
||||||
|
|
||||||
|
# In both 0 and 2 the render iteration is the same: the dirtytile tree
|
||||||
|
# built is authoritive on every tile that needs rendering.
|
||||||
|
|
||||||
# With renderchecks set to 1, the chunk scan has checked mtimes of all
|
# In mode 1, things are most complicated. The mode 2 chunk scan checks
|
||||||
# the render-tiles already and determined which render-tiles need to be
|
# every render tile's mtime for each chunk that touches it, so it can
|
||||||
# rendered. However, the dirtytile tree is authoritive on render-tiles
|
# determine accurately which tiles need rendering regardless of the
|
||||||
# only. We still need to account for tiles at the upper levels in the
|
# state on disk. The chunk scan also builds a RendertileSet of *every*
|
||||||
# tree that may not exist or may need updating. So we can't just
|
# render-tile that exists.
|
||||||
# iterate over the dirty tile tree because that tree only tells us
|
|
||||||
# which render-tiles need rendering (and their ancestors)
|
|
||||||
|
|
||||||
# For example, there may be an upper-tile that needs rendering down a
|
# The mode 1 render iteration then manually iterates over the set of
|
||||||
# path of the tree that doesn't exist in the dirtytile tree because the
|
# all render-tiles in a post-traversal order. When it visits a
|
||||||
# last render was interrupted after the render-tile was rendered, but
|
# render-node, it does the following:
|
||||||
# before its ancestors were.
|
# * Checks the set of dirty render-tiles to see if the node needs
|
||||||
|
# rendering, and if so, renders it
|
||||||
# The strategy for this situation is to do a post-traversal of the
|
# * If the tile was rendered, set the mtime using os.utime() to the max
|
||||||
# quadtree on disk, while simultaneously keeping track of the next tile
|
# of the chunk mtimes.
|
||||||
# (render or upper) that is returned by the dirtytile tree in memory.
|
# * If the tile was rendered, return (True, mtime).
|
||||||
|
# * If the tile was not rendered, return (False, mtime)
|
||||||
# If, during node expansion, a path is not going to be traversed but
|
#
|
||||||
# the dirtytile tree indicates a node down that path, that path must be
|
# Then, for upper-tiles, it does the following:
|
||||||
# taken.
|
# * Gathers the return values of each child call.
|
||||||
|
# * If any child returned True, render this tile.
|
||||||
# When a node is visited, if it matches the next node from the
|
# * Otherwise, check this tile's mtime. If any child's mtime is greater
|
||||||
# dirtytile tree, it must be rendered regardless of the tile's mtime.
|
# than this tile's mtime, render this tile.
|
||||||
# Then the next tile from the dirtytile tree is yielded and the
|
# * If the tile was rendered, set the mtime using os.utime() to the max
|
||||||
# traversal continues.
|
# of the child mtimes.
|
||||||
|
# * If the tile was rendered, return (True, mtime).
|
||||||
# Otherwise, for every upper-tile, check the mtime and continue
|
# * If the tile was not rendered, return (False, mtime)
|
||||||
# traversing the tree.
|
|
||||||
|
|
||||||
# This implementation is going to be a bit complicated. I think I need
|
|
||||||
# to give it some more thought to figure out exactly how it's going to
|
|
||||||
# work.
|
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user