blob: 7d222f5aa1c4cfb2b2a91a8c6bffad9fd7d5ffcf (
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
30
31
32
33
34
35
|
#pragma once
#include "modelFactoryMesh_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 | OpenMesh::Attributes::Color);
EdgeAttributes(OpenMesh::Attributes::Status);
VertexAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status);
using Point = OpenMesh::glmvec<float, 3>;
using Normal = OpenMesh::glmvec<float, 3>;
using Color = OpenMesh::glmvec<float, 4>;
};
struct ModelFactoryMesh : public OpenMesh::PolyMesh_ArrayKernelT<ModelFactoryTraits> {
ModelFactoryMesh();
OpenMesh::FPropHandleT<bool> smoothFaceProperty;
};
|