]> git.localhorst.tv Git - blobs.git/blob - src/graphics/glm.hpp
8003f0b751ada30fa9aff5fe6bea160afd2eb497
[blobs.git] / src / graphics / glm.hpp
1 #ifndef BLOBS_GRAPHICS_GLM_HPP_
2 #define BLOBS_GRAPHICS_GLM_HPP_
3
4 #ifndef GLM_FORCE_RADIANS
5 #  define GLM_FORCE_RADIANS 1
6 #endif
7
8 #include <limits>
9 #include <glm/glm.hpp>
10 #include <glm/gtx/norm.hpp>
11 #include <glm/gtx/component_wise.hpp>
12
13 // GLM moved tvec[1234] from glm::detail to glm in 0.9.6
14
15 #if GLM_VERSION < 96
16
17 namespace glm {
18         using tvec1 = detail::tvec1;
19         using tvec2 = detail::tvec2;
20         using tvec3 = detail::tvec3;
21         using tvec4 = detail::tvec4;
22 }
23
24 #endif
25
26 template <class T>
27 inline bool allzero(const T &v) noexcept {
28         return glm::length2(v) <
29                 std::numeric_limits<typename T::value_type>::epsilon()
30                 * std::numeric_limits<typename T::value_type>::epsilon();
31 }
32
33 template <class T>
34 inline bool anynan(const T &v) noexcept {
35         return glm::any(glm::isnan(v));
36 }
37
38
39 #endif