noise/fractal: add default constructors
we often use these in arrays which are annoying to construct otherwise
This commit is contained in:
parent
02e0885ee9
commit
51b8ef762a
@ -52,7 +52,7 @@ namespace util { namespace noise { namespace fractal {
|
|||||||
value_t lacunarity,
|
value_t lacunarity,
|
||||||
value_t amplitude,
|
value_t amplitude,
|
||||||
value_t gain);
|
value_t gain);
|
||||||
fbm (seed_t);
|
explicit fbm (seed_t = 0);
|
||||||
|
|
||||||
value_t operator() (point_t) const noexcept;
|
value_t operator() (point_t) const noexcept;
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ namespace util { namespace noise { namespace fractal {
|
|||||||
value_t gain,
|
value_t gain,
|
||||||
value_t offset);
|
value_t offset);
|
||||||
|
|
||||||
hetero (seed_t);
|
explicit hetero (seed_t = 0);
|
||||||
|
|
||||||
constexpr value_t offset (void) const;
|
constexpr value_t offset (void) const;
|
||||||
value_t offset (value_t);
|
value_t offset (value_t);
|
||||||
|
@ -47,7 +47,7 @@ namespace util { namespace noise { namespace fractal {
|
|||||||
value_t gain,
|
value_t gain,
|
||||||
value_t offset);
|
value_t offset);
|
||||||
|
|
||||||
hmf (seed_t);
|
explicit hmf (seed_t = 0);
|
||||||
|
|
||||||
value_t operator() (point_t) const;
|
value_t operator() (point_t) const;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ namespace util { namespace noise { namespace fractal {
|
|||||||
value_t gain,
|
value_t gain,
|
||||||
value_t offset);
|
value_t offset);
|
||||||
|
|
||||||
rmf (seed_t);
|
explicit rmf (seed_t = 0);
|
||||||
|
|
||||||
value_t operator() (point_t) const;
|
value_t operator() (point_t) const;
|
||||||
|
|
||||||
|
@ -57,10 +57,7 @@ namespace util { namespace noise {
|
|||||||
// XXX: use a union to defer initialization of pertubation fractals in
|
// XXX: use a union to defer initialization of pertubation fractals in
|
||||||
// the constructor. i know this is horrible, but there's no time to
|
// the constructor. i know this is horrible, but there's no time to
|
||||||
// write the proper generator constructor to pass out the seeds.
|
// write the proper generator constructor to pass out the seeds.
|
||||||
union {
|
|
||||||
char _;
|
|
||||||
P perturb[S];
|
P perturb[S];
|
||||||
};
|
|
||||||
|
|
||||||
scale_t scale;
|
scale_t scale;
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@ namespace util { namespace noise {
|
|||||||
scale (_scale)
|
scale (_scale)
|
||||||
{
|
{
|
||||||
for (auto &p: perturb)
|
for (auto &p: perturb)
|
||||||
new (&p) P (_seed = hash::wang (_seed));
|
p.seed (_seed = hash::wang (_seed));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user