n/turbulence: add seed accessors

This commit is contained in:
Danny Robson 2015-06-11 19:32:57 +10:00
parent 5fbfa94dac
commit 9cb9ef3811
2 changed files with 26 additions and 0 deletions

View File

@ -34,6 +34,9 @@ namespace util { namespace noise {
using seed_t = uint64_t;
turbulence (seed_t, vector<2,T> scale);
seed_t seed (seed_t);
seed_t seed (void) const;
constexpr T operator() (point<2,T>) const;
D data;

View File

@ -32,6 +32,29 @@ namespace util { namespace noise {
scale (_scale)
{ ; }
////////////////////////////////////////////////////////////////////////////
template <typename T, typename D, typename P>
typename turbulence<T,D,P>::seed_t
turbulence<T,D,P>::seed (void) const
{
return data.seed ();
}
//-------------------------------------------------------------------------
template <typename T, typename D, typename P>
typename turbulence<T,D,P>::seed_t
turbulence<T,D,P>::seed (seed_t _seed)
{
auto ret = _seed;
data.seed (_seed); _seed = hash::wang (_seed);
perturb[0].seed (_seed); _seed = hash::wang (_seed);
perturb[1].seed (_seed); _seed = hash::wang (_seed);
return ret;
}
///////////////////////////////////////////////////////////////////////////
template <typename T, typename D, typename P>