diff --git a/noise/turbulence.hpp b/noise/turbulence.hpp index f24057ce..9ccb10eb 100644 --- a/noise/turbulence.hpp +++ b/noise/turbulence.hpp @@ -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; diff --git a/noise/turbulence.ipp b/noise/turbulence.ipp index f0ebd8a4..8d66bb64 100644 --- a/noise/turbulence.ipp +++ b/noise/turbulence.ipp @@ -32,6 +32,29 @@ namespace util { namespace noise { scale (_scale) { ; } + //////////////////////////////////////////////////////////////////////////// + template + typename turbulence::seed_t + turbulence::seed (void) const + { + return data.seed (); + } + + + //------------------------------------------------------------------------- + template + typename turbulence::seed_t + turbulence::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