mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 10:28:35 +00:00
Implement more noise patterns
This commit is contained in:
@ -0,0 +1,23 @@
|
||||
package com.sk89q.worldedit.math.noise;
|
||||
|
||||
import com.boydti.fawe.object.random.SimplexNoise;
|
||||
import com.sk89q.worldedit.math.Vector2;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
|
||||
public class SimplexNoiseGenerator implements NoiseGenerator {
|
||||
|
||||
@Override
|
||||
public float noise(Vector2 position) {
|
||||
return convert(SimplexNoise.noise(position.getX(), position.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float noise(Vector3 position) {
|
||||
return convert(SimplexNoise.noise(position.getX(), position.getY(), position.getZ()));
|
||||
}
|
||||
|
||||
private float convert(double d) {
|
||||
// we need to go from [-1, 1] to [0, 1] and from double to float
|
||||
return (float) ((d + 1) * 0.5);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user