From 3ef382b29ffcafe8d6381e95b89e7d78f708793c Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 20 Jan 2020 16:12:45 +0100 Subject: [PATCH] A few missing things. --- meshers/mesh_simplifier/mesh_simplifier.cpp | 12 +++++++++++- meshers/mesh_simplifier/mesh_simplifier.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/meshers/mesh_simplifier/mesh_simplifier.cpp b/meshers/mesh_simplifier/mesh_simplifier.cpp index e1fc0f4..4130609 100644 --- a/meshers/mesh_simplifier/mesh_simplifier.cpp +++ b/meshers/mesh_simplifier/mesh_simplifier.cpp @@ -30,8 +30,18 @@ void MeshSimplifier::initialize(Ref mesher) { _mu_triangles[i] = MUTriangle(v0, v1, v2, 0); } + _mu_vertices.resize(_vertices.size()); for (int i = 0; i < _vertices.size(); ++i) { - _mu_vertices.append(MUVertex(_vertices[i])); + _mu_vertices[i] = MUVertex(_vertices[i]); + } +} + +void MeshSimplifier::refresh_vertices() { + _vertices.resize(_mu_vertices.size()); + for (int i = 0; i < _mu_vertices.size(); ++i) { + MUVertex vert = _mu_vertices[i]; + + _vertices[i] = Vector3(vert.p); } } diff --git a/meshers/mesh_simplifier/mesh_simplifier.h b/meshers/mesh_simplifier/mesh_simplifier.h index 861dd64..83ca4e0 100644 --- a/meshers/mesh_simplifier/mesh_simplifier.h +++ b/meshers/mesh_simplifier/mesh_simplifier.h @@ -12,6 +12,7 @@ class MeshSimplifier { public: void initialize(Ref mesher); + void refresh_vertices(); void SimplifyMesh(float quality); void SimplifyMeshLossless(); void UpdateMesh(int iteration);