n/basis: style, whitespace
This commit is contained in:
parent
0f18702ff9
commit
1c9c38e9a7
@ -21,63 +21,62 @@
|
|||||||
#include "lerp.hpp"
|
#include "lerp.hpp"
|
||||||
#include "../range.hpp"
|
#include "../range.hpp"
|
||||||
|
|
||||||
namespace util {
|
namespace util { namespace noise {
|
||||||
namespace noise {
|
template <typename T> using lerp_t = T (*)(T,T,T);
|
||||||
template <typename T> using lerp_t = T (*)(T,T,T);
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
struct basis {
|
|
||||||
typedef uint64_t seed_t;
|
|
||||||
|
|
||||||
basis (seed_t);
|
|
||||||
basis ();
|
|
||||||
virtual ~basis ();
|
|
||||||
|
|
||||||
seed_t seed;
|
|
||||||
|
|
||||||
virtual range<T> bounds (void) const = 0;
|
|
||||||
virtual T operator() (T x, T y) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// Single value per grid space
|
template <typename T>
|
||||||
template <typename T, lerp_t<T>>
|
struct basis {
|
||||||
struct value : public basis<T> {
|
typedef uint64_t seed_t;
|
||||||
using seed_t = typename basis<T>::seed_t;
|
|
||||||
|
|
||||||
value (seed_t);
|
basis (seed_t);
|
||||||
value ();
|
basis ();
|
||||||
|
virtual ~basis ();
|
||||||
|
|
||||||
virtual range<T> bounds (void) const final;
|
seed_t seed;
|
||||||
virtual T operator() (T x, T y) const final;
|
|
||||||
};
|
virtual range<T> bounds (void) const = 0;
|
||||||
|
virtual T operator() (T x, T y) const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Perlin: interpolated value across each grid space
|
/// Single value per grid space
|
||||||
template <typename T, lerp_t<T> L>
|
template <typename T, lerp_t<T>>
|
||||||
struct gradient : public basis<T> {
|
struct value : public basis<T> {
|
||||||
using seed_t = typename basis<T>::seed_t;
|
using seed_t = typename basis<T>::seed_t;
|
||||||
|
|
||||||
gradient (seed_t);
|
value (seed_t);
|
||||||
gradient ();
|
value ();
|
||||||
|
|
||||||
virtual range<T> bounds (void) const final;
|
virtual range<T> bounds (void) const final;
|
||||||
virtual T operator() (T x, T y) const final;
|
virtual T operator() (T x, T y) const final;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Cellular/Worley/Vornoi of order-1
|
/// Perlin: interpolated value across each grid space
|
||||||
template <typename T>
|
template <typename T, lerp_t<T> L>
|
||||||
struct cellular : public basis<T> {
|
struct gradient : public basis<T> {
|
||||||
using seed_t = typename basis<T>::seed_t;
|
using seed_t = typename basis<T>::seed_t;
|
||||||
|
|
||||||
cellular (seed_t);
|
gradient (seed_t);
|
||||||
cellular ();
|
gradient ();
|
||||||
|
|
||||||
virtual range<T> bounds (void) const final;
|
virtual range<T> bounds (void) const final;
|
||||||
virtual T operator() (T x, T y) const final;
|
virtual T operator() (T x, T y) const final;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
/// Cellular/Worley/Vornoi of order-1
|
||||||
|
template <typename T>
|
||||||
|
struct cellular : public basis<T> {
|
||||||
|
using seed_t = typename basis<T>::seed_t;
|
||||||
|
|
||||||
|
cellular (seed_t);
|
||||||
|
cellular ();
|
||||||
|
|
||||||
|
virtual range<T> bounds (void) const final;
|
||||||
|
virtual T operator() (T x, T y) const final;
|
||||||
|
};
|
||||||
|
} }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user