]> git.localhorst.tv Git - blobs.git/blobdiff - src/graphics/glm.hpp
fix return value of tsr get double
[blobs.git] / src / graphics / glm.hpp
index 1c39ba5e059ae75ff48d187d0a022b1fbb8154fd..8003f0b751ada30fa9aff5fe6bea160afd2eb497 100644 (file)
@@ -5,7 +5,10 @@
 #  define GLM_FORCE_RADIANS 1
 #endif
 
+#include <limits>
 #include <glm/glm.hpp>
+#include <glm/gtx/norm.hpp>
+#include <glm/gtx/component_wise.hpp>
 
 // GLM moved tvec[1234] from glm::detail to glm in 0.9.6
 
@@ -20,4 +23,17 @@ namespace glm {
 
 #endif
 
+template <class T>
+inline bool allzero(const T &v) noexcept {
+       return glm::length2(v) <
+               std::numeric_limits<typename T::value_type>::epsilon()
+               * std::numeric_limits<typename T::value_type>::epsilon();
+}
+
+template <class T>
+inline bool anynan(const T &v) noexcept {
+       return glm::any(glm::isnan(v));
+}
+
+
 #endif