Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-08-02 21:32:25 +0300
committerHans Goudey <h.goudey@me.com>2022-08-02 21:32:45 +0300
commit2ba2efc29691762d3fb2002f54adafd536b2c37b (patch)
tree1ea85ec85cf57a240baa3f8a4bb942f40c822ee9 /source/blender/blenkernel/intern/pbvh.c
parente4fd2d57543a86c4879537939ecf9c4fad68eeac (diff)
Cleanup: Simplify arguments to sculpt draw functions
Instead of passing pointers to specific mesh data, rely on retrieving that data from the mesh internally. This makes it easier to support retrieving additional data from Mesh (like active attribute names in D15101 or D15169). It also makes the functions simpler conceptually, because they're drawing a mesh with an acceleration strcture on top. The BKE_id_attribute_copy_domains_temp call was unnecessary because the GPU_pbvh_mesh_buffers_update function was only called when Mesh/PBVH_FACES is used in the first place. Differential Revision: https://developer.blender.org/D15197
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r--source/blender/blenkernel/intern/pbvh.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index ac3eac70c39..dae9788d21c 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1303,17 +1303,6 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
PBVH *pbvh = data->pbvh;
PBVHNode *node = data->nodes[n];
- CustomData *vdata, *ldata;
-
- if (!pbvh->header.bm) {
- vdata = pbvh->vdata;
- ldata = pbvh->ldata;
- }
- else {
- vdata = &pbvh->header.bm->vdata;
- ldata = &pbvh->header.bm->ldata;
- }
-
if (node->flag & PBVH_RebuildDrawBuffers) {
switch (pbvh->header.type) {
case PBVH_GRIDS: {
@@ -1326,14 +1315,12 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
}
case PBVH_FACES:
node->draw_buffers = GPU_pbvh_mesh_buffers_build(
- pbvh->mpoly,
- pbvh->mloop,
- pbvh->looptri,
+ pbvh->mesh,
pbvh->verts,
- node->prim_indices,
+ pbvh->looptri,
CustomData_get_layer(pbvh->pdata, CD_SCULPT_FACE_SETS),
- node->totprim,
- pbvh->mesh);
+ node->prim_indices,
+ node->totprim);
break;
case PBVH_BMESH:
node->draw_buffers = GPU_pbvh_bmesh_buffers_build(pbvh->flags &
@@ -1360,11 +1347,12 @@ static void pbvh_update_draw_buffer_cb(void *__restrict userdata,
update_flags);
break;
case PBVH_FACES: {
+ /* Pass vertices separately because they may be not be the same as the mesh's vertices,
+ * and pass normals separately because they are managed by the PBVH. */
GPU_pbvh_mesh_buffers_update(pbvh->vbo_id,
node->draw_buffers,
+ pbvh->mesh,
pbvh->verts,
- vdata,
- ldata,
CustomData_get_layer(pbvh->vdata, CD_PAINT_MASK),
CustomData_get_layer(pbvh->pdata, CD_SCULPT_FACE_SETS),
pbvh->face_sets_color_seed,