A portable, open-source, coherent noise-generating library for C++
Main Page | Modules | Class Hierarchy | Class List | File List | Class Members # noise::module::Blend Class Reference [Selector Modules] `#include <blend.h>` Inheritance diagram for noise::module::Blend: List of all members. ## Detailed Description 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: Source module 0 (upper left in the diagram) outputs one of the values to blend. Source module 1 (lower left in the diagram) outputs one of the values to blend. Source module 2 (bottom of the diagram) is known as 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. 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.
## 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.
## Member Function Documentation
const Module& noise::module::Blend::GetControlModule | ( |  | ) | const`[inline]`
  | Returns the control module. Returns: A reference to the control module. Precondition: A control module has been added to this noise module via a call to SetSourceModule() or SetControlModule(). Exceptions:
  | 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 noise::module::Blend::GetSourceModuleCount | ( |  | ) | const`[inline, virtual]`
| Returns the number of source modules required by this noise module. Returns: The number of source modules required by this noise module. Implements noise::module::Module.
double Blend::GetValue | ( | double | x,
|  | double | y,
|  | double | z
| ) | const`[virtual]`
  | Generates an output value given the coordinates of the specified input value. Parameters:
  | x | The x coordinate of the input value.
  | y | The y coordinate of the input value.
  | z | The z coordinate of the input value.
Returns: The output value. Precondition: All source modules required by this noise module have been passed to the SetSourceModule() method. 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 noise::module::Module.
void noise::module::Blend::SetControlModule | ( | const Module & | controlModule | ) | `[inline]`
  | Sets the control module. Parameters:
  | 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.
The documentation for this class was generated from the following files: blend.h blend.cpp