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