GLM 0.9.5

- Main Page
- Related Pages
- Modules
- Namespaces
- Files

- File List

_noise.hpp
Go to the documentation of this file.
1
29 #ifndef GLM_DETAIL_NOISE_INCLUDED
30 #define GLM_DETAIL_NOISE_INCLUDED
31
32 namespace glm{
33 namespace detail
34 {
35 template <typename T>
36 GLM_FUNC_QUALIFIER T mod289(T const & x)
37 {
38 return x - floor(x * static_cast<T>(1.0) / static_cast<T>(289.0)) * static_cast<T>(289.0);
39 }
40
41 template <typename T>
42 GLM_FUNC_QUALIFIER T permute(T const & x)
43 {
44 return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
45 }
46
47 template <typename T, precision P>
48 GLM_FUNC_QUALIFIER tvec2<T, P> permute(tvec2<T, P> const & x)
49 {
50 return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
51 }
52
53 template <typename T, precision P>
54 GLM_FUNC_QUALIFIER tvec3<T, P> permute(tvec3<T, P> const & x)
55 {
56 return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
57 }
58
59 template <typename T, precision P>
60 GLM_FUNC_QUALIFIER tvec4<T, P> permute(tvec4<T, P> const & x)
61 {
62 return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
63 }
64 /*
65 template <typename T, precision P, template<typename> class vecType>
66 GLM_FUNC_QUALIFIER vecType<T, P> permute(vecType<T, P> const & x)
67 {
68 return mod289(((x * T(34)) + T(1)) * x);
69 }
70 */
71 template <typename T>
72 GLM_FUNC_QUALIFIER T taylorInvSqrt(T const & r)
73 {
74 return T(1.79284291400159) - T(0.85373472095314) * r;
75 }
76
77 template <typename T, precision P>
78 GLM_FUNC_QUALIFIER detail::tvec2<T, P> taylorInvSqrt(detail::tvec2<T, P> const & r)
79 {
80 return T(1.79284291400159) - T(0.85373472095314) * r;
81 }
82
83 template <typename T, precision P>
84 GLM_FUNC_QUALIFIER detail::tvec3<T, P> taylorInvSqrt(detail::tvec3<T, P> const & r)
85 {
86 return T(1.79284291400159) - T(0.85373472095314) * r;
87 }
88
89 template <typename T, precision P>
90 GLM_FUNC_QUALIFIER detail::tvec4<T, P> taylorInvSqrt(detail::tvec4<T, P> const & r)
91 {
92 return T(1.79284291400159) - T(0.85373472095314) * r;
93 }
94 /*
95 template <typename T, precision P, template<typename> class vecType>
96 GLM_FUNC_QUALIFIER vecType<T, P> taylorInvSqrt(vecType<T, P> const & r)
97 {
98 return T(1.79284291400159) - T(0.85373472095314) * r;
99 }
100 */
101
102 template <typename T, precision P>
103 GLM_FUNC_QUALIFIER detail::tvec2<T, P> fade(detail::tvec2<T, P> const & t)
104 {
105 return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
106 }
107
108 template <typename T, precision P>
109 GLM_FUNC_QUALIFIER detail::tvec3<T, P> fade(detail::tvec3<T, P> const & t)
110 {
111 return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
112 }
113
114 template <typename T, precision P>
115 GLM_FUNC_QUALIFIER detail::tvec4<T, P> fade(detail::tvec4<T, P> const & t)
116 {
117 return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
118 }
119 /*
120 template <typename T, precision P, template <typename> class vecType>
121 GLM_FUNC_QUALIFIER vecType<T, P> fade(vecType<T, P> const & t)
122 {
123 return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
124 }
125 */
126 }//namespace detail
127 }//namespace glm
128
129 #endif//GLM_DETAIL_NOISE_INCLUDED
130
glm::floor
GLM_FUNC_DECL genType floor(genType const &x)
Returns a value equal to the nearest integer that is less then or equal to x.