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(seed: int)OpenSimplex2Dobject, an implementation ofNoise2Dusing the OpenSimplex noise function
: Creates a new.openSimplex3D(seed: int)OpenSimplex3Dobject, an implementation ofNoise3Dusing the OpenSimplex noise function. It has one additional method toNoise3D:.amplitude(): number: Gets the amplitude of the noise
: Creates a new.cellular2D(seed: int)Cellular2Dobject, an implementation ofNoise2Dspecialized to have polygonal blobs of constant value, instead of smooth, continuous values. It has additional methods.then(func: Function<Cell, number>): Noise2D: Converts aCellto a value via a function.cell(x: number, y: number): Cell: Gets theCellat the given x-y point, whereCellis 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]where4is 360°
: Creates a new.cellular3D(seed: int)Cellular3Dobject, an implementation ofNoise3Dspecialized 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 theCellat the given x-y-z point, whereCellis 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(seed: int)FastNoiseLiteobject, an MIT library for producing noise and is used in TFC’s open simplex and cellular noise types
: Converts a.fnl2Noise2D(fnl: FastNoiseLite)FastNoiseLiteobject to aNoise2D
: Converts a.fnl2Noise3D(fnl: FastNoiseLite)FastNoiseLiteobject to aNoise3D
: Converts a js callback to a full.customNoise2D(noise: Noise2D)Noise2Dto use its methods
: Converts a js callback to a full.customNoise3D(noise: Noise3D)Noise3Dto use its methods
: Creates a new.metaballs2D(random: RandomSource, minBalls: int, maxBalls: int, minSize: number, maxSize: number, radius: number)Metaballs2Dobject, the basis upon which soil discs and hot springs are shapedrandom: RandomSource: The random source values are derived fromminBalls: int: The minimum number of balls to usemaxBalls: int: The maximum number of balls to useminSize: number: The minimum size of an individual ballmaxSize: number: The maximum size of an individual ballradius: number: The maximum radius of an individual ballMetaballs2Dhas 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(random: RandomSource, minBalls: int, maxBalls: int, minSize: number, maxSize: number, radius: number)Metaballs3Dobject, the basis upon which boulders and cluster veins are shapedrandom: RandomSource: The random source values are derived fromminBalls: int: The minimum number of balls to usemaxBalls: int: The maximum number of balls to useminSize: number: The minimum size of an individual ballmaxSize: number: The maximum size of an individual ballradius: number: The maximum radius of an individual ballMetaballs3Dhas the method.inside(x: number, y: number, z: number): If the position is within the metaballs
: Registers a.inspect2D(name: String, noise: Noise2D)Noise2Dso that it may be inspected by command
: Registers a.inspect3D(name: String, noise: Noise3D)Noise3Dso that it may be inspected by command