def __init__(self, seed): rand = FastRandom(seed) self.perm = [None] * 512 noise_tbl = [None] * 256 self.PERSISTENCE = 2.1379201 self.H = 0.836281 self.OCTAVES = 9 self.weights = [None] * self.OCTAVES self.regen_weight = True for i in range(0, 256): noise_tbl[i] = i for i in range(0, 256): j = rand.randint() % 256 j = fast_abs(j) noise_tbl[i], noise_tbl[j] = noise_tbl[j], noise_tbl[i] for i in range(0, 256): self.perm[i] = self.perm[i + 256] = noise_tbl[i]
def rive_terrain(self, x, z): return self._clamp((sqrt(fast_abs(self.river_gen.fBm(0.0008 * x, 0, 0.0008 * z))) - 0.1) * 7.0)