def value(self, u: float, v: float, p: Vector3) -> Vector3: sines = math.sin(10 * p.x()) * math.sin(10 * p.y()) * math.sin( 10 * p.z()) if sines < 0: return self._texture0.value(u, v, p) else: return self._texture1.value(u, v, p)
def noise(self, p: Vector3): u = p.x() - math.floor(p.x()) v = p.y() - math.floor(p.y()) w = p.z() - math.floor(p.z()) i = math.floor(p.x()) j = math.floor(p.y()) k = math.floor(p.z()) # return self._ranvector[self._perm_x[i] ^ self._perm_y[j] ^ self._perm_z[k]] # c = [[[self._ranfloat[self._perm_x[(i + ii) & 255] ^ self._perm_y[(j + jj) & 255] ^ self._perm_z[(k + kk) & 255]] for kk in range(2)] for jj in range(2)] for ii in range(2)] c = list() for ii in range(2): for jj in range(2): for kk in range(2): c.append(self._ranvector[self._perm_x[(i + ii) & 255] ^ self._perm_y[(j + jj) & 255] ^ self._perm_z[(k + kk) & 255]]) return self.trilineart_interp(c, u, v, w)