diff options
author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2023-10-26 20:34:55 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-10-27 00:31:40 +0100 |
commit | 6ec18905acdb9b30e5bfc5eee9be0182ce1744c9 (patch) | |
tree | f0cc6257392b1c375c4030fe69e5b217314a08c0 /thirdparty/openmesh | |
parent | Merge branch 'glad' (diff) | |
download | ilt-6ec18905acdb9b30e5bfc5eee9be0182ce1744c9.tar.bz2 ilt-6ec18905acdb9b30e5bfc5eee9be0182ce1744c9.tar.xz ilt-6ec18905acdb9b30e5bfc5eee9be0182ce1744c9.zip |
Move OpenMesh/GLM compatibility structs to common place
Diffstat (limited to 'thirdparty/openmesh')
-rw-r--r-- | thirdparty/openmesh/glmcompat.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/thirdparty/openmesh/glmcompat.h b/thirdparty/openmesh/glmcompat.h new file mode 100644 index 0000000..708b1a6 --- /dev/null +++ b/thirdparty/openmesh/glmcompat.h @@ -0,0 +1,29 @@ +#pragma once + +#include <OpenMesh/Core/Mesh/Traits.hh> +#include <glm/geometric.hpp> +#include <glm/vec3.hpp> + +namespace glm { + template<length_t L, typename T, qualifier Q> + auto + norm(const vec<L, T, Q> & v) + { + return length(v); + } + + template<length_t L, typename T, qualifier Q, typename S> + auto + vectorize(vec<L, T, Q> & v, S scalar) + { + v = vec<L, T, Q> {static_cast<T>(scalar)}; + } +} + +namespace OpenMesh { + template<glm::length_t L, typename T, glm::qualifier Q> struct vector_traits<glm::vec<L, T, Q>> { + using vector_type = glm::vec<L, T, Q>; + using value_type = T; + static constexpr glm::length_t size_ = L; + }; +} |