summaryrefslogtreecommitdiff
path: root/assetFactory/assetFactoryConfig.h
blob: 171b81a2291227aa6046e2d138bfb6f678c6ca46 (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
#pragma once

#include "assetFactoryConfig_fwd.h"
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
#include <OpenMesh/Core/Mesh/Traits.hh>
#include <glm/geometric.hpp>
#include <glm/vec3.hpp>

namespace OpenMesh {
	template<typename Scalar, int DIM> struct glmvec : public VectorT<Scalar, DIM> {
		using VectorT<Scalar, DIM>::VectorT;
		glmvec(const VectorT<Scalar, DIM> & v) : VectorT<Scalar, DIM> {v} { }
		operator glm::vec<DIM, Scalar>() const
		{
			glm::vec<DIM, Scalar> out;
			std::copy(this->begin(), this->end(), &out[0]);
			return out;
		}
	};
}

struct ModelFactoryTraits : public OpenMesh::DefaultTraits {
	FaceAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status);
	EdgeAttributes(OpenMesh::Attributes::Status);
	VertexAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status);
	using Point = OpenMesh::glmvec<float, 3>;
	using Normal = OpenMesh::glmvec<float, 3>;
};