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 From 7d0decccaac3aa564b549d91a36279e7aca0814e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 24 Feb 2023 19:30:30 +0000 Subject: Support for recursive colouring of asset factory faces Updates colours in sample model. --- assetFactory/modelFactoryMesh.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'assetFactory/modelFactoryMesh.h') diff --git a/assetFactory/modelFactoryMesh.h b/assetFactory/modelFactoryMesh.h index d0ffc26..7d222f5 100644 --- a/assetFactory/modelFactoryMesh.h +++ b/assetFactory/modelFactoryMesh.h @@ -20,11 +20,12 @@ namespace OpenMesh { } struct ModelFactoryTraits : public OpenMesh::DefaultTraits { - FaceAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status); + 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; using Normal = OpenMesh::glmvec; + using Color = OpenMesh::glmvec; }; struct ModelFactoryMesh : public OpenMesh::PolyMesh_ArrayKernelT { -- cgit v1.2.3 From b76d161a968ff4a2817e9cfe5c02d3538ef6029f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 25 Feb 2023 03:05:24 +0000 Subject: Add face name property and wrapper to add a named face --- assetFactory/modelFactoryMesh.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'assetFactory/modelFactoryMesh.h') diff --git a/assetFactory/modelFactoryMesh.h b/assetFactory/modelFactoryMesh.h index 7d222f5..b4f5254 100644 --- a/assetFactory/modelFactoryMesh.h +++ b/assetFactory/modelFactoryMesh.h @@ -32,4 +32,7 @@ struct ModelFactoryMesh : public OpenMesh::PolyMesh_ArrayKernelT smoothFaceProperty; + OpenMesh::FPropHandleT nameFaceProperty; + + std::pair add_namedFace(std::string name, std::vector p); }; -- cgit v1.2.3 From 98df33e0a52e086b68df2a62ce2f41cc6b67db63 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 2 Mar 2023 18:18:38 +0000 Subject: Parse colour values as they're read --- assetFactory/modelFactoryMesh.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'assetFactory/modelFactoryMesh.h') diff --git a/assetFactory/modelFactoryMesh.h b/assetFactory/modelFactoryMesh.h index b4f5254..258913b 100644 --- a/assetFactory/modelFactoryMesh.h +++ b/assetFactory/modelFactoryMesh.h @@ -5,6 +5,7 @@ #include #include #include +#include namespace OpenMesh { template struct glmvec : public VectorT { @@ -25,7 +26,7 @@ struct ModelFactoryTraits : public OpenMesh::DefaultTraits { VertexAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status); using Point = OpenMesh::glmvec; using Normal = OpenMesh::glmvec; - using Color = OpenMesh::glmvec; + using Color = glm::vec4; }; struct ModelFactoryMesh : public OpenMesh::PolyMesh_ArrayKernelT { -- cgit v1.2.3