n/turbulence: add seed accessors
This commit is contained in:
parent
5fbfa94dac
commit
9cb9ef3811
@ -34,6 +34,9 @@ namespace util { namespace noise {
|
|||||||
using seed_t = uint64_t;
|
using seed_t = uint64_t;
|
||||||
turbulence (seed_t, vector<2,T> scale);
|
turbulence (seed_t, vector<2,T> scale);
|
||||||
|
|
||||||
|
seed_t seed (seed_t);
|
||||||
|
seed_t seed (void) const;
|
||||||
|
|
||||||
constexpr T operator() (point<2,T>) const;
|
constexpr T operator() (point<2,T>) const;
|
||||||
|
|
||||||
D data;
|
D data;
|
||||||
|
@ -32,6 +32,29 @@ namespace util { namespace noise {
|
|||||||
scale (_scale)
|
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>
|
template <typename T, typename D, typename P>
|
||||||
|
Loading…
Reference in New Issue
Block a user