Class WorleyNoiseGenerator.WorleyNoiseBuilder
java.lang.Object
de.articdive.jnoise.generators.noisegen.worley.WorleyNoiseGenerator.WorleyNoiseBuilder
- All Implemented Interfaces:
NoiseSourceBuilder
- Enclosing class:
- WorleyNoiseGenerator
@NullMarked
public static final class WorleyNoiseGenerator.WorleyNoiseBuilder
extends Object
implements NoiseSourceBuilder
Builder for the
WorleyNoiseGenerator
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the NoiseSource.setDepth
(int depth) Sets the depth for theWorleyNoiseGenerator
.setDistanceFunction
(DistanceFunction distanceFunction) Sets the distance function for theWorleyNoiseGenerator
.setFeaturePointAmountFunction
(IntToLongFunction fpAmountFunction) Sets the function supplying the amount of feature points in a unit section.setMinFunction
(Combiner minFunction) Sets the minimization function for theWorleyNoiseGenerator
.setReturnDistanceFunction
(ReturnDistanceFunction returnDistanceFunction) Sets the return distance function for theWorleyNoiseGenerator
.setSeed
(long seed) Sets the seed for theWorleyNoiseGenerator
.
-
Method Details
-
setSeed
Sets the seed for theWorleyNoiseGenerator
.- Parameters:
seed
- the new seed for theWorleyNoiseGenerator
.- Returns:
WorleyNoiseGenerator.WorleyNoiseBuilder
this
-
setDepth
Sets the depth for theWorleyNoiseGenerator
. Depth represents how many of the shortest distances will be used. As an example a depth of 1, means only the shortest distance will be passed to the return type function (See:setReturnDistanceFunction(ReturnDistanceFunction)
) A depth of 2, means the shortest distance, and the second shortest distance will be passed.- Parameters:
depth
- The new depth for theWorleyNoiseGenerator
.- Returns:
WorleyNoiseGenerator.WorleyNoiseBuilder
this
-
setDistanceFunction
public WorleyNoiseGenerator.WorleyNoiseBuilder setDistanceFunction(DistanceFunction distanceFunction) Sets the distance function for theWorleyNoiseGenerator
.- Parameters:
distanceFunction
- The newDistanceFunction
for theWorleyNoiseGenerator
.- Returns:
WorleyNoiseGenerator.WorleyNoiseBuilder
this
-
setFeaturePointAmountFunction
public WorleyNoiseGenerator.WorleyNoiseBuilder setFeaturePointAmountFunction(IntToLongFunction fpAmountFunction) Sets the function supplying the amount of feature points in a unit section. Increasing this number can add more "features" (points) to one grid in a worley generation step. It is recommended to keep this at 1 (the default) for performance reasons! The function must not return negative values.- Parameters:
fpAmountFunction
- The new (feature point amount function) for theWorleyNoiseGenerator
- Returns:
WorleyNoiseGenerator.WorleyNoiseBuilder
this
-
setReturnDistanceFunction
public WorleyNoiseGenerator.WorleyNoiseBuilder setReturnDistanceFunction(ReturnDistanceFunction returnDistanceFunction) Sets the return distance function for theWorleyNoiseGenerator
. The return distance function takes an array of shortest distances (See:setDepth(int)
for length). The array of shortest distances is converted to the return value. Typically all one needs is the shortest distance (See:ReturnDistanceFunctionType.DISTANCE_0
). However taking the second shortest, or a combination can be interesting.- Parameters:
returnDistanceFunction
- The new return distance function for theWorleyNoiseGenerator
.- Returns:
WorleyNoiseGenerator.WorleyNoiseBuilder
this
-
setMinFunction
Sets the minimization function for theWorleyNoiseGenerator
. A normal min FunctionMath.min(int, int)
is a non-continious function and can have effects on smoothness.- Parameters:
minFunction
- The new minimization function for theWorleyNoiseGenerator
.- Returns:
WorleyNoiseGenerator.WorleyNoiseBuilder
this
-
build
Description copied from interface:NoiseSourceBuilder
Builds the NoiseSource.- Specified by:
build
in interfaceNoiseSourceBuilder
- Returns:
NoiseSource
resulting from the parameters of theNoiseSourceBuilder
.
-