From c22c676dfee583bd48e1f962378f580f8310838b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 16 Feb 2023 23:54:22 +0000 Subject: Refactor so ModelFactoryMesh can define the smooth property on faces --- assetFactory/modelFactoryMesh.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 assetFactory/modelFactoryMesh.h (limited to 'assetFactory/modelFactoryMesh.h') diff --git a/assetFactory/modelFactoryMesh.h b/assetFactory/modelFactoryMesh.h new file mode 100644 index 0000000..d0ffc26 --- /dev/null +++ b/assetFactory/modelFactoryMesh.h @@ -0,0 +1,34 @@ +#pragma once + +#include "modelFactoryMesh_fwd.h" +#include +#include +#include +#include + +namespace OpenMesh { + template struct glmvec : public VectorT { + using VectorT::VectorT; + glmvec(const VectorT & v) : VectorT {v} { } + operator glm::vec() const + { + glm::vec 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; + using Normal = OpenMesh::glmvec; +}; + +struct ModelFactoryMesh : public OpenMesh::PolyMesh_ArrayKernelT { + ModelFactoryMesh(); + + OpenMesh::FPropHandleT smoothFaceProperty; +}; -- cgit v1.2.3