Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/pbvh.c
| Show First 20 Lines • Show All 835 Lines • ▼ Show 20 Lines | void BKE_pbvh_build_grids(PBVH *pbvh, | ||||
| /* Find maximum number of grids per face. */ | /* Find maximum number of grids per face. */ | ||||
| int max_grids = 1; | int max_grids = 1; | ||||
| const MPoly *mpoly = BKE_mesh_polys(me); | const MPoly *mpoly = BKE_mesh_polys(me); | ||||
| for (int i = 0; i < me->totpoly; i++) { | for (int i = 0; i < me->totpoly; i++) { | ||||
| max_grids = max_ii(max_grids, mpoly[i].totloop); | max_grids = max_ii(max_grids, mpoly[i].totloop); | ||||
| } | } | ||||
| /* Ensure leaf limit is at least 4 so there's room | /* Ensure leaf limit is at least 4 so there's room | ||||
| * to split at original face boundaries. | * to split at original face boundaries. | ||||
| * Fixes T102209. | * Fixes T102209. | ||||
| */ | */ | ||||
| pbvh->leaf_limit = max_ii(LEAF_LIMIT / (gridsize * gridsize), max_grids); | pbvh->leaf_limit = max_ii(LEAF_LIMIT / (gridsize * gridsize), max_grids); | ||||
| /* We need the base mesh attribute layout for PBVH draw. */ | /* We need the base mesh attribute layout for PBVH draw. */ | ||||
| pbvh->vdata = &me->vdata; | pbvh->vdata = &me->vdata; | ||||
| ▲ Show 20 Lines • Show All 2,293 Lines • ▼ Show 20 Lines | if (pbvh->verts) { | ||||
| 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_tag_update_normal(pbvh, BKE_pbvh_make_vref(a)); | BKE_pbvh_vert_tag_update_normal(pbvh, BKE_pbvh_make_vref(a)); | ||||
| } | } | ||||
| } | } | ||||
| for (int a = 0; a < pbvh->totnode; a++) { | for (int a = 0; a < pbvh->totnode; a++) { | ||||
| BKE_pbvh_node_mark_update(&pbvh->nodes[a]); | BKE_pbvh_node_mark_update(&pbvh->nodes[a]); | ||||
| } | } | ||||
| BKE_pbvh_update_bounds(pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB); | BKE_pbvh_update_bounds(pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 542 Lines • Show Last 20 Lines | |||||