Added partial port of fastnoise-java

This commit is contained in:
Edwin Jakobs
2018-12-05 16:07:28 +01:00
parent 0272c68e0f
commit 362c7a5889
13 changed files with 733 additions and 0 deletions

View File

@@ -24,5 +24,100 @@ val v4uc = Vector4.uniform(Vector4(0.0, 0.0, 0.0, 0.0), Vector4(1.0, 1.0, 1.0, 1
val v4ur = Vector4.uniformRing(0.5, 1.0)
val ringSamples = List(500) { Vector2.uniformRing() }
```
## Multi-dimensional noise
These are a mostly straight port from FastNoise-Java but have a slightly different interface.
### Perlin noise
```
// -- 2d
val v0 = perlinLinear(seed, x, y)
val v1 = perlinQuintic(seed, x, y)
val v2 = perlinHermite(seed, x, y)
// -- 3d
val v3 = perlinLinear(seed, x, y, z)
val v4 = perlinQuintic(seed, x, y, z)
val v5 = perlinHermite(seed, x, y, z)
```
### Value noise
```
// -- 2d
val v0 = valueLinear(seed, x, y)
val v1 = valueQuintic(seed, x, y)
val v2 = valueHermite(seed, x, y)
// -- 3d
val v3 = valueLinear(seed, x, y, z)
val v4 = valueQuintic(seed, x, y, z)
val v5 = valueHermite(seed, x, y ,z)
```
### Simplex noise
```
// -- 2d
val v0 = simplexLinear(seed, x, y)
val v1 = simplexQuintic(seed, x, y)
val v2 = simplexHermite(seed, x, y)
// -- 3d
val v3 = simplexLinear(seed, x, y, z)
val v4 = simplexQuintic(seed, x, y, z)
val v5 = simplexHermite(seed, x, y ,z)
```
### Cubic noise
```
// -- 2d
val v0 = cubicLinear(seed, x, y)
val v1 = cubicQuintic(seed, x, y)
val v2 = cubicHermite(seed, x, y)
// -- 3d
val v3 = cubicLinear(seed, x, y, z)
val v4 = cubicQuintic(seed, x, y, z)
val v5 = cubicHermite(seed, x, y ,z)
```
### Fractal noise
The library provides 3 functions with which fractal noise can be composed.
#### Fractal brownian motion (FBM)
```
val v0 = fbm(seed, x, y, ::perlinLinear, octaves, lacunarity, gain)
val v1 = fbm(seed, x, y, ::simplexLinear, octaves, lacunarity, gain)
val v2 = fbm(seed, x, y, ::valueLinear, octaves, lacunarity, gain)
val v3 = fbm(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
val v4 = fbm(seed, x, y, z, ::simplexLinear, octaves, lacunarity, gain)
val v5 = fbm(seed, x, y, z, ::valueLinear, octaves, lacunarity, gain)
```
#### Rigid
```
val v0 = rigid(seed, x, y, ::perlinLinear, octaves, lacunarity, gain)
val v1 = rigid(seed, x, y, ::simplexLinear, octaves, lacunarity, gain)
val v2 = rigid(seed, x, y, ::valueLinear, octaves, lacunarity, gain)
val v3 = rigid(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
val v4 = rigid(seed, x, y, z, ::simplexLinear, octaves, lacunarity, gain)
val v5 = rigid(seed, x, y, z, ::valueLinear, octaves, lacunarity, gain)
```
#### Billow
```
val v0 = billow(seed, x, y, ::perlinLinear, octaves, lacunarity, gain)
val v1 = billow(seed, x, y, ::perlinLinear, octaves, lacunarity, gain)
val v2 = billow(seed, x, y, ::perlinLinear, octaves, lacunarity, gain)
val v3 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
val v4 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
val v5 = billow(seed, x, y, z, ::perlinLinear, octaves, lacunarity, gain)
```