Async Perlin is default + fixes
This commit is contained in:
parent
17aed694ad
commit
7c89f4cadc
@ -116,16 +116,17 @@ class Perlin_Noise():
|
||||
shape = self.known_shape
|
||||
self.index += 1
|
||||
noise = [self.noise([self.index*self.scale, self.magic+(2*a)]) / self.normal_factor
|
||||
for a in range(shape[-1])]
|
||||
for a in range(np.prod(shape))]
|
||||
if self.index % self.clear_cache_every == 0:
|
||||
self.noise.cache = {}
|
||||
return th.Tensor(noise)
|
||||
return th.Tensor(noise).view(shape)
|
||||
|
||||
def reset(self):
|
||||
self.index = 0
|
||||
self.noise = PerlinNoise(octaves=self.octave)
|
||||
|
||||
class Async_Perlin_Noise():
|
||||
|
||||
class Sync_Perlin_Noise():
|
||||
def __init__(self, known_shape=None, scale=0.1, octave=1):
|
||||
self.known_shape = known_shape
|
||||
self.scale = scale
|
||||
@ -141,10 +142,10 @@ class Async_Perlin_Noise():
|
||||
shape = self.known_shape
|
||||
self.index += 1
|
||||
noise = [self.noise([self.index*self.scale, self.magic+(2*a)]) / self.normal_factor
|
||||
for a in range(np.prod(shape))]
|
||||
for a in range(shape[-1])]
|
||||
if self.index % self.clear_cache_every == 0:
|
||||
self.noise.cache = {}
|
||||
return th.Tensor(noise).view(shape)
|
||||
return th.Tensor(noise)
|
||||
|
||||
def reset(self):
|
||||
self.index = 0
|
||||
|
@ -55,13 +55,13 @@ class Avaible_Noise_Funcs(Enum):
|
||||
DIRTYPERLIN = 5
|
||||
SDE = 6
|
||||
SHORTPINK = 7
|
||||
ASYNCPERLIN = 8
|
||||
SYNCPERLIN = 8
|
||||
RAYLEIGHPERLIN = 9
|
||||
|
||||
|
||||
def get_func(self):
|
||||
# stil aaaaaaaa
|
||||
return [noise.White_Noise, noise.Pink_Noise, noise.Colored_Noise, noise.Perlin_Noise, noise.Harmonic_Perlin_Noise, noise.Dirty_Perlin_Noise, noise.SDE_Noise, noise.shortPink_Noise, noise.Async_Perlin_Noise, noise.Rayleigh_Perlin_Noise][self.value]
|
||||
return [noise.White_Noise, noise.Pink_Noise, noise.Colored_Noise, noise.Perlin_Noise, noise.Harmonic_Perlin_Noise, noise.Dirty_Perlin_Noise, noise.SDE_Noise, noise.shortPink_Noise, noise.Sync_Perlin_Noise, noise.Rayleigh_Perlin_Noise][self.value]
|
||||
|
||||
|
||||
def cast_to_enum(inp, Class):
|
||||
|
Loading…
Reference in New Issue
Block a user