/** * Coherent value/gradient noise with fractal (fBm / ridged) layering. * * `Noise` is the renderer-free *algorithm*: a CPU-samplable field you can read * directly with {@link Noise#getNoise2d} / {@link Noise#getNoise3d} for gameplay * (heightmaps, terrain, spawn jitter, flow fields), or feed to a * {@link NoiseTexture2d} to bake it into a drawable texture. * * Each sample returns a value in the `[-1, 1]` range. The field is fully * deterministic for a given `seed`, so the same parameters always reproduce the * same field. * @category Math * @example * const noise = new me.Noise({ type: "simplex", seed: 1337, frequency: 0.02, octaves: 4 }); * const h = noise.getNoise2d(x, y); // -1 .. 1 */ export type NoiseType = "simplex" | "perlin" | "value" | "valueCubic" | "cellular"; export type FractalType = "none" | "fbm" | "ridged" | "pingPong"; export interface NoiseSettings { /** the sampling algorithm (default `"simplex"`) */ type?: NoiseType; /** deterministic seed — same seed ⇒ same field (default `0`) */ seed?: number; /** base frequency: smaller ⇒ larger, smoother features (default `0.01`) */ frequency?: number; /** convenience alias for `1 / frequency` (feature size in pixels) */ scale?: number; /** fractal layering mode (default `"fbm"` when `octaves > 1`, else `"none"`) */ fractalType?: FractalType; /** number of fractal octaves summed together (default `1`) */ octaves?: number; /** per-octave frequency multiplier (default `2.0`) */ lacunarity?: number; /** per-octave amplitude multiplier (default `0.5`) */ gain?: number; /** convenience alias for `gain` */ persistence?: number; /** strength of the ping-pong fold when `fractalType === "pingPong"` (default `2.0`) */ pingPongStrength?: number; /** feature-point jitter for `type === "cellular"` (0..1, default `1.0`) */ cellularJitter?: number; /** perturb sample coordinates by a noise vector before sampling (default `false`) */ domainWarp?: boolean; /** displacement amplitude when `domainWarp` (in coordinate units, default `30`) */ domainWarpAmp?: number; /** frequency of the warp field when `domainWarp` (default `0.01`) */ domainWarpFrequency?: number; /** constant offset added to sample coordinates (default `0`) */ offsetX?: number; /** constant offset added to sample coordinates (default `0`) */ offsetY?: number; /** constant offset added to sample coordinates (default `0`) */ offsetZ?: number; } export declare class Noise { type: NoiseType; seed: number; frequency: number; fractalType: FractalType; octaves: number; lacunarity: number; gain: number; pingPongStrength: number; cellularJitter: number; domainWarp: boolean; domainWarpAmp: number; domainWarpFrequency: number; offsetX: number; offsetY: number; offsetZ: number; constructor(settings?: NoiseSettings); /** * Re-seed the noise field. Same seed ⇒ same field. * @param seed - the new seed value * @returns this noise instance for chaining */ seedNoise(seed: number): this; /** * Sample the 1D noise field (a 2D slice at `y = 0`). * @param x - sample coordinate * @returns noise value in the `[-1, 1]` range */ getNoise1d(x: number): number; /** * Sample the 2D noise field at `(x, y)`. * @param x - horizontal sample coordinate * @param y - vertical sample coordinate * @returns noise value in the `[-1, 1]` range */ getNoise2d(x: number, y: number): number; /** * Sample the 3D noise field at `(x, y, z)` — useful for animating a 2D field * by advancing `z` over time, or for volumetric/tiling effects. * @param x - sample coordinate * @param y - sample coordinate * @param z - sample coordinate * @returns noise value in the `[-1, 1]` range */ getNoise3d(x: number, y: number, z: number): number; } //# sourceMappingURL=noise.d.ts.map