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
x
coordinate of the input value. - Source module 2
- specifies the offset to apply to the
y
coordinate of the input value. - Source module 3
- specifies the offset to apply to the
z
coordinate 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
ConstructorDescriptionDisplace()
Displace
(NoiseModule source, NoiseModule xDisplace, NoiseModule yDisplace, NoiseModule zDisplace) Create a new Displace module with the source modules pre-configured. -
Method Summary
Modifier and TypeMethodDescriptiondouble
get
(double x, double y, double z) Generates an output value given the coordinates of the specified input value.void
Set thex
,y
, andz
displacement modules.void
Sets thex
displacement module.void
Sets they
displacement module.void
Sets thez
displacement module.Gets thex
displacement module.Gets they
displacement module.Gets thez
displacement 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
- thex
displacement moduleyDisplace
- they
displacement modulezDisplace
- thez
displacement module
-
-
Method Details
-
xDisplaceModule
Gets thex
displacement module.The
get(double, double, double)
method displaces the input value by adding the output value from this displacement module to thex
coordinate of the input value before returning the output value from the source module.- Returns:
- the
x
displacement module - Throws:
NoModuleException
- if this displacement module has not yet been set
-
setXDisplaceModule
Sets thex
displacement module.The
get(double, double, double)
method displaces the input value by adding the output value from this displacement module to thex
coordinate of the input value before returning the output value from the source module.This method assigns an index value of
1
to thex
displacement 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 thex
coordinate
-
yDisplaceModule
Gets they
displacement module.The
get(double, double, double)
method displaces the input value by adding the output value from this displacement module to they
coordinate of the input value before returning the output value from the source module.- Returns:
- the
y
displacement module - Throws:
NoModuleException
- if this displacement module has not yet been set
-
setYDisplaceModule
Sets they
displacement module.The
get(double, double, double)
method displaces the input value by adding the output value from this displacement module to they
coordinate of the input value before returning the output value from the source module.This method assigns an index value of
2
to they
displacement 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 they
coordinate
-
zDisplaceModule
Gets thez
displacement module.The
get(double, double, double)
method displaces the input value by adding the output value from this displacement module to thez
coordinate of the input value before returning the output value from the source module.- Returns:
- the
z
displacement module - Throws:
NoModuleException
- if this displacement module has not yet been set
-
setZDisplaceModule
Sets thez
displacement module.The
get(double, double, double)
method displaces the input value by adding the output value from this displacement module to thez
coordinate of the input value before returning the output value from the source module.This method assigns an index value of
3
to thez
displacement 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 thez
coordinate
-
setDisplaceModules
Set thex
,y
, andz
displacement 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
1
to thex
displacement module, an index value of2
to they
displacement module, and an index value of3
to thez
displacement module.- Parameters:
x
- module that displaces thex
coordinate of the input valuey
- module that displaces they
coordinate of the input valuez
- module that displaces thez
coordinate of the input value
-
get
public double get(double x, double y, double z) Description copied from class:NoiseModule
Generates 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:
get
in classNoiseModule
- Parameters:
x
- thex
coordinate of the input valuey
- they
coordinate of the input valuez
- thez
coordinate of the input value- Returns:
- the output value
-