n/fractal: extract constants into named variables
This commit is contained in:
parent
9701290c4b
commit
6c27fa420a
@ -88,7 +88,12 @@ fbm<T,B>::fbm (unsigned _octaves,
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <typename T, typename B>
|
template <typename T, typename B>
|
||||||
fbm<T,B>::fbm ():
|
fbm<T,B>::fbm ():
|
||||||
fbm<T,B> (8, T(0.1), 2, 1, 1/T(2), rand ())
|
fbm<T,B> (DEFAULT_OCTAVES,
|
||||||
|
DEFAULT_FREQUENCY,
|
||||||
|
DEFAULT_LACUNARITY,
|
||||||
|
DEFAULT_AMPLITUDE,
|
||||||
|
DEFAULT_GAIN,
|
||||||
|
rand ())
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +153,12 @@ rmf<T,B>::rmf (unsigned _octaves,
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <typename T, typename B>
|
template <typename T, typename B>
|
||||||
rmf<T,B>::rmf ():
|
rmf<T,B>::rmf ():
|
||||||
rmf<T,B> (6, T(1), 2, 1, T(2), rand ())
|
rmf<T,B> (DEFAULT_OCTAVES,
|
||||||
|
DEFAULT_FREQUENCY,
|
||||||
|
DEFAULT_LACUNARITY,
|
||||||
|
DEFAULT_AMPLITUDE,
|
||||||
|
DEFAULT_GAIN,
|
||||||
|
rand ())
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +50,12 @@ namespace util {
|
|||||||
struct fbm : public fractal<T> {
|
struct fbm : public fractal<T> {
|
||||||
using seed_t = typename basis<T>::seed_t;
|
using seed_t = typename basis<T>::seed_t;
|
||||||
|
|
||||||
|
static constexpr unsigned DEFAULT_OCTAVES = 8;
|
||||||
|
static constexpr T DEFAULT_FREQUENCY = T(0.1);
|
||||||
|
static constexpr T DEFAULT_LACUNARITY = 2;
|
||||||
|
static constexpr T DEFAULT_AMPLITUDE = 1;
|
||||||
|
static constexpr T DEFAULT_GAIN = 1 / T(2);
|
||||||
|
|
||||||
fbm (unsigned octaves,
|
fbm (unsigned octaves,
|
||||||
T frequency,
|
T frequency,
|
||||||
T lacunarity,
|
T lacunarity,
|
||||||
@ -71,7 +77,7 @@ namespace util {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Rigid Multifractal noise summation, based on Musgrave's algorithm
|
/// Rigid Multifractal summation, based on Musgrave's algorithm
|
||||||
///
|
///
|
||||||
/// octaves: count of layers to be summed
|
/// octaves: count of layers to be summed
|
||||||
/// frequency: point scaling factor for the base octave
|
/// frequency: point scaling factor for the base octave
|
||||||
@ -80,6 +86,12 @@ namespace util {
|
|||||||
struct rmf : public fractal<T> {
|
struct rmf : public fractal<T> {
|
||||||
using seed_t = typename basis<T>::seed_t;
|
using seed_t = typename basis<T>::seed_t;
|
||||||
|
|
||||||
|
static constexpr unsigned DEFAULT_OCTAVES = 5;
|
||||||
|
static constexpr T DEFAULT_FREQUENCY = T(1);
|
||||||
|
static constexpr T DEFAULT_LACUNARITY = 2;
|
||||||
|
static constexpr T DEFAULT_AMPLITUDE = 1;
|
||||||
|
static constexpr T DEFAULT_GAIN = 2;
|
||||||
|
|
||||||
rmf (unsigned octaves,
|
rmf (unsigned octaves,
|
||||||
T frequency,
|
T frequency,
|
||||||
T lacunarity,
|
T lacunarity,
|
||||||
|
Loading…
Reference in New Issue
Block a user