Skip to content

Commit

Permalink
Merge pull request #596 from g-truc/dim
Browse files Browse the repository at this point in the history
Parameterize on dimensions #584 for vectors and matrices types #596
  • Loading branch information
Groovounet authored Jan 3, 2017
2 parents 06f0840 + b7dac69 commit e8962dd
Show file tree
Hide file tree
Showing 257 changed files with 12,639 additions and 12,771 deletions.
54 changes: 27 additions & 27 deletions glm/detail/_noise.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,93 +11,93 @@
namespace glm{
namespace detail
{
template <typename T>
template<typename T>
GLM_FUNC_QUALIFIER T mod289(T const & x)
{
return x - floor(x * (static_cast<T>(1.0) / static_cast<T>(289.0))) * static_cast<T>(289.0);
}

template <typename T>
template<typename T>
GLM_FUNC_QUALIFIER T permute(T const & x)
{
return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> permute(tvec2<T, P> const & x)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<2, T, P> permute(vec<2, T, P> const & x)
{
return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> permute(tvec3<T, P> const & x)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<3, T, P> permute(vec<3, T, P> const & x)
{
return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> permute(tvec4<T, P> const & x)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<4, T, P> permute(vec<4, T, P> const & x)
{
return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
}
/*
template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> permute(vecType<T, P> const & x)
template<typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> permute(vecType<L, T, P> const & x)
{
return mod289(((x * T(34)) + T(1)) * x);
}
*/
template <typename T>
template<typename T>
GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> taylorInvSqrt(tvec2<T, P> const & r)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<2, T, P> taylorInvSqrt(vec<2, T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> taylorInvSqrt(tvec3<T, P> const & r)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<3, T, P> taylorInvSqrt(vec<3, T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> taylorInvSqrt(tvec4<T, P> const & r)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<4, T, P> taylorInvSqrt(vec<4, T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
/*
template <typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> taylorInvSqrt(vecType<T, P> const & r)
template<typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> taylorInvSqrt(vecType<L, T, P> const & r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
}
*/

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec2<T, P> fade(tvec2<T, P> const & t)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<2, T, P> fade(vec<2, T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec3<T, P> fade(tvec3<T, P> const & t)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<3, T, P> fade(vec<3, T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}

template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> fade(tvec4<T, P> const & t)
template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<4, T, P> fade(vec<4, T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
/*
template <typename T, precision P, template <typename> class vecType>
GLM_FUNC_QUALIFIER vecType<T, P> fade(vecType<T, P> const & t)
template<typename T, precision P, template<typename> class vecType>
GLM_FUNC_QUALIFIER vecType<L, T, P> fade(vecType<L, T, P> const & t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
}
Expand Down
Loading

0 comments on commit e8962dd

Please sign in to comment.