fastnoiselite-builder 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +283 -0
- package/dist/builder/ANoiseBuilder.d.ts +100 -0
- package/dist/builder/NoiseBuilder2D.d.ts +14 -0
- package/dist/builder/NoiseBuilder3D.d.ts +18 -0
- package/dist/builder/index.d.ts +3 -0
- package/dist/core/gradients.d.ts +27 -0
- package/dist/core/hash.d.ts +10 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/math.d.ts +25 -0
- package/dist/core/primes.d.ts +6 -0
- package/dist/fractal/fbm.d.ts +9 -0
- package/dist/fractal/index.d.ts +3 -0
- package/dist/fractal/pingpong.d.ts +13 -0
- package/dist/fractal/ridged.d.ts +9 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3631 -0
- package/dist/noise/cellular/cellular.d.ts +28 -0
- package/dist/noise/cellular/distance.d.ts +43 -0
- package/dist/noise/cellular/index.d.ts +3 -0
- package/dist/noise/cellular/return-type.d.ts +48 -0
- package/dist/noise/index.d.ts +6 -0
- package/dist/noise/opensimplex2.d.ts +9 -0
- package/dist/noise/opensimplex2s.d.ts +9 -0
- package/dist/noise/perlin.d.ts +9 -0
- package/dist/noise/value-cubic.d.ts +9 -0
- package/dist/noise/value.d.ts +9 -0
- package/dist/transform/transform3dFunc.d.ts +2 -0
- package/dist/types/common.d.ts +56 -0
- package/dist/types/config.d.ts +28 -0
- package/dist/types/enums.d.ts +67 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/warp/basic-grid.d.ts +23 -0
- package/dist/warp/index.d.ts +3 -0
- package/dist/warp/opensimplex2.d.ts +25 -0
- package/dist/warp/types.d.ts +27 -0
- package/package.json +31 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { NoiseFunction2D, NoiseFunction3D } from '../../types';
|
|
2
|
+
import type { DistanceFunction2D, DistanceFunction3D } from './distance';
|
|
3
|
+
import type { ReturnHandler } from './return-type';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a 2D cellular noise generator
|
|
6
|
+
*
|
|
7
|
+
* The distance function and return handler are "baked in" at build-time,
|
|
8
|
+
* eliminating runtime switches for maximum performance.
|
|
9
|
+
*
|
|
10
|
+
* @param seed - Random seed
|
|
11
|
+
* @param distanceFn - How to measure distance to cell points
|
|
12
|
+
* @param returnHandler - How to convert distances to noise value
|
|
13
|
+
* @param jitterModifier - Controls randomness of cell positions (0-1)
|
|
14
|
+
* @param useEuclideanSqrt - If true and using Euclidean, apply sqrt to distances
|
|
15
|
+
*/
|
|
16
|
+
export declare function createCellular2D(seed: number, distanceFn: DistanceFunction2D, returnHandler: ReturnHandler, jitterModifier?: number, useEuclideanSqrt?: boolean): NoiseFunction2D;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a 3D cellular noise generator
|
|
19
|
+
*
|
|
20
|
+
* Same principle as 2D but loops through a 3x3x3 grid
|
|
21
|
+
*
|
|
22
|
+
* @param seed - Random seed
|
|
23
|
+
* @param distanceFn - How to measure distance to cell points
|
|
24
|
+
* @param returnHandler - How to convert distances to noise value
|
|
25
|
+
* @param jitterModifier - Controls randomness of cell positions (0-1)
|
|
26
|
+
* @param useEuclideanSqrt - If true and using Euclidean, apply sqrt to distances
|
|
27
|
+
*/
|
|
28
|
+
export declare function createCellular3D(seed: number, distanceFn: DistanceFunction3D, returnHandler: ReturnHandler, jitterModifier?: number, useEuclideanSqrt?: boolean): NoiseFunction3D;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CellularDistanceFunction } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Distance function type for cellular noise
|
|
4
|
+
* Takes vector components and returns distance metric
|
|
5
|
+
*/
|
|
6
|
+
export type DistanceFunction2D = (vecX: number, vecY: number) => number;
|
|
7
|
+
export type DistanceFunction3D = (vecX: number, vecY: number, vecZ: number) => number;
|
|
8
|
+
/**
|
|
9
|
+
* Euclidean distance (squared) - no sqrt for performance
|
|
10
|
+
* Used for most cellular noise patterns
|
|
11
|
+
*/
|
|
12
|
+
export declare const euclideanSq2D: DistanceFunction2D;
|
|
13
|
+
export declare const euclideanSq3D: DistanceFunction3D;
|
|
14
|
+
/**
|
|
15
|
+
* Euclidean distance (squared)
|
|
16
|
+
* Returns distance² - the sqrt is applied by useEuclideanSqrt flag in cellular.ts
|
|
17
|
+
* This avoids double sqrt (which would give distance^(1/4) instead of distance)
|
|
18
|
+
*/
|
|
19
|
+
export declare const euclidean2D: DistanceFunction2D;
|
|
20
|
+
export declare const euclidean3D: DistanceFunction3D;
|
|
21
|
+
/**
|
|
22
|
+
* Manhattan distance - sum of absolute values
|
|
23
|
+
* Creates a diamond-shaped pattern
|
|
24
|
+
*/
|
|
25
|
+
export declare const manhattan2D: DistanceFunction2D;
|
|
26
|
+
export declare const manhattan3D: DistanceFunction3D;
|
|
27
|
+
/**
|
|
28
|
+
* Hybrid distance - combination of Manhattan and Euclidean
|
|
29
|
+
* Creates interesting mixed patterns
|
|
30
|
+
*/
|
|
31
|
+
export declare const hybrid2D: DistanceFunction2D;
|
|
32
|
+
export declare const hybrid3D: DistanceFunction3D;
|
|
33
|
+
/**
|
|
34
|
+
* Distance function names for configuration
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Get distance function by name for 2D
|
|
38
|
+
*/
|
|
39
|
+
export declare function getDistanceFunction2D(type: CellularDistanceFunction): DistanceFunction2D;
|
|
40
|
+
/**
|
|
41
|
+
* Get distance function by name for 3D
|
|
42
|
+
*/
|
|
43
|
+
export declare function getDistanceFunction3D(type: CellularDistanceFunction): DistanceFunction3D;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CellularReturnType } from '../../types/enums';
|
|
2
|
+
/**
|
|
3
|
+
* Return handler type for cellular noise
|
|
4
|
+
* Takes distances and hash, returns final noise value
|
|
5
|
+
* @param distance0 - Distance to closest cell point
|
|
6
|
+
* @param distance1 - Distance to second closest cell point
|
|
7
|
+
* @param closestHash - Hash value of closest cell
|
|
8
|
+
*/
|
|
9
|
+
export type ReturnHandler = (distance0: number, distance1: number, closestHash: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* CellValue - Returns the value of the closest cell based on its hash
|
|
12
|
+
* Creates flat regions with hard edges between cells
|
|
13
|
+
*/
|
|
14
|
+
export declare const cellValue: ReturnHandler;
|
|
15
|
+
/**
|
|
16
|
+
* Distance - Returns the distance to the closest cell point
|
|
17
|
+
* Creates a voronoi/worley pattern with gradient falloff
|
|
18
|
+
*/
|
|
19
|
+
export declare const distance: ReturnHandler;
|
|
20
|
+
/**
|
|
21
|
+
* Distance2 - Returns the distance to the second closest cell point
|
|
22
|
+
* Creates larger cell-like patterns
|
|
23
|
+
*/
|
|
24
|
+
export declare const distance2: ReturnHandler;
|
|
25
|
+
/**
|
|
26
|
+
* Distance2Add - Returns the average of both distances
|
|
27
|
+
* Creates smooth transitions between cells
|
|
28
|
+
*/
|
|
29
|
+
export declare const distance2Add: ReturnHandler;
|
|
30
|
+
/**
|
|
31
|
+
* Distance2Sub - Returns the difference between distances
|
|
32
|
+
* Creates cellular boundaries/edges (useful for voronoi edges)
|
|
33
|
+
*/
|
|
34
|
+
export declare const distance2Sub: ReturnHandler;
|
|
35
|
+
/**
|
|
36
|
+
* Distance2Mul - Returns the product of both distances
|
|
37
|
+
* Creates interesting organic patterns
|
|
38
|
+
*/
|
|
39
|
+
export declare const distance2Mul: ReturnHandler;
|
|
40
|
+
/**
|
|
41
|
+
* Distance2Div - Returns the ratio of distances
|
|
42
|
+
* Creates sharp cellular patterns with varying sizes
|
|
43
|
+
*/
|
|
44
|
+
export declare const distance2Div: ReturnHandler;
|
|
45
|
+
/**
|
|
46
|
+
* Get return handler by name
|
|
47
|
+
*/
|
|
48
|
+
export declare function getReturnHandler(type: CellularReturnType): ReturnHandler;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NoiseFunction2D, NoiseFunction3D } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an OpenSimplex2 2D noise generator
|
|
4
|
+
*/
|
|
5
|
+
export declare function createOpenSimplex2_2D(seed: number): NoiseFunction2D;
|
|
6
|
+
/**
|
|
7
|
+
* Creates an OpenSimplex2 3D noise generator
|
|
8
|
+
*/
|
|
9
|
+
export declare function createOpenSimplex2_3D(_seed: number): NoiseFunction3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NoiseFunction2D, NoiseFunction3D } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an OpenSimplex2S 2D noise generator (with skew)
|
|
4
|
+
*/
|
|
5
|
+
export declare function createOpenSimplex2S_2D(_seed: number): NoiseFunction2D;
|
|
6
|
+
/**
|
|
7
|
+
* Creates an OpenSimplex2S 3D noise generator
|
|
8
|
+
*/
|
|
9
|
+
export declare function createOpenSimplex2S_3D(seed: number): NoiseFunction3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NoiseFunction2D, NoiseFunction3D } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Perlin 2D noise generator
|
|
4
|
+
*/
|
|
5
|
+
export declare function createPerlin2D(seed: number): NoiseFunction2D;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a Perlin 3D noise generator
|
|
8
|
+
*/
|
|
9
|
+
export declare function createPerlin3D(seed: number): NoiseFunction3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NoiseFunction2D, NoiseFunction3D } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a ValueCubic 2D noise generator
|
|
4
|
+
*/
|
|
5
|
+
export declare function createValueCubic2D(seed: number): NoiseFunction2D;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a ValueCubic 3D noise generator
|
|
8
|
+
*/
|
|
9
|
+
export declare function createValueCubic3D(seed: number): NoiseFunction3D;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NoiseFunction2D, NoiseFunction3D } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a Value 2D noise generator
|
|
4
|
+
*/
|
|
5
|
+
export declare function createValue2D(seed: number): NoiseFunction2D;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a Value 3D noise generator
|
|
8
|
+
*/
|
|
9
|
+
export declare function createValue3D(seed: number): NoiseFunction3D;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface Vector2 {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface Vector3 {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
z: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A 2D noise function that takes x, y coordinates and returns a noise value [-1, 1]
|
|
12
|
+
*/
|
|
13
|
+
export type NoiseFunction2D = (x: number, y: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* A 3D noise function that takes x, y, z coordinates and returns a noise value [-1, 1]
|
|
16
|
+
*/
|
|
17
|
+
export type NoiseFunction3D = (x: number, y: number, z: number) => number;
|
|
18
|
+
/**
|
|
19
|
+
* A 3D transform function that modifies coordinates
|
|
20
|
+
*/
|
|
21
|
+
export type TransformFunction3D = (x: number, y: number, z: number) => {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
z: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A 2D domain warp function that modifies coordinates
|
|
28
|
+
*/
|
|
29
|
+
export type WarpFunction2D = (x: number, y: number, coord: Vector2) => void;
|
|
30
|
+
/**
|
|
31
|
+
* A 3D domain warp function that modifies coordinates
|
|
32
|
+
*/
|
|
33
|
+
export type WarpFunction3D = (x: number, y: number, z: number, coord: Vector3) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Context for noise generation
|
|
36
|
+
*/
|
|
37
|
+
export interface NoiseContext {
|
|
38
|
+
seed: number;
|
|
39
|
+
frequency: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Context for fractal noise generation
|
|
43
|
+
*/
|
|
44
|
+
export interface FractalContext extends NoiseContext {
|
|
45
|
+
octaves: number;
|
|
46
|
+
lacunarity: number;
|
|
47
|
+
gain: number;
|
|
48
|
+
weightedStrength: number;
|
|
49
|
+
fractalBounding: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Context for ping-pong fractal
|
|
53
|
+
*/
|
|
54
|
+
export interface PingPongContext extends FractalContext {
|
|
55
|
+
pingPongStrength: number;
|
|
56
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FractalType, CellularDistanceFunction, CellularReturnType, DomainWarpType, DomainWarpFractalType, TransformType3D, NoiseType } from './enums';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for noise generation
|
|
4
|
+
*/
|
|
5
|
+
export interface NoiseConfig {
|
|
6
|
+
seed: number;
|
|
7
|
+
frequency: number;
|
|
8
|
+
noiseType: NoiseType;
|
|
9
|
+
fractalType: FractalType;
|
|
10
|
+
fractalOctaves: number;
|
|
11
|
+
fractalLacunarity: number;
|
|
12
|
+
fractalGain: number;
|
|
13
|
+
fractalWeightedStrength: number;
|
|
14
|
+
fractalPingPongStrength: number;
|
|
15
|
+
cellularDistanceFunction: CellularDistanceFunction;
|
|
16
|
+
cellularReturnType: CellularReturnType;
|
|
17
|
+
cellularJitter: number;
|
|
18
|
+
rotationType3D: TransformType3D;
|
|
19
|
+
warpTransformType3D: TransformType3D;
|
|
20
|
+
transformType3D: TransformType3D;
|
|
21
|
+
domainWarpType: DomainWarpType;
|
|
22
|
+
domainWarpAmplitude: number;
|
|
23
|
+
domainWarpFrequency: number;
|
|
24
|
+
domainWarpFractalType: DomainWarpFractalType;
|
|
25
|
+
domainWarpFractalOctaves: number;
|
|
26
|
+
domainWarpFractalLacunarity: number;
|
|
27
|
+
domainWarpFractalGain: number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
declare const NoiseType: {
|
|
2
|
+
readonly OpenSimplex2: "OpenSimplex2";
|
|
3
|
+
readonly OpenSimplex2S: "OpenSimplex2S";
|
|
4
|
+
readonly Perlin: "Perlin";
|
|
5
|
+
readonly Value: "Value";
|
|
6
|
+
readonly ValueCubic: "ValueCubic";
|
|
7
|
+
readonly Cellular: "Cellular";
|
|
8
|
+
};
|
|
9
|
+
type NoiseType = (typeof NoiseType)[keyof typeof NoiseType];
|
|
10
|
+
export { NoiseType };
|
|
11
|
+
declare const RotationType3D: {
|
|
12
|
+
readonly None: "None";
|
|
13
|
+
readonly ImproveXYPlanes: "ImproveXYPlanes";
|
|
14
|
+
readonly ImproveXZPlanes: "ImproveXZPlanes";
|
|
15
|
+
};
|
|
16
|
+
type RotationType3D = (typeof RotationType3D)[keyof typeof RotationType3D];
|
|
17
|
+
export { RotationType3D };
|
|
18
|
+
declare const FractalType: {
|
|
19
|
+
readonly None: "None";
|
|
20
|
+
readonly FBm: "FBm";
|
|
21
|
+
readonly Ridged: "Ridged";
|
|
22
|
+
readonly PingPong: "PingPong";
|
|
23
|
+
};
|
|
24
|
+
type FractalType = (typeof FractalType)[keyof typeof FractalType];
|
|
25
|
+
export { FractalType };
|
|
26
|
+
declare const CellularDistanceFunction: {
|
|
27
|
+
readonly Euclidean: "Euclidean";
|
|
28
|
+
readonly EuclideanSq: "EuclideanSq";
|
|
29
|
+
readonly Manhattan: "Manhattan";
|
|
30
|
+
readonly Hybrid: "Hybrid";
|
|
31
|
+
};
|
|
32
|
+
type CellularDistanceFunction = (typeof CellularDistanceFunction)[keyof typeof CellularDistanceFunction];
|
|
33
|
+
export { CellularDistanceFunction };
|
|
34
|
+
declare const CellularReturnType: {
|
|
35
|
+
readonly CellValue: "CellValue";
|
|
36
|
+
readonly Distance: "Distance";
|
|
37
|
+
readonly Distance2: "Distance2";
|
|
38
|
+
readonly Distance2Add: "Distance2Add";
|
|
39
|
+
readonly Distance2Sub: "Distance2Sub";
|
|
40
|
+
readonly Distance2Mul: "Distance2Mul";
|
|
41
|
+
readonly Distance2Div: "Distance2Div";
|
|
42
|
+
};
|
|
43
|
+
type CellularReturnType = (typeof CellularReturnType)[keyof typeof CellularReturnType];
|
|
44
|
+
export { CellularReturnType };
|
|
45
|
+
declare const DomainWarpType: {
|
|
46
|
+
readonly None: "None";
|
|
47
|
+
readonly OpenSimplex2: "OpenSimplex2";
|
|
48
|
+
readonly OpenSimplex2Reduced: "OpenSimplex2Reduced";
|
|
49
|
+
readonly BasicGrid: "BasicGrid";
|
|
50
|
+
};
|
|
51
|
+
type DomainWarpType = (typeof DomainWarpType)[keyof typeof DomainWarpType];
|
|
52
|
+
export { DomainWarpType };
|
|
53
|
+
declare const DomainWarpFractalType: {
|
|
54
|
+
readonly None: "None";
|
|
55
|
+
readonly Progressive: "Progressive";
|
|
56
|
+
readonly Independent: "Independent";
|
|
57
|
+
};
|
|
58
|
+
type DomainWarpFractalType = (typeof DomainWarpFractalType)[keyof typeof DomainWarpFractalType];
|
|
59
|
+
export { DomainWarpFractalType };
|
|
60
|
+
declare const TransformType3D: {
|
|
61
|
+
readonly None: "None";
|
|
62
|
+
readonly ImproveXYPlanes: "ImproveXYPlanes";
|
|
63
|
+
readonly ImproveXZPlanes: "ImproveXZPlanes";
|
|
64
|
+
readonly DefaultOpenSimplex2: "DefaultOpenSimplex2";
|
|
65
|
+
};
|
|
66
|
+
type TransformType3D = (typeof TransformType3D)[keyof typeof TransformType3D];
|
|
67
|
+
export { TransformType3D };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WarpFunction2D, WarpFunction3D } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a 2D basic grid domain warp function
|
|
4
|
+
*
|
|
5
|
+
* BasicGrid warp uses a grid-based approach with hermite interpolation
|
|
6
|
+
* to create smooth deformations of the coordinate space.
|
|
7
|
+
*
|
|
8
|
+
* @param seed - Random seed
|
|
9
|
+
* @param warpAmp - Amplitude of the warp effect
|
|
10
|
+
* @param frequency - Frequency of the warp pattern
|
|
11
|
+
*/
|
|
12
|
+
export declare function createBasicGridWarp2D(seed: number, warpAmp: number, frequency: number): WarpFunction2D;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a 3D basic grid domain warp function
|
|
15
|
+
*
|
|
16
|
+
* 3D version extends the 2D grid-based approach with trilinear interpolation
|
|
17
|
+
* to create smooth 3D coordinate space deformations.
|
|
18
|
+
*
|
|
19
|
+
* @param seed - Random seed
|
|
20
|
+
* @param warpAmp - Amplitude of the warp effect
|
|
21
|
+
* @param frequency - Frequency of the warp pattern
|
|
22
|
+
*/
|
|
23
|
+
export declare function createBasicGridWarp3D(seed: number, warpAmp: number, frequency: number): WarpFunction3D;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { WarpFunction2D, WarpFunction3D } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a 2D OpenSimplex2 domain warp function
|
|
4
|
+
*
|
|
5
|
+
* Uses the OpenSimplex2 algorithm to generate gradient vectors that warp
|
|
6
|
+
* the coordinate space. More organic and flowing than BasicGrid warp.
|
|
7
|
+
*
|
|
8
|
+
* @param seed - Random seed
|
|
9
|
+
* @param warpAmp - Amplitude of the warp effect
|
|
10
|
+
* @param frequency - Frequency of the warp pattern
|
|
11
|
+
* @param reduced - If true, uses simplified "reduced" mode (gradOnly)
|
|
12
|
+
*/
|
|
13
|
+
export declare function createOpenSimplex2Warp2D(seed: number, warpAmp: number, frequency: number, reduced?: boolean): WarpFunction2D;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a 3D OpenSimplex2 domain warp function
|
|
16
|
+
*
|
|
17
|
+
* 3D version of OpenSimplex2 warp using the same algorithm as 3D OpenSimplex2 noise
|
|
18
|
+
* but accumulating gradient vectors instead of noise values.
|
|
19
|
+
*
|
|
20
|
+
* @param _seed - Random seed
|
|
21
|
+
* @param warpAmp - Amplitude of the warp effect
|
|
22
|
+
* @param frequency - Frequency of the warp pattern
|
|
23
|
+
* @param reduced - If true, uses simplified "reduced" mode (gradOnly)
|
|
24
|
+
*/
|
|
25
|
+
export declare function createOpenSimplex2Warp3D(_seed: number, warpAmp: number, frequency: number, reduced?: boolean): WarpFunction3D;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutable 2D coordinates for domain warping
|
|
3
|
+
* Domain warp modifies coordinates in-place
|
|
4
|
+
*/
|
|
5
|
+
export interface WarpCoord2D {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Mutable 3D coordinates for domain warping
|
|
11
|
+
* Domain warp modifies coordinates in-place
|
|
12
|
+
*/
|
|
13
|
+
export interface WarpCoord3D {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
z: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Domain warp function type for 2D
|
|
20
|
+
* Takes coordinates and modifies them in-place
|
|
21
|
+
*/
|
|
22
|
+
export type WarpFunction2D = (coord: WarpCoord2D) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Domain warp function type for 3D
|
|
25
|
+
* Takes coordinates and modifies them in-place
|
|
26
|
+
*/
|
|
27
|
+
export type WarpFunction3D = (coord: WarpCoord3D, x: number, y: number, z: number) => void;
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fastnoiselite-builder",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": ["dist"],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build:lib": "vite build --config vite.lib.config.js && tsc -p tsconfig.lib.json",
|
|
17
|
+
"prepublishOnly": "npm run build:lib",
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"build": "tsc && vite build",
|
|
20
|
+
"preview": "vite preview",
|
|
21
|
+
"test": "vitest",
|
|
22
|
+
"test:ui": "vitest --ui"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/three": "^0.182.0",
|
|
26
|
+
"three": "^0.182.0",
|
|
27
|
+
"typescript": "~5.9.3",
|
|
28
|
+
"vite": "^7.2.4",
|
|
29
|
+
"vitest": "^4.0.18"
|
|
30
|
+
}
|
|
31
|
+
}
|