diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-05-01 00:42:58 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-05-01 00:43:19 +0400 |
commit | d2a326076342845fc5e0bcfc4ea10b09ce86242e (patch) | |
tree | 70aee396d03fe39c8fc60fc79cdf5246981d5ade /source/blender/blenkernel/intern/pbvh.c | |
parent | d50f8832e39f79a9a2477ddb2e26dd2c801dbc8f (diff) |
Add PBVH debug display, where we can see the PBVH node bounding boxes.
To enable enter debug value 14.
Leaf nodes are green while container nodes are red.
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 5327f4dc3be..09bf1654e13 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -34,6 +34,7 @@ #include "BKE_pbvh.h" #include "BKE_ccg.h" #include "BKE_DerivedMesh.h" +#include "BKE_global.h" #include "BKE_mesh.h" /* for BKE_mesh_calc_normals */ #include "BKE_paint.h" @@ -1088,6 +1089,22 @@ static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode) } } +static void pbvh_draw_BB(PBVH *bvh) +{ + PBVHNode *node; + int a; + + GPU_init_draw_pbvh_BB(); + + for (a = 0; a < bvh->totnode; a++) { + node = &bvh->nodes[a]; + + GPU_draw_pbvh_BB(node->vb.bmin, node->vb.bmax, ((node->flag & PBVH_Leaf) != 0)); + } + + GPU_end_draw_pbvh_BB(); +} + static int pbvh_flush_bb(PBVH *bvh, PBVHNode *node, int flag) { int update = 0; @@ -1691,6 +1708,9 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3], else { BKE_pbvh_search_callback(bvh, NULL, NULL, BKE_pbvh_node_draw, &draw_data); } + + if (G.debug_value == 14) + pbvh_draw_BB(bvh); } void BKE_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces, |