Noise Bindings

Bindings for creating and using TFC’s noise objects

declare class NoiseBindings {

    // These are available via TFC.noise.*

    openSimplex2D(seed: int): OpenSimplex2D
    openSimplex3D(seed: int): OpenSimplex3D
    cellular2D(seed: int): Cellular2D
    cellular3D(seed: int): Cellular3D
    fastNoiseLite(seed: int): FastNoiseLite
    fnl2Noise2D(fnl: FastNoiseLite): Noise2D
    fnl2Noise3D(fnl: FastNoiseLite): Noise3D
    customNoise2D(noise: Noise2D): Noise2D
    customNoise3D(noise: Noise3D): Noise3D
    metaballs2D(random: RandomSource, minBalls: int, maxBalls: int, minSize: number, maxSize: number, radius: number): Metaballs2D
    metaballs3D(random: RandomSource, minBalls: int, maxBalls: int, minSize: number, maxSize: number, radius: number): Metaballs3D
    inspect2D(name: String, noise: Noise2D): void
    inspect3D(name: String, noise: Noise3D): void
}
  • : Creates a new OpenSimplex2D object, an implementation of Noise2D using the OpenSimplex noise function
  • : Creates a new OpenSimplex3D object, an implementation of Noise3D using the OpenSimplex noise function. It has one additional method to Noise3D:
    • .amplitude(): number: Gets the amplitude of the noise
  • : Creates a new Cellular2D object, an implementation of Noise2D specialized to have polygonal blobs of constant value, instead of smooth, continuous values. It has additional methods
    • .then(func: Function<Cell, number>): Noise2D: Converts a Cell to a value via a function
    • .cell(x: number, y: number): Cell: Gets the Cell at the given x-y point, where Cell is an object with the methods
      • .x(): number: The x ‘coordinate’ of the cell center. Not tied to game coordinates
      • .y(): number: The y ‘coordinate’ of the cell center. Not tied to game coordinates
      • .cx(): int: The x ‘coordinate’ of nearest cell center
      • .cy(): int: The y ‘coordinate’ of nearest cell center
      • .f1(): number: The distance to (c, x)
      • .f2(): number: The distance to (cx, cy)
      • .noise(): number: The noise value of the cell, in the range [0, 1]
      • .angle(): number: The diamond angle to the cell center, in the range [0, 4] where 4 is 360°
  • : Creates a new Cellular3D object, an implementation of Noise3D specialized to have polyhedral blobs of constant value, instead of smooth, continuous values. It has an additional method
    • .cell(x: number, y: number, z: number): Cell: Gets the Cell at the given x-y-z point, where Cell is an object with the methods
      • .x(): number: The x ‘coordinate’ of the cell
      • .y(): number: The y ‘coordinate’ of the cell
      • .z(): number: The z ‘coordinate’ of the cell
      • .f1(): number: The normalized distance from the center of the cell
      • .f2(): number: The normalized distance form the center of a face of the cell
      • .noise(): number: The noise value of the cell
  • : Creates a new FastNoiseLite object, an MIT library for producing noise and is used in TFC’s open simplex and cellular noise types
  • : Converts a FastNoiseLite object to a Noise2D
  • : Converts a FastNoiseLite object to a Noise3D
  • : Converts a js callback to a full Noise2D to use its methods
  • : Converts a js callback to a full Noise3D to use its methods
  • : Creates a new Metaballs2D object, the basis upon which soil discs and hot springs are shaped
    • random: RandomSource: The random source values are derived from
    • minBalls: int: The minimum number of balls to use
    • maxBalls: int: The maximum number of balls to use
    • minSize: number: The minimum size of an individual ball
    • maxSize: number: The maximum size of an individual ball
    • radius: number: The maximum radius of an individual ball Metaballs2D has the methods
    • .inside(x: number, z: number): If the position is within the metaballs
    • .sample(x: number, z: number): Gets the ‘proximity’ to the metaballs, values grater than one are considered inside
  • : Creates a new Metaballs3D object, the basis upon which boulders and cluster veins are shaped
    • random: RandomSource: The random source values are derived from
    • minBalls: int: The minimum number of balls to use
    • maxBalls: int: The maximum number of balls to use
    • minSize: number: The minimum size of an individual ball
    • maxSize: number: The maximum size of an individual ball
    • radius: number: The maximum radius of an individual ball Metaballs3D has the method
    • .inside(x: number, y: number, z: number): If the position is within the metaballs
  • : Registers a Noise2D so that it may be inspected by command
  • : Registers a Noise3D so that it may be inspected by command