diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-14 10:32:03 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-14 10:32:03 +0400 |
commit | 521e724eddc9bfcc3f4aaeac184ae6974bb922a4 (patch) | |
tree | 659791e83846e89bd0b5e7866e639e2e9fcd8a44 /source/blender/blenlib | |
parent | 8717e35db3b4b267198e07f2d461348458a33282 (diff) |
Skip hidden elements in PBVH iterator, raycast, and drawing.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_pbvh.h | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/pbvh.c | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h index ed763498687..a1137009e3d 100644 --- a/source/blender/blenlib/BLI_pbvh.h +++ b/source/blender/blenlib/BLI_pbvh.h @@ -57,7 +57,8 @@ void BLI_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts, int totface, int totvert); void BLI_pbvh_build_grids(PBVH *bvh, struct DMGridData **grids, struct DMGridAdjacency *gridadj, int totgrid, - int gridsize, void **gridfaces, struct DMFlagMat *flagmats); + int gridsize, void **gridfaces, struct DMFlagMat *flagmats, + unsigned int **grid_hidden); void BLI_pbvh_free(PBVH *bvh); /* Hierarchical Search in the BVH, two methods: @@ -97,6 +98,9 @@ typedef enum { PBVHType BLI_pbvh_type(const PBVH *bvh); +/* multires hidden data, only valid for type == PBVH_GRIDS */ +unsigned int **BLI_pbvh_grid_hidden(const PBVH *bvh); + /* Node Access */ typedef enum { diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index 952a3df7109..a986896e0d2 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -141,6 +141,7 @@ struct PBVH { const DMFlagMat *grid_flag_mats; int totgrid; int gridsize; + BLI_bitmap *grid_hidden; /* Only used during BVH build and update, * don't need to remain valid after */ @@ -639,7 +640,7 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int /* Do a full rebuild with on Grids data structure */ void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridadj, - int totgrid, int gridsize, void **gridfaces, DMFlagMat *flagmats) + int totgrid, int gridsize, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap *grid_hidden) { BBC *prim_bbc = NULL; BB cb; @@ -652,6 +653,7 @@ void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridad bvh->grid_flag_mats= flagmats; bvh->totgrid= totgrid; bvh->gridsize= gridsize; + bvh->grid_hidden= grid_hidden; bvh->leaf_limit = MAX2(LEAF_LIMIT/((gridsize-1)*(gridsize-1)), 1); BB_reset(&cb); @@ -1284,6 +1286,12 @@ PBVHType BLI_pbvh_type(const PBVH *bvh) return bvh->type; } +BLI_bitmap *BLI_pbvh_grid_hidden(const PBVH *bvh) +{ + BLI_assert(bvh->type == PBVH_GRIDS); + return bvh->grid_hidden; +} + /***************************** Node Access ***********************************/ void BLI_pbvh_node_mark_update(PBVHNode *node) |