implemented stochhastic check with chunk scanning
Also changed uniform(0,1) to random()
This commit is contained in:
@@ -439,7 +439,7 @@ class QuadtreeGen(object):
|
||||
break
|
||||
|
||||
# stochastic render check
|
||||
if not needs_rerender and self.rerender_probability > 0.0 and random.uniform(0, 1) < self.rerender_probability:
|
||||
if not needs_rerender and self.rerender_probability > 0.0 and random.random() < self.rerender_probability:
|
||||
needs_rerender = True
|
||||
|
||||
# if after all that, we don't need a rerender, return
|
||||
@@ -538,6 +538,17 @@ class QuadtreeGen(object):
|
||||
dirty.set_dirty(tile.path)
|
||||
continue
|
||||
|
||||
# Stochastic check. Since we're scanning by chunks and not
|
||||
# by tiles, and the tiles get checked multiple times for
|
||||
# each chunk, this is only an approximation. The given
|
||||
# probability is for a particular tile that needs
|
||||
# rendering, but since a tile gets touched up to 32 times
|
||||
# (once for each chunk in it), divide the probability by
|
||||
# 32.
|
||||
if self.rerender_probability and self.rerender_probability/32 > random.random():
|
||||
dirty.set_dirty(tile.path)
|
||||
continue
|
||||
|
||||
# Check if this tile has already been marked dirty. If so,
|
||||
# no need to do any of the below.
|
||||
if dirty.query_path(tile.path):
|
||||
|
||||
Reference in New Issue
Block a user