C# Class LibNoise.Modifier.Cache

Noise module that caches the last output value generated by a source module. If an application passes an input value to the GetValue() method that differs from the previously passed-in input value, this noise module instructs the source module to calculate the output value. This value, as well as the ( @a x, @a y, @a z ) coordinates of the input value, are stored (cached) in this noise module. If the application passes an input value to the GetValue() method that is equal to the previously passed-in input value, this noise module returns the cached output value without having the source module recalculate the output value. If an application passes a new source module to the SetSourceModule() method, the cache is invalidated. Caching a noise module is useful if it is used as a source module for multiple noise modules. If a source module is not cached, the source module will redundantly calculate the same output value once for each noise module in which it is included.
Inheritance: ModifierModule, IModule3D
Show file Open project: everbytes/LibNoise

Protected Properties

Property Type Description
_cachedValue float
_isCached bool
_xCache float
_yCache float
_zCache float

Public Methods

Method Description
Cache ( )
Cache ( IModule source )
GetValue ( float x, float y, float z ) : float

Generates an output value given the coordinates of the specified input value.

Method Details

Cache() public method

public Cache ( )

Cache() public method

public Cache ( IModule source )
source IModule

GetValue() public method

Generates an output value given the coordinates of the specified input value.
public GetValue ( float x, float y, float z ) : float
x float The input coordinate on the x-axis.
y float The input coordinate on the y-axis.
z float The input coordinate on the z-axis.
return float

Property Details

_cachedValue protected property

The cached output value at the cached input value.
protected float _cachedValue
return float

_isCached protected property

Determines if a cached output value is stored in this noise module.
protected bool _isCached
return bool

_xCache protected property

x coordinate of the cached input value.
protected float _xCache
return float

_yCache protected property

y coordinate of the cached input value.
protected float _yCache
return float

_zCache protected property

z coordinate of the cached input value.
protected float _zCache
return float