Simplify the quadriflow manifold mesh function for loops
No need to iterate over all polygons if we just want to iterate over all face loops anyways.
This commit is contained in:
@@ -219,7 +219,6 @@ static bool mesh_is_manifold_consistent(Mesh *mesh)
|
|||||||
|
|
||||||
bool is_manifold_consistent = true;
|
bool is_manifold_consistent = true;
|
||||||
const MLoop *mloop = mesh->mloop;
|
const MLoop *mloop = mesh->mloop;
|
||||||
const MPoly *mpoly = mesh->mpoly;
|
|
||||||
char *edge_faces = (char *)MEM_callocN(mesh->totedge * sizeof(char), "remesh_manifold_check");
|
char *edge_faces = (char *)MEM_callocN(mesh->totedge * sizeof(char), "remesh_manifold_check");
|
||||||
int *edge_vert = (int *)MEM_malloc_arrayN(
|
int *edge_vert = (int *)MEM_malloc_arrayN(
|
||||||
mesh->totedge, sizeof(unsigned int), "remesh_consistent_check");
|
mesh->totedge, sizeof(unsigned int), "remesh_consistent_check");
|
||||||
@@ -228,25 +227,21 @@ static bool mesh_is_manifold_consistent(Mesh *mesh)
|
|||||||
edge_vert[i] = -1;
|
edge_vert[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int poly_index = 0; poly_index < mesh->totpoly && is_manifold_consistent;
|
for (unsigned int loop_idx = 0; loop_idx < mesh->totloop; loop_idx++) {
|
||||||
poly_index++) {
|
const MLoop *loop = &mloop[loop_idx];
|
||||||
const MPoly *poly = &mpoly[poly_index];
|
edge_faces[loop->e] += 1;
|
||||||
for (unsigned int corner = 0; corner < poly->totloop; corner++) {
|
if (edge_faces[loop->e] > 2) {
|
||||||
const MLoop *loop = &mloop[poly->loopstart + corner];
|
is_manifold_consistent = false;
|
||||||
edge_faces[loop->e] += 1;
|
break;
|
||||||
if (edge_faces[loop->e] > 2) {
|
}
|
||||||
is_manifold_consistent = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (edge_vert[loop->e] == -1) {
|
if (edge_vert[loop->e] == -1) {
|
||||||
edge_vert[loop->e] = loop->v;
|
edge_vert[loop->e] = loop->v;
|
||||||
}
|
}
|
||||||
else if (edge_vert[loop->e] == loop->v) {
|
else if (edge_vert[loop->e] == loop->v) {
|
||||||
/* Mesh has flips in the surface so it is non consistent */
|
/* Mesh has flips in the surface so it is non consistent */
|
||||||
is_manifold_consistent = false;
|
is_manifold_consistent = false;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user