[orx-noise] Add gradient and crossFade tools

This commit is contained in:
Edwin Jakobs
2021-07-26 20:14:30 +02:00
parent 454affbdfd
commit 32e81a82c5
4 changed files with 98 additions and 16 deletions

View File

@@ -37,7 +37,7 @@ fun polarOffsetFunc(
noise: (Int, Double, Double) -> Double,
origin: Vector2 = Vector2.ZERO,
): (seed: Int, polar: Polar, offset: Vector2) -> Double {
): (seed: Int, polar: Polar, offset: Vector2) -> Double {
return { seed, polar, offset ->
val c = polar.cartesian + origin + offset
noise(seed, c.x, c.y)
@@ -59,14 +59,15 @@ fun ((Int, Vector2) -> Double).withPolarOffsetInput(origin: Vector2 = Vector2.ZE
polarOffsetFunc(this.withScalarInput(), origin)
fun ((Int, Double, Double) -> Double).fixedRadiusPolar(
radius: Double,
origin: Vector2 = Vector2.ZERO
): (Int, Double) -> Double =
fixedRadiusPolarFunc(this, radius, origin)
private fun example() {
fun example() {
val polarFbmSimplex = polarFunc(noise = fbmFunc2D(noise = ::simplex))
val polarBillowPerlin = polarFunc(noise = billowFunc2D(noise = ::perlin))