| 0.9.9 API documenation

- Main Page
- Modules
- Files

- File List

_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 {
14 template<typename T>
15 GLM_FUNC_QUALIFIER T mod289(T const& x)
16 {
17 return x - floor(x * (static_cast<T>(1.0) / static_cast<T>(289.0))) * static_cast<T>(289.0);
18 }
19
20 template<typename T>
21 GLM_FUNC_QUALIFIER T permute(T const& x)
22 {
23 return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
24 }
25
26 template<typename T, qualifier Q>
27 GLM_FUNC_QUALIFIER vec<2, T, Q> permute(vec<2, T, Q> const& x)
28 {
29 return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
30 }
31
32 template<typename T, qualifier Q>
33 GLM_FUNC_QUALIFIER vec<3, T, Q> permute(vec<3, T, Q> const& x)
34 {
35 return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
36 }
37
38 template<typename T, qualifier Q>
39 GLM_FUNC_QUALIFIER vec<4, T, Q> permute(vec<4, T, Q> const& x)
40 {
41 return mod289(((x * static_cast<T>(34)) + static_cast<T>(1)) * x);
42 }
43
44 template<typename T>
45 GLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r)
46 {
47 return T(1.79284291400159) - T(0.85373472095314) * r;
48 }
49
50 template<typename T, qualifier Q>
51 GLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r)
52 {
53 return T(1.79284291400159) - T(0.85373472095314) * r;
54 }
55
56 template<typename T, qualifier Q>
57 GLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r)
58 {
59 return T(1.79284291400159) - T(0.85373472095314) * r;
60 }
61
62 template<typename T, qualifier Q>
63 GLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r)
64 {
65 return T(1.79284291400159) - T(0.85373472095314) * r;
66 }
67
68 template<typename T, qualifier Q>
69 GLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t)
70 {
71 return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
72 }
73
74 template<typename T, qualifier Q>
75 GLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t)
76 {
77 return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
78 }
79
80 template<typename T, qualifier Q>
81 GLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t)
82 {
83 return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
84 }
85 }//namespace detail
86 }//namespace glm
87
glm::floor
GLM_FUNC_DECL vec< L, T, Q > floor(vec< L, T, Q > const &x)
Returns a value equal to the nearest integer that is less then or equal to x.
glm
Definition: common.hpp:20