CS::Math::Noise::Module::Blend Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
CS::Math::Noise::Module::Blend Class Reference
Selector Modules

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>`

Inheritance diagram for CS::Math::Noise::Module::Blend:

List of all members.

## 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.

## 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.

Definition at line 69 of file blend.h.

## Constructor & Destructor Documentation

CS::Math::Noise::Module::Blend::Blend | ( |  | ) |

Constructor.

## Member Function Documentation

const Module& CS::Math::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:

  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.

Definition at line 92 of file blend.h.

virtual int CS::Math::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 CS::Math::Noise::Module::Module.

Definition at line 101 of file blend.h.

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.

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 CS::Math::Noise::Module::Module.

void CS::Math::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.

Definition at line 126 of file blend.h.

The documentation for this class was generated from the following file:

- cstool/noise/module/blend.h