summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assetFactory/factoryMesh.cpp9
-rw-r--r--assetFactory/modelFactoryMesh.h3
-rw-r--r--assetFactory/style.cpp4
3 files changed, 9 insertions, 7 deletions
diff --git a/assetFactory/factoryMesh.cpp b/assetFactory/factoryMesh.cpp
index 59b390f..6cca388 100644
--- a/assetFactory/factoryMesh.cpp
+++ b/assetFactory/factoryMesh.cpp
@@ -18,16 +18,17 @@ FactoryMesh::createMesh() const
for (const auto & face : mesh.faces()) {
const auto smooth = mesh.property(mesh.smoothFaceProperty, face);
const auto colour = mesh.color(face);
- auto vrange = mesh.fv_range(face);
+ auto hrange = mesh.fh_range(face);
const unsigned int start = static_cast<unsigned int>(vertices.size());
- for (const auto & vertex : vrange) {
- const auto textureUV = mesh.texcoord2D(vertex);
+ for (const auto & heh : hrange) {
+ const auto & vertex = mesh.to_vertex_handle(heh);
+ const auto textureUV = mesh.texcoord2D(heh);
vertices.emplace_back(mesh.point(vertex), textureUV,
smooth ? mesh.property(mesh.vertex_normals_pph(), vertex)
: mesh.property(mesh.face_normals_pph(), face),
colour);
}
- const auto vcount = std::distance(vrange.begin(), vrange.end());
+ const auto vcount = std::distance(hrange.begin(), hrange.end());
for (unsigned int i = 2; i < vcount; i++) {
indices.push_back(start);
indices.push_back(start + i - 1);
diff --git a/assetFactory/modelFactoryMesh.h b/assetFactory/modelFactoryMesh.h
index 493ce1b..a862dc1 100644
--- a/assetFactory/modelFactoryMesh.h
+++ b/assetFactory/modelFactoryMesh.h
@@ -35,7 +35,8 @@ namespace OpenMesh {
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 | OpenMesh::Attributes::TexCoord2D);
+ VertexAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status);
+ HalfedgeAttributes(OpenMesh::Attributes::TexCoord2D);
using Point = glm::vec3;
using Normal = glm::vec3;
using Color = glm::vec4;
diff --git a/assetFactory/style.cpp b/assetFactory/style.cpp
index 8aecc71..d1d4adc 100644
--- a/assetFactory/style.cpp
+++ b/assetFactory/style.cpp
@@ -30,8 +30,8 @@ Style::applyStyle(
auto coords = mf->getTextureCoords(texture);
auto coord = coords.begin();
// Wild assumption that face is a quad and the texture should apply linearly
- for (const auto & vh : mesh.fv_range(face)) {
- mesh.set_texcoord2D(vh, *coord++);
+ for (const auto & heh : mesh.fh_range(face)) {
+ mesh.set_texcoord2D(heh, *coord++);
}
}
}