-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FadeFunctions to Perlin and Value Noise.
- Loading branch information
Showing
10 changed files
with
138 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
group = "de.articdive" | ||
version = "2.0.1" | ||
version = "2.1.0-SNAPSHOT" | ||
|
||
plugins { | ||
java | ||
|
31 changes: 31 additions & 0 deletions
31
src/main/java/de/articdive/jnoise/fade_functions/FadeFunction.java
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,31 @@ | ||
/* | ||
* JNoise | ||
* Copyright (C) 2021 Articdive (Lukas Mansour) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package de.articdive.jnoise.fade_functions; | ||
|
||
/** | ||
* @author Lukas Mansour | ||
*/ | ||
public interface FadeFunction { | ||
/** | ||
* Specifies a value to fade, this is used to remove interpolation artefacts. | ||
* | ||
* @param t value (position) in the unit cube to fade. | ||
*/ | ||
double fade(double t); | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/de/articdive/jnoise/fade_functions/FadeFunctionType.java
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,43 @@ | ||
/* | ||
* JNoise | ||
* Copyright (C) 2021 Articdive (Lukas Mansour) | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package de.articdive.jnoise.fade_functions; | ||
|
||
/** | ||
* @author Lukas Mansour | ||
*/ | ||
public enum FadeFunctionType implements FadeFunction { | ||
NONE { | ||
@Override | ||
public double fade(double t) { | ||
return t; | ||
} | ||
}, | ||
SMOOTHSTEP { | ||
@Override | ||
public double fade(double t) { | ||
return t * t * (3 - 2 * t); // -(2t^3) + 3t^2 | ||
} | ||
}, | ||
IMPROVED_PERLIN_NOISE { | ||
@Override | ||
public double fade(double t) { | ||
return t * t * t * (t * (t * 6 - 15) + 10); // 6t^5 - (15t^4) + 10t^3 | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.