Unlike most other noise modules, the index value assigned to a source module determines its role in the displacement operation:
- Source module 0
- Outputs a value
- Source module 1
- specifies the offset to apply to the
xcoordinate of the input value. - Source module 2
- specifies the offset to apply to the
ycoordinate of the input value. - Source module 3
- specifies the offset to apply to the
zcoordinate of the input value.
The get(double, double, double) method modifies the
(x, y, z) coordinates of the input value using the output values from
the three displacement modules before retrieving the output value from the
source module.
The Turbulence noise module is a special case of the displacement
module. Internally, there are three Perlin-noise modules that perform
the displacement operation.
- Source Modules
- This module requires 4 source modules.
-
Field Summary
Fields inherited from class org.spongepowered.noise.module.NoiseModule
sourceModule -
Constructor Summary
ConstructorsConstructorDescriptionDisplace()Displace(NoiseModule source, NoiseModule xDisplace, NoiseModule yDisplace, NoiseModule zDisplace) Create a new Displace module with the source modules pre-configured. -
Method Summary
Modifier and TypeMethodDescriptiondoubleget(double x, double y, double z) Generates an output value given the coordinates of the specified input value.voidSet thex,y, andzdisplacement modules.voidSets thexdisplacement module.voidSets theydisplacement module.voidSets thezdisplacement module.Gets thexdisplacement module.Gets theydisplacement module.Gets thezdisplacement module.Methods inherited from class org.spongepowered.noise.module.NoiseModule
setSourceModule, sourceModule, sourceModuleCount
-
Constructor Details
-
Displace
public Displace() -
Displace
public Displace(NoiseModule source, NoiseModule xDisplace, NoiseModule yDisplace, NoiseModule zDisplace) Create a new Displace module with the source modules pre-configured.- Parameters:
source- the sourcexDisplace- thexdisplacement moduleyDisplace- theydisplacement modulezDisplace- thezdisplacement module
-
-
Method Details
-
xDisplaceModule
Gets thexdisplacement module.The
get(double, double, double)method displaces the input value by adding the output value from this displacement module to thexcoordinate of the input value before returning the output value from the source module.- Returns:
- the
xdisplacement module - Throws:
NoModuleException- if this displacement module has not yet been set
-
setXDisplaceModule
Sets thexdisplacement module.The
get(double, double, double)method displaces the input value by adding the output value from this displacement module to thexcoordinate of the input value before returning the output value from the source module.This method assigns an index value of
1to thexdisplacement module. Passing the displacement module to this method produces the same results as passing the displacement module to theNoiseModule.setSourceModule(int, NoiseModule)method while assigning it an index value of1.- Parameters:
x- displacement module that displaces thexcoordinate
-
yDisplaceModule
Gets theydisplacement module.The
get(double, double, double)method displaces the input value by adding the output value from this displacement module to theycoordinate of the input value before returning the output value from the source module.- Returns:
- the
ydisplacement module - Throws:
NoModuleException- if this displacement module has not yet been set
-
setYDisplaceModule
Sets theydisplacement module.The
get(double, double, double)method displaces the input value by adding the output value from this displacement module to theycoordinate of the input value before returning the output value from the source module.This method assigns an index value of
2to theydisplacement module. Passing the displacement module to this method produces the same results as passing the displacement module to theNoiseModule.setSourceModule(int, NoiseModule)method while assigning it an index value of2.- Parameters:
y- displacement module that displaces theycoordinate
-
zDisplaceModule
Gets thezdisplacement module.The
get(double, double, double)method displaces the input value by adding the output value from this displacement module to thezcoordinate of the input value before returning the output value from the source module.- Returns:
- the
zdisplacement module - Throws:
NoModuleException- if this displacement module has not yet been set
-
setZDisplaceModule
Sets thezdisplacement module.The
get(double, double, double)method displaces the input value by adding the output value from this displacement module to thezcoordinate of the input value before returning the output value from the source module.This method assigns an index value of
3to thezdisplacement module. Passing the displacement module to this method produces the same results as passing the displacement module to theNoiseModule.setSourceModule(int, NoiseModule)method while assigning it an index value of3.- Parameters:
z- displacement module that displaces thezcoordinate
-
setDisplaceModules
Set thex,y, andzdisplacement modules.The
get(double, double, double)method displaces the input value by adding the output value from each of the displacement modules to the corresponding coordinates of the input value before returning the output value from the source module.This method assigns an index value of
1to thexdisplacement module, an index value of2to theydisplacement module, and an index value of3to thezdisplacement module.- Parameters:
x- module that displaces thexcoordinate of the input valuey- module that displaces theycoordinate of the input valuez- module that displaces thezcoordinate of the input value
-
get
public double get(double x, double y, double z) Description copied from class:NoiseModuleGenerates an output value given the coordinates of the specified input value.All source modules required by this module must have been connected with the
NoiseModule.setSourceModule(int, NoiseModule)method. If these source modules are not connected, this method will throw aNoModuleException.To determine the number of source modules required by this noise module, call the
NoiseModule.sourceModuleCount()method.- Specified by:
getin classNoiseModule- Parameters:
x- thexcoordinate of the input valuey- theycoordinate of the input valuez- thezcoordinate of the input value- Returns:
- the output value
-