diff options
author | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-07-08 12:05:44 -0300 |
---|---|---|
committer | Thales Lima Oliveira <thaleslima.ufu@gmail.com> | 2020-07-08 12:05:44 -0300 |
commit | cc2e40324d884bc0417809980a696a5084e661d7 (patch) | |
tree | 9620dfa32e44af5c125aac2c9bce36011ad27b8b /Project/glm/detail/_noise.hpp | |
parent | ae765504642759ba4addbf91d62f167ba5f063a3 (diff) | |
download | PSP.git-cc2e40324d884bc0417809980a696a5084e661d7.tar.gz PSP.git-cc2e40324d884bc0417809980a696a5084e661d7.tar.xz PSP.git-cc2e40324d884bc0417809980a696a5084e661d7.zip |
GLM folder changed
Diffstat (limited to 'Project/glm/detail/_noise.hpp')
-rw-r--r-- | Project/glm/detail/_noise.hpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Project/glm/detail/_noise.hpp b/Project/glm/detail/_noise.hpp new file mode 100644 index 0000000..5a874a0 --- /dev/null +++ b/Project/glm/detail/_noise.hpp @@ -0,0 +1,81 @@ +#pragma once + +#include "../common.hpp" + +namespace glm{ +namespace detail +{ + 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> + GLM_FUNC_QUALIFIER T permute(T const& x) + { + return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x); + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<2, T, Q> permute(vec<2, T, Q> const& x) + { + return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x); + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<3, T, Q> permute(vec<3, T, Q> const& x) + { + return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x); + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<4, T, Q> permute(vec<4, T, Q> const& x) + { + return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x); + } + + template<typename T> + GLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r) + { + return static_cast<T>(1.79284291400159) - static_cast<T>(0.85373472095314) * r; + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r) + { + return static_cast<T>(1.79284291400159) - static_cast<T>(0.85373472095314) * r; + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r) + { + return static_cast<T>(1.79284291400159) - static_cast<T>(0.85373472095314) * r; + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r) + { + return static_cast<T>(1.79284291400159) - static_cast<T>(0.85373472095314) * r; + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t) + { + return (t * t * t) * (t * (t * static_cast<T>(6) - static_cast<T>(15)) + static_cast<T>(10)); + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t) + { + return (t * t * t) * (t * (t * static_cast<T>(6) - static_cast<T>(15)) + static_cast<T>(10)); + } + + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t) + { + return (t * t * t) * (t * (t * static_cast<T>(6) - static_cast<T>(15)) + static_cast<T>(10)); + } +}//namespace detail +}//namespace glm + |