diff options
-rw-r--r-- | assetFactory/modelFactoryMesh.h | 27 | ||||
-rw-r--r-- | thirdparty/openmesh/glmcompat.h | 29 |
2 files changed, 30 insertions, 26 deletions
diff --git a/assetFactory/modelFactoryMesh.h b/assetFactory/modelFactoryMesh.h index 32e7ab5..2129fb5 100644 --- a/assetFactory/modelFactoryMesh.h +++ b/assetFactory/modelFactoryMesh.h @@ -2,36 +2,11 @@ #include "modelFactoryMesh_fwd.h" #include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh> -#include <OpenMesh/Core/Mesh/Traits.hh> #include <glad/gl.h> -#include <glm/geometric.hpp> #include <glm/vec2.hpp> #include <glm/vec3.hpp> #include <glm/vec4.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; - }; -} +#include <thirdparty/openmesh/glmcompat.h> struct ModelFactoryTraits : public OpenMesh::DefaultTraits { FaceAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status | OpenMesh::Attributes::Color); 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; + }; +} |