summaryrefslogtreecommitdiff
path: root/thirdparty/openmesh/glmcompat.h
blob: 708b1a62d154fa21589a834f63d022a48d76915f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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;
	};
}