public class MerlinNoise extends java.lang.Object implements Noise.Noise2D, Noise.Noise3D, java.io.Serializable
Noise.Layered2D
.
Modifier and Type | Field and Description |
---|---|
protected int |
bits |
static MerlinNoise |
instance |
protected int |
resolution |
long |
seed |
Constructor and Description |
---|
MerlinNoise()
Constructor for a default MerlinNoise instance with 8-bit output and resolution 3 (yielding 8x8-cell zones that
share their corners).
|
MerlinNoise(long seed,
int bits,
int resolution)
Constructor for a MerlinNoise instance that allows specification of all parameters.
|
Modifier and Type | Method and Description |
---|---|
int |
getBits() |
double |
getNoise(double x,
double y) |
double |
getNoise(double x,
double y,
double z) |
double |
getNoiseWithSeed(double x,
double y,
double z,
long seed) |
double |
getNoiseWithSeed(double x,
double y,
long seed) |
int |
getResolution() |
long |
getSeed() |
long |
noise2D(long x,
long y)
2D Merlin noise; black and white much of the time but curving instead of angular.
|
long |
noise2D(long x,
long y,
long seed)
2D Merlin noise; black and white much of the time but curving instead of angular.
|
static long |
noise2D(long x,
long y,
long state,
int resolution,
int bits)
2D Merlin noise; black and white much of the time but curving instead of angular.
|
long |
noise3D(long x,
long y,
long z)
3D Merlin noise; black and white much of the time but curving instead of angular.
|
long |
noise3D(long x,
long y,
long z,
long seed)
3D Merlin noise; black and white much of the time but curving instead of angular.
|
static long |
noise3D(long x,
long y,
long z,
long state,
int resolution,
int bits)
3D merlin noise.
|
static int[][] |
preCalcNoise2D(int width,
int height,
long seed)
Generates higher-quality continuous-style noise than the other methods, but requires pre-calculating a grid.
|
void |
setBits(int bits)
Sets the number of bits this will output; 8 is common to produce byte-sized values between 0 and 255.
|
void |
setResolution(int resolution)
Sets the resolution, which is an exponent that determines the width/height of each zone that shares the same four
corners (where only the corners have their own hashed values).
|
void |
setSeed(long seed) |
public static final MerlinNoise instance
public long seed
protected int bits
protected int resolution
public MerlinNoise()
public MerlinNoise(long seed, int bits, int resolution)
seed
- the seed to use to alter the generated noise in noise2D(long, long)
and noise3D(long, long, long)
bits
- the number of bits to output; typically 8 to produce byte-sized valuesresolution
- an exponent that determines the size of a "zone" of cells that blend between the values at the zone's corners; commonly 1-6public long getSeed()
public void setSeed(long seed)
public int getBits()
public void setBits(int bits)
bits
- the number of bits of output each call should generate.public int getResolution()
public void setResolution(int resolution)
resolution
- an int between 0 and 31public long noise2D(long x, long y)
x
- x inputy
- y inputpublic long noise2D(long x, long y, long seed)
x
- x inputy
- y inputseed
- the seed to use to alter the generated noisepublic long noise3D(long x, long y, long z)
x
- x inputy
- y inputz
- z inputpublic long noise3D(long x, long y, long z, long seed)
x
- x inputy
- y inputz
- z inputseed
- the seed to use to alter the generated noisepublic static long noise2D(long x, long y, long state, int resolution, int bits)
x
- x inputy
- y inputstate
- state to adjust the outputresolution
- the number of cells between "vertices" where one hashed value is used fullybits
- how many bits should be used for each (signed long) output; often this is 8 to output a byte-(1L << bits)
to (1L << bits) - 1L
, both inclusivepublic static long noise3D(long x, long y, long z, long state, int resolution, int bits)
x
- x inputy
- y inputz
- z inputstate
- state to adjust the outputresolution
- the number of cells between "vertices" where one hashed value is used fullybits
- how many bits should be used for each (signed long) output; often this is 8 to output a byte-(1L << bits)
to (1L << bits) - 1L
, both inclusivepublic static int[][] preCalcNoise2D(int width, int height, long seed)
width
- the width of the 2D int array to generateheight
- the height of the 2D int array to generateseed
- the RNG seed to use when pseudo-randomly generating the initial white noise this then processespublic double getNoise(double x, double y)
getNoise
in interface Noise.Noise2D
public double getNoiseWithSeed(double x, double y, long seed)
getNoiseWithSeed
in interface Noise.Noise2D
public double getNoise(double x, double y, double z)
getNoise
in interface Noise.Noise3D
public double getNoiseWithSeed(double x, double y, double z, long seed)
getNoiseWithSeed
in interface Noise.Noise3D
Copyright © Eben Howard 2012–2022. All rights reserved.