noise: add constexpr to eval functions

This commit is contained in:
Danny Robson 2015-06-01 18:45:47 +10:00
parent 59909ed860
commit 1ec4b7b9a1
14 changed files with 16 additions and 16 deletions

View File

@ -30,7 +30,7 @@ namespace util { namespace noise { namespace basis {
perlin ();
range<T> bounds (void) const;
T operator() (point<2,T>) const;
constexpr T operator() (point<2,T>) const;
seed_t seed;

View File

@ -50,7 +50,7 @@ namespace util { namespace noise { namespace basis {
//-------------------------------------------------------------------------
template <typename T, util::noise::lerp_t<T> L>
T
constexpr T
perlin<T,L>::operator() (util::point<2,T> p) const
{
// extract integer and fractional parts. be careful to always round down

View File

@ -30,7 +30,7 @@ namespace util { namespace noise { namespace basis {
value ();
range<T> bounds (void) const;
T operator() (util::point<2,T>) const;
constexpr T operator() (util::point<2,T>) const;
seed_t seed;

View File

@ -47,7 +47,7 @@ namespace util { namespace noise { namespace basis {
//-------------------------------------------------------------------------
template <typename T, util::noise::lerp_t<T> L>
T
constexpr T
value<T,L>::operator() (util::point<2,T> p) const
{
// extract integer and fractional parts. be careful to always round down

View File

@ -29,7 +29,7 @@ namespace util { namespace noise { namespace basis {
worley ();
range<T> bounds (void) const;
T operator() (util::point<2,T>) const;
constexpr T operator() (util::point<2,T>) const;
seed_t seed;

View File

@ -50,7 +50,7 @@ namespace util { namespace noise { namespace basis {
//-------------------------------------------------------------------------
template <typename T, size_t F>
T
constexpr T
worley<T,F>::operator() (util::point<2,T> p) const
{
// extract integer and fractional parts. be careful to always round down
@ -61,8 +61,8 @@ namespace util { namespace noise { namespace basis {
auto p_rem = abs (p - p_int).template as<point> ();
// setup an array of distances
static constexpr size_t RADIUS = 1;
static constexpr size_t COUNT = pow2 (RADIUS * 2 + 1);
constexpr size_t RADIUS = 1;
constexpr size_t COUNT = pow2 (RADIUS * 2 + 1);
T distances[COUNT] = { std::numeric_limits<T>::quiet_NaN () };
T *cursor = distances;

View File

@ -60,7 +60,7 @@ namespace util { namespace noise { namespace fractal {
T gain;
B basis;
T operator() (util::point<2,T>) const;
constexpr T operator() (util::point<2,T>) const;
};
} } }

View File

@ -58,7 +58,7 @@ namespace util { namespace noise { namespace fractal {
//-------------------------------------------------------------------------
template <typename T, typename B>
T
constexpr T
fbm<T,B>::operator() (util::point<2,T> p) const
{
T total = 0;

View File

@ -44,7 +44,7 @@ namespace util { namespace noise { namespace fractal {
B basis;
T operator() (util::point<2,T>) const;
constexpr T operator() (util::point<2,T>) const;
};
} } }

View File

@ -35,7 +35,7 @@ namespace util { namespace noise { namespace fractal {
//-------------------------------------------------------------------------
template <typename T, typename B>
T
constexpr T
hetero<T,B>::operator() (util::point<2,T> p) const
{
T exponents[octaves];

View File

@ -44,7 +44,7 @@ namespace util { namespace noise { namespace fractal {
B basis;
T operator() (util::point<2,T>) const;
constexpr T operator() (util::point<2,T>) const;
};
} } }

View File

@ -36,7 +36,7 @@ namespace util { namespace noise { namespace fractal {
//-------------------------------------------------------------------------
template <typename T, typename B>
T
constexpr T
hmf<T,B>::operator() (util::point<2,T> p) const
{
T exponents[octaves];

View File

@ -55,7 +55,7 @@ namespace util { namespace noise { namespace fractal {
T gain;
B basis;
T operator() (util::point<2,T>) const;
constexpr T operator() (util::point<2,T>) const;
};
} } }

View File

@ -53,7 +53,7 @@ namespace util { namespace noise { namespace fractal {
//-------------------------------------------------------------------------
template <typename T, typename B>
T
constexpr T
rmf<T,B>::operator() (util::point<2,T> p) const
{
const T offset = 1;