-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added SCurve & Freq modules - improvements to Line module - clean-up of Noise/NoiseUtil
- Loading branch information
Showing
7 changed files
with
133 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package me.dags.noise.func; | ||
|
||
import me.dags.noise.util.NoiseUtil; | ||
|
||
public class SCurve implements CurveFunc { | ||
|
||
private final float lower; | ||
private final float upper; | ||
|
||
public SCurve(float lower, float upper) { | ||
this.lower = lower; | ||
this.upper = upper < 0 ? Math.max(-lower, upper) : upper; | ||
} | ||
|
||
@Override | ||
public float apply(float value) { | ||
return NoiseUtil.pow(value, lower + (upper * value)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package me.dags.noise.modifier; | ||
|
||
import me.dags.noise.Module; | ||
|
||
public class Freq extends Modifier { | ||
|
||
private final Module x; | ||
private final Module y; | ||
|
||
public Freq(Module source, Module x, Module y) { | ||
super(source); | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
@Override | ||
public float getValue(float x, float y) { | ||
float fx = this.x.getValue(x, y); | ||
float fy = this.y.getValue(x, y); | ||
return source.getValue(x * fx, y * fy); | ||
} | ||
|
||
@Override | ||
public float modify(float x, float y, float noiseValue) { | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters