A few missing things.

This commit is contained in:
Relintai 2020-01-20 16:12:45 +01:00
parent 7e8cbc1fb5
commit 3ef382b29f
2 changed files with 12 additions and 1 deletions

View File

@ -30,8 +30,18 @@ void MeshSimplifier::initialize(Ref<VoxelMesher> mesher) {
_mu_triangles[i] = MUTriangle(v0, v1, v2, 0); _mu_triangles[i] = MUTriangle(v0, v1, v2, 0);
} }
_mu_vertices.resize(_vertices.size());
for (int i = 0; i < _vertices.size(); ++i) { 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);
} }
} }

View File

@ -12,6 +12,7 @@ class MeshSimplifier {
public: public:
void initialize(Ref<VoxelMesher> mesher); void initialize(Ref<VoxelMesher> mesher);
void refresh_vertices();
void SimplifyMesh(float quality); void SimplifyMesh(float quality);
void SimplifyMeshLossless(); void SimplifyMeshLossless();
void UpdateMesh(int iteration); void UpdateMesh(int iteration);