Sculpt: Simplify BVH node flag initialization, avoid normals update

Use the default constructor of `Node` to set the default new flag value.
Remove the normals update flag which was added in f9c6fe30db.
This should avoid recalculating all the normals after just building the
BVH tree.
This commit is contained in:
Hans Goudey
2024-08-20 14:37:31 -04:00
parent a2d8eec834
commit 7e0029fb65
3 changed files with 2 additions and 11 deletions

View File

@@ -137,7 +137,8 @@ class Node {
/* Indicates whether this node is a leaf or not; also used for
* marking various updates that need to be applied. */
PBVHNodeFlags flag_ = PBVHNodeFlags(0);
PBVHNodeFlags flag_ = PBVH_UpdateBB | PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers |
PBVH_UpdateRedraw;
/* Used for ray-casting: how close the bounding-box is to the ray point. */
float tmin_ = 0.0f;

View File

@@ -209,9 +209,6 @@ static void build_mesh_leaf_node(const Span<int> corner_verts,
}
}
}
BKE_pbvh_node_mark_positions_update(&node);
BKE_pbvh_node_mark_rebuild_draw(&node);
}
/* Return zero if all primitives in the node can be drawn with the
@@ -267,7 +264,6 @@ static void build_nodes_recursive_mesh(const Span<int> corner_verts,
node.flag_ |= PBVH_Leaf;
node.prim_indices_ = prim_indices.as_span().slice(prim_offset, prims_num);
build_mesh_leaf_node(corner_verts, corner_tris, vert_bitmap, node);
return;
}
}
@@ -464,10 +460,7 @@ static void build_nodes_recursive_grids(const Span<int> grid_to_face_map,
{
Node &node = nodes[node_index];
node.flag_ |= PBVH_Leaf;
node.prim_indices_ = prim_indices.as_span().slice(prim_offset, prims_num);
BKE_pbvh_node_mark_positions_update(&node);
BKE_pbvh_node_mark_rebuild_draw(&node);
return;
}
}

View File

@@ -2189,9 +2189,6 @@ static void pbvh_bmesh_create_nodes_fast_recursive(Tree *pbvh,
n->bounds_orig_ = n->bounds_;
/* Build GPU buffers for new node and update vertex normals. */
BKE_pbvh_node_mark_rebuild_draw(n);
BKE_pbvh_node_fully_hidden_set(n, !has_visible);
n->flag_ |= PBVH_UpdateNormals;
}