3rdparty/glm/doc/api/a00003_source.html
| | 0.9.8 |
_noise.hpp
Go to the documentation of this file.
1
4 #pragma once
5
6 #include "../vec2.hpp"
7 #include "../vec3.hpp"
8 #include "../vec4.hpp"
9 #include "../common.hpp"
10
11 namespace glm{
12 namespace detail
13 {
14template <typename T>
15 GLM_FUNC_QUALIFIER T mod289(T const & x)
16 {
17return x - floor(x * static_cast<T>(1.0) / static_cast<T>(289.0)) * static_cast<T>(289.0);
18 }
19
20template <typename T>
21 GLM_FUNC_QUALIFIER T permute(T const & x)
22 {
23return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
24 }
25
26template <typename T, precision P>
27 GLM_FUNC_QUALIFIER tvec2<T, P> permute(tvec2<T, P> const & x)
28 {
29return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
30 }
31
32template <typename T, precision P>
33 GLM_FUNC_QUALIFIER tvec3<T, P> permute(tvec3<T, P> const & x)
34 {
35return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
36 }
37
38template <typename T, precision P>
39 GLM_FUNC_QUALIFIER tvec4<T, P> permute(tvec4<T, P> const & x)
40 {
41return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
42 }
43 /*
44 template <typename T, precision P, template<typename> class vecType>
45 GLM_FUNC_QUALIFIER vecType<T, P> permute(vecType<T, P> const & x)
46 {
47 return mod289(((x * T(34)) + T(1)) * x);
48 }
49 */
50template <typename T>
51 GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
52 {
53return T(1.79284291400159) - T(0.85373472095314) * r;
54 }
55
56template <typename T, precision P>
57 GLM_FUNC_QUALIFIER tvec2<T, P> taylorInvSqrt(tvec2<T, P> const & r)
58 {
59return T(1.79284291400159) - T(0.85373472095314) * r;
60 }
61
62template <typename T, precision P>
63 GLM_FUNC_QUALIFIER tvec3<T, P> taylorInvSqrt(tvec3<T, P> const & r)
64 {
65return T(1.79284291400159) - T(0.85373472095314) * r;
66 }
67
68template <typename T, precision P>
69 GLM_FUNC_QUALIFIER tvec4<T, P> taylorInvSqrt(tvec4<T, P> const & r)
70 {
71return T(1.79284291400159) - T(0.85373472095314) * r;
72 }
73 /*
74 template <typename T, precision P, template<typename> class vecType>
75 GLM_FUNC_QUALIFIER vecType<T, P> taylorInvSqrt(vecType<T, P> const & r)
76 {
77 return T(1.79284291400159) - T(0.85373472095314) * r;
78 }
79 */
80
81template <typename T, precision P>
82 GLM_FUNC_QUALIFIER tvec2<T, P> fade(tvec2<T, P> const & t)
83 {
84return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
85 }
86
87template <typename T, precision P>
88 GLM_FUNC_QUALIFIER tvec3<T, P> fade(tvec3<T, P> const & t)
89 {
90return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
91 }
92
93template <typename T, precision P>
94 GLM_FUNC_QUALIFIER tvec4<T, P> fade(tvec4<T, P> const & t)
95 {
96return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
97 }
98 /*
99 template <typename T, precision P, template <typename> class vecType>
100 GLM_FUNC_QUALIFIER vecType<T, P> fade(vecType<T, P> const & t)
101 {
102 return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
103 }
104 */
105 }//namespace detail
106 }//namespace glm
107
Definition: _noise.hpp:11
GLM_FUNC_DECL vecType< T, P > floor(vecType< T, P > const &x)
Returns a value equal to the nearest integer that is less then or equal to x.
Generated by 1.8.10