CrystalSpace

Public API Reference

CS::Math::Noise::Module::Displace Class Reference
[Transformer Modules]

Noise module that uses three source modules to displace each coordinate of the input value before returning the output value from a source module. More...

#include <cstool/noise/module/displace.h>

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

List of all members.

Public Member Functions

 Displace ()
 Constructor.
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.
const ModuleGetXDisplaceModule () const
 Returns the x displacement module.
const ModuleGetYDisplaceModule () const
 Returns the y displacement module.
const ModuleGetZDisplaceModule () const
 Returns the z displacement module.
void SetDisplaceModules (const Module &xDisplaceModule, const Module &yDisplaceModule, const Module &zDisplaceModule)
 Sets the x, y, and z displacement modules.
void SetXDisplaceModule (const Module &xDisplaceModule)
 Sets the x displacement module.
void SetYDisplaceModule (const Module &yDisplaceModule)
 Sets the y displacement module.
void SetZDisplaceModule (const Module &zDisplaceModule)
 Sets the z displacement module.

Detailed Description

Noise module that uses three source modules to displace each coordinate of the input value before returning the output value from a source module.

moduledisplace.png

Unlike most other noise modules, the index value assigned to a source module determines its role in the displacement operation:

The GetValue() 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 CS::Math::Noise::Module::Turbulence noise module is a special case of the displacement module; internally, there are three Perlin-noise modules that perform the displacement operation.

This noise module requires four source modules.

Definition at line 68 of file displace.h.


Constructor & Destructor Documentation

CS::Math::Noise::Module::Displace::Displace (  ) 

Constructor.


Member Function Documentation

virtual int CS::Math::Noise::Module::Displace::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 76 of file displace.h.

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

const Module& CS::Math::Noise::Module::Displace::GetXDisplaceModule (  )  const [inline]

Returns the x displacement module.

Returns:
A reference to the x displacement module.
Precondition:
This displacement module has been added to this noise module via a call to SetSourceModule() or SetXDisplaceModule().
Exceptions:
CS::Math::Noise::ExceptionNoModule See the preconditions for more information.

The GetValue() method displaces the input value by adding the output value from this displacement module to the x coordinate of the input value before returning the output value from the source module.

Definition at line 97 of file displace.h.

const Module& CS::Math::Noise::Module::Displace::GetYDisplaceModule (  )  const [inline]

Returns the y displacement module.

Returns:
A reference to the y displacement module.
Precondition:
This displacement module has been added to this noise module via a call to SetSourceModule() or SetYDisplaceModule().
Exceptions:
CS::Math::Noise::ExceptionNoModule See the preconditions for more information.

The GetValue() method displaces the input value by adding the output value from this displacement module to the y coordinate of the input value before returning the output value from the source module.

Definition at line 120 of file displace.h.

const Module& CS::Math::Noise::Module::Displace::GetZDisplaceModule (  )  const [inline]

Returns the z displacement module.

Returns:
A reference to the z displacement module.
Precondition:
This displacement module has been added to this noise module via a call to SetSourceModule() or SetZDisplaceModule().
Exceptions:
CS::Math::Noise::ExceptionNoModule See the preconditions for more information.

The GetValue() method displaces the input value by adding the output value from this displacement module to the z coordinate of the input value before returning the output value from the source module.

Definition at line 143 of file displace.h.

void CS::Math::Noise::Module::Displace::SetDisplaceModules ( const Module xDisplaceModule,
const Module yDisplaceModule,
const Module zDisplaceModule 
) [inline]

Sets the x, y, and z displacement modules.

Parameters:
xDisplaceModule Displacement module that displaces the x coordinate of the input value.
yDisplaceModule Displacement module that displaces the y coordinate of the input value.
zDisplaceModule Displacement module that displaces the z coordinate of the input value.

The GetValue() 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 the x displacement module, an index value of 2 to the y displacement module, and an index value of 3 to the z displacement module.

These displacement modules must exist throughout the lifetime of this noise module unless another displacement module replaces it.

Definition at line 172 of file displace.h.

void CS::Math::Noise::Module::Displace::SetXDisplaceModule ( const Module xDisplaceModule  )  [inline]

Sets the x displacement module.

Parameters:
xDisplaceModule Displacement module that displaces the x coordinate.

The GetValue() method displaces the input value by adding the output value from this displacement module to the x coordinate of the input value before returning the output value from the source module.

This method assigns an index value of 1 to the x displacement module. Passing this displacement module to this method produces the same results as passing this displacement module to the SetSourceModule() method while assigning it an index value of 1.

This displacement module must exist throughout the lifetime of this noise module unless another displacement module replaces it.

Definition at line 197 of file displace.h.

void CS::Math::Noise::Module::Displace::SetYDisplaceModule ( const Module yDisplaceModule  )  [inline]

Sets the y displacement module.

Parameters:
yDisplaceModule Displacement module that displaces the y coordinate.

The GetValue() method displaces the input value by adding the output value from this displacement module to the y coordinate of the input value before returning the output value from the source module.

This method assigns an index value of 2 to the y displacement module. Passing this displacement module to this method produces the same results as passing this displacement module to the SetSourceModule() method while assigning it an index value of 2.

This displacement module must exist throughout the lifetime of this noise module unless another displacement module replaces it.

Definition at line 220 of file displace.h.

void CS::Math::Noise::Module::Displace::SetZDisplaceModule ( const Module zDisplaceModule  )  [inline]

Sets the z displacement module.

Parameters:
zDisplaceModule Displacement module that displaces the z coordinate.

The GetValue() method displaces the input value by adding the output value from this displacement module to the z coordinate of the input value before returning the output value from the source module.

This method assigns an index value of 3 to the z displacement module. Passing this displacement module to this method produces the same results as passing this displacement module to the SetSourceModule() method while assigning it an index value of 3.

This displacement module must exist throughout the lifetime of this noise module unless another displacement module replaces it.

Definition at line 243 of file displace.h.


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

Generated for Crystal Space 2.0 by doxygen 1.6.1