src/perlin/private/types

Types

Noise = object
A noise instance
  • perm is a set of random numbers used to generate the results
  • octaves allows you to combine multiple layers of noise into a single result
  • persistence is how much impact each successive octave has on the result
NoiseType {.pure.} = enum
  perlin, simplex
The types of noise available
Point = Point3D[float] | Point3D[int] | Point2D[float] | Point2D[int]
A 2d or 3d point with any kind of precision
Point2D[U] = tuple[x, y: U]
A helper definition for a 3d point
Point3D[U] = tuple[x, y, z: U]
A helper definition for a 3d point
PointND[U] = Point3D[U] | Point2D[U]
a point of N dimensions with a specific precision

Procs

proc buildPermutations(seed: uint32): array[0 .. 511, int] {....raises: [],
    tags: [], forbids: [].}
Returns a hash lookup table. It is all the numbers from 0 to 255 (inclusive) in a randomly sorted array, twice over
proc newNoise(): Noise {....raises: [], tags: [], forbids: [].}
Creates a new noise instance with a random seed
proc newNoise(octaves: int; persistence: float): Noise {....raises: [], tags: [],
    forbids: [].}
Creates a new noise instance with a random seed
  • octaves allows you to combine multiple layers of noise into a single result
  • persistence is how much impact each successive octave has on the result
proc newNoise(seed: uint32; octaves: int = 1; persistence: float = 0.5): Noise {.
    ...raises: [], tags: [], forbids: [].}
Creates a new noise instance with the given seed
  • octaves allows you to combine multiple layers of noise into a single result
  • persistence is how much impact each successive octave has on the result
proc octaves(noise: Noise): auto {....raises: [], tags: [], forbids: [].}
proc persistence(noise: Noise): auto {....raises: [], tags: [], forbids: [].}