Fix #107123: Refactor sculpt normal calculation to require vert poly map #107458
|
@ -1420,9 +1420,10 @@ static void pbvh_faces_update_normals(PBVH *pbvh, Span<PBVHNode *> nodes)
|
|||
for (const int poly : polys_to_update) {
|
||||
|
||||
verts_to_update.add_multiple(corner_verts.slice(polys[poly]));
|
||||
}
|
||||
},
|
||||
[&]() {
|
||||
update_tags.fill(false);
|
||||
|
||||
for (const int vert : verts_to_update) {
|
||||
update_tags[vert] = false;
|
||||
Joseph Eagar
commented
Use Use `verts_to_update` or the node unique verts to clear the update tags.
|
||||
}
|
||||
for (PBVHNode *node : nodes) {
|
||||
node->flag &= ~PBVH_UpdateNormals;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
We can't afford to iterate over all the verts of the mesh here. It's better to build a list of verts to update from the PBVH nodes.
The list doesn't have to be unique btw, there's no point going through the effort to eliminate duplicates.
Well, since a face usually has four corners, not de-duplicating will mean we have to do 4x the calculations, for both vertices and faces. I didn't benchmark it yet, but I'll bet using
VectorSet
to de-duplicate is worth it here.Hrm, you might be right.