![]() |
Public API Reference |
![]() |
Noise module that outputs a weighted blend of the output values from two source modules given the output value supplied by a control module. More...
#include <cstool/noise/module/blend.h>
Public Member Functions | |
Blend () | |
Constructor. | |
const Module & | GetControlModule () const |
Returns the control module. | |
virtual int | GetSourceModuleCount () const |
Returns the number of source modules required by this noise module. | |
virtual double | GetValue (double x, double y, double z) const |
Generates an output value given the coordinates of the specified input value. | |
void | SetControlModule (const Module &controlModule) |
Sets the control module. |
Noise module that outputs a weighted blend of the output values from two source modules given the output value supplied by a control module.
Unlike most other noise modules, the index value assigned to a source module determines its role in the blending operation:
An application can pass the control module to the SetControlModule() method instead of the SetSourceModule() method. This may make the application code easier to read.
This noise module uses linear interpolation to perform the blending operation.
This noise module requires three source modules.
Constructor.
const Module& CS::Math::Noise::Module::Blend::GetControlModule | ( | ) | const [inline] |
Returns the control module.
CS::Math::Noise::ExceptionNoModule | See the preconditions for more information. |
The control module determines the weight of the blending operation. Negative values weigh the blend towards the output value from the source module with an index value of 0. Positive values weigh the blend towards the output value from the source module with an index value of 1.
virtual int CS::Math::Noise::Module::Blend::GetSourceModuleCount | ( | ) | const [inline, virtual] |
Returns the number of source modules required by this noise module.
Implements CS::Math::Noise::Module::Module.
virtual double CS::Math::Noise::Module::Blend::GetValue | ( | double | x, |
double | y, | ||
double | z | ||
) | const [virtual] |
Generates an output value given the coordinates of the specified input value.
x | The x coordinate of the input value. |
y | The y coordinate of the input value. |
z | The z coordinate of the input value. |
Before an application can call this method, it must first connect all required source modules via the SetSourceModule() method. If these source modules are not connected to this noise module, this method raises a debug assertion.
To determine the number of source modules required by this noise module, call the GetSourceModuleCount() method.
Implements CS::Math::Noise::Module::Module.
void CS::Math::Noise::Module::Blend::SetControlModule | ( | const Module & | controlModule | ) | [inline] |
Sets the control module.
controlModule | The control module. |
The control module determines the weight of the blending operation. Negative values weigh the blend towards the output value from the source module with an index value of 0. Positive values weigh the blend towards the output value from the source module with an index value of 1.
This method assigns the control module an index value of 2. Passing the control module to this method produces the same results as passing the control module to the SetSourceModule() method while assigning that noise module an index value of 2.
This control module must exist throughout the lifetime of this noise module unless another control module replaces that control module.