Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/pbvh.c
| Show First 20 Lines • Show All 508 Lines • ▼ Show 20 Lines | |||||
| * see #BKE_pbvh_apply_vertCos(). | * see #BKE_pbvh_apply_vertCos(). | ||||
| */ | */ | ||||
| void BKE_pbvh_build_mesh(PBVH *bvh, | void BKE_pbvh_build_mesh(PBVH *bvh, | ||||
| const MPoly *mpoly, | const MPoly *mpoly, | ||||
| const MLoop *mloop, | const MLoop *mloop, | ||||
| MVert *verts, | MVert *verts, | ||||
| int totvert, | int totvert, | ||||
| struct CustomData *vdata, | struct CustomData *vdata, | ||||
| struct CustomData *ldata, | |||||
| const MLoopTri *looptri, | const MLoopTri *looptri, | ||||
| int looptri_num) | int looptri_num) | ||||
| { | { | ||||
| BBC *prim_bbc = NULL; | BBC *prim_bbc = NULL; | ||||
| BB cb; | BB cb; | ||||
| bvh->type = PBVH_FACES; | bvh->type = PBVH_FACES; | ||||
| bvh->mpoly = mpoly; | bvh->mpoly = mpoly; | ||||
| bvh->mloop = mloop; | bvh->mloop = mloop; | ||||
| bvh->looptri = looptri; | bvh->looptri = looptri; | ||||
| bvh->verts = verts; | bvh->verts = verts; | ||||
| bvh->vert_bitmap = BLI_BITMAP_NEW(totvert, "bvh->vert_bitmap"); | bvh->vert_bitmap = BLI_BITMAP_NEW(totvert, "bvh->vert_bitmap"); | ||||
| bvh->totvert = totvert; | bvh->totvert = totvert; | ||||
| bvh->leaf_limit = LEAF_LIMIT; | bvh->leaf_limit = LEAF_LIMIT; | ||||
| bvh->vdata = vdata; | bvh->vdata = vdata; | ||||
| bvh->ldata = ldata; | |||||
| BB_reset(&cb); | BB_reset(&cb); | ||||
| /* For each face, store the AABB and the AABB centroid */ | /* For each face, store the AABB and the AABB centroid */ | ||||
| prim_bbc = MEM_mallocN(sizeof(BBC) * looptri_num, "prim_bbc"); | prim_bbc = MEM_mallocN(sizeof(BBC) * looptri_num, "prim_bbc"); | ||||
| for (int i = 0; i < looptri_num; ++i) { | for (int i = 0; i < looptri_num; ++i) { | ||||
| const MLoopTri *lt = &looptri[i]; | const MLoopTri *lt = &looptri[i]; | ||||
| ▲ Show 20 Lines • Show All 616 Lines • ▼ Show 20 Lines | if (node->flag & PBVH_UpdateDrawBuffers) { | ||||
| update_flags); | update_flags); | ||||
| break; | break; | ||||
| case PBVH_FACES: | case PBVH_FACES: | ||||
| GPU_pbvh_mesh_buffers_update(node->draw_buffers, | GPU_pbvh_mesh_buffers_update(node->draw_buffers, | ||||
| bvh->verts, | bvh->verts, | ||||
| node->vert_indices, | node->vert_indices, | ||||
| node->uniq_verts + node->face_verts, | node->uniq_verts + node->face_verts, | ||||
| CustomData_get_layer(bvh->vdata, CD_PAINT_MASK), | CustomData_get_layer(bvh->vdata, CD_PAINT_MASK), | ||||
| CustomData_get_layer(bvh->ldata, CD_MLOOPCOL), | |||||
| node->face_vert_indices, | node->face_vert_indices, | ||||
| update_flags); | update_flags); | ||||
| break; | break; | ||||
| case PBVH_BMESH: | case PBVH_BMESH: | ||||
| GPU_pbvh_bmesh_buffers_update(node->draw_buffers, | GPU_pbvh_bmesh_buffers_update(node->draw_buffers, | ||||
| bvh->bm, | bvh->bm, | ||||
| node->bm_faces, | node->bm_faces, | ||||
| node->bm_unique_verts, | node->bm_unique_verts, | ||||
| ▲ Show 20 Lines • Show All 1,227 Lines • Show Last 20 Lines | |||||