Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/pbvh.c
| Show First 20 Lines • Show All 992 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| } | } | ||||
| bool BKE_pbvh_node_fully_unmasked_get(PBVHNode *node) | bool BKE_pbvh_node_fully_unmasked_get(PBVHNode *node) | ||||
| { | { | ||||
| return (node->flag & PBVH_Leaf) && (node->flag & PBVH_FullyUnmasked); | return (node->flag & PBVH_Leaf) && (node->flag & PBVH_FullyUnmasked); | ||||
| } | } | ||||
| void BKE_pbvh_vert_mark_update(PBVH *pbvh, PBVHVertRef index) | void BKE_pbvh_vert_tag_update_normal(PBVH *pbvh, PBVHVertRef index) | ||||
| { | { | ||||
| BLI_assert(pbvh->header.type == PBVH_FACES); | BLI_assert(pbvh->header.type == PBVH_FACES); | ||||
| pbvh->vert_bitmap[index.i] = true; | pbvh->vert_bitmap[index.i] = true; | ||||
| } | } | ||||
| void BKE_pbvh_node_get_loops(PBVH *pbvh, | void BKE_pbvh_node_get_loops(PBVH *pbvh, | ||||
| PBVHNode *node, | PBVHNode *node, | ||||
| const int **r_loop_indices, | const int **r_loop_indices, | ||||
| ▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | |||||
| int *r_orco_tris_num, | int *r_orco_tris_num, | ||||
| float (**r_orco_coords)[3]) | float (**r_orco_coords)[3]) | ||||
| { | { | ||||
| *r_orco_tris = node->bm_ortri; | *r_orco_tris = node->bm_ortri; | ||||
| *r_orco_tris_num = node->bm_tot_ortri; | *r_orco_tris_num = node->bm_tot_ortri; | ||||
| *r_orco_coords = node->bm_orco; | *r_orco_coords = node->bm_orco; | ||||
| } | } | ||||
| bool BKE_pbvh_node_vert_update_check_any(PBVH *pbvh, PBVHNode *node) | bool BKE_pbvh_node_has_vert_with_normal_update_tag(PBVH *pbvh, PBVHNode *node) | ||||
| { | { | ||||
| BLI_assert(pbvh->header.type == PBVH_FACES); | BLI_assert(pbvh->header.type == PBVH_FACES); | ||||
| const int *verts = node->vert_indices; | const int *verts = node->vert_indices; | ||||
| const int totvert = node->uniq_verts + node->face_verts; | const int totvert = node->uniq_verts + node->face_verts; | ||||
| for (int i = 0; i < totvert; i++) { | for (int i = 0; i < totvert; i++) { | ||||
| const int v = verts[i]; | const int v = verts[i]; | ||||
| ▲ Show 20 Lines • Show All 851 Lines • ▼ Show 20 Lines | |||||
| if (pbvh->verts) { | if (pbvh->verts) { | ||||
| MVert *mvert = pbvh->verts; | MVert *mvert = pbvh->verts; | ||||
| /* copy new verts coords */ | /* copy new verts coords */ | ||||
| for (int a = 0; a < pbvh->totvert; a++, mvert++) { | for (int a = 0; a < pbvh->totvert; a++, mvert++) { | ||||
| /* no need for float comparison here (memory is exactly equal or not) */ | /* no need for float comparison here (memory is exactly equal or not) */ | ||||
| if (memcmp(mvert->co, vertCos[a], sizeof(float[3])) != 0) { | if (memcmp(mvert->co, vertCos[a], sizeof(float[3])) != 0) { | ||||
| copy_v3_v3(mvert->co, vertCos[a]); | copy_v3_v3(mvert->co, vertCos[a]); | ||||
| BKE_pbvh_vert_mark_update(pbvh, BKE_pbvh_make_vref(a)); | BKE_pbvh_vert_tag_update_normal(pbvh, BKE_pbvh_make_vref(a)); | ||||
| } | } | ||||
| } | } | ||||
| /* coordinates are new -- normals should also be updated */ | /* coordinates are new -- normals should also be updated */ | ||||
| BKE_mesh_calc_normals_looptri( | BKE_mesh_calc_normals_looptri( | ||||
| pbvh->verts, pbvh->totvert, pbvh->mloop, pbvh->looptri, pbvh->totprim, NULL); | pbvh->verts, pbvh->totvert, pbvh->mloop, pbvh->looptri, pbvh->totprim, NULL); | ||||
| for (int a = 0; a < pbvh->totnode; a++) { | for (int a = 0; a < pbvh->totnode; a++) { | ||||
| ▲ Show 20 Lines • Show All 328 Lines • Show Last 20 Lines | |||||