Blender V2.61 - r43446
|
A BVH for high poly meshes. More...
Go to the source code of this file.
Classes | |
struct | PBVHProxyNode |
struct | PBVHVertexIter |
Defines | |
#define | PBVH_ITER_ALL 0 |
#define | PBVH_ITER_UNIQUE 1 |
#define | BLI_pbvh_vertex_iter_begin(bvh, node, vi, mode) |
#define | BLI_pbvh_vertex_iter_end |
Typedefs | |
typedef struct PBVH | PBVH |
typedef struct PBVHNode | PBVHNode |
typedef int(* | BLI_pbvh_SearchCallback )(PBVHNode *node, void *data) |
typedef void(* | BLI_pbvh_HitCallback )(PBVHNode *node, void *data) |
typedef void(* | BLI_pbvh_HitOccludedCallback )(PBVHNode *node, void *data, float *tmin) |
typedef struct PBVHVertexIter | PBVHVertexIter |
Enumerations | |
enum | PBVHNodeFlags { PBVH_Leaf = 1, PBVH_UpdateNormals = 2, PBVH_UpdateBB = 4, PBVH_UpdateOriginalBB = 8, PBVH_UpdateDrawBuffers = 16, PBVH_UpdateRedraw = 32 } |
Functions | |
PBVH * | BLI_pbvh_new (void) |
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) |
void | BLI_pbvh_free (PBVH *bvh) |
void | BLI_pbvh_search_callback (PBVH *bvh, BLI_pbvh_SearchCallback scb, void *search_data, BLI_pbvh_HitCallback hcb, void *hit_data) |
void | BLI_pbvh_search_gather (PBVH *bvh, BLI_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot) |
void | BLI_pbvh_raycast (PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data, float ray_start[3], float ray_normal[3], int original) |
int | BLI_pbvh_node_raycast (PBVH *bvh, PBVHNode *node, float(*origco)[3], float ray_start[3], float ray_normal[3], float *dist) |
void | BLI_pbvh_node_draw (PBVHNode *node, void *data) |
int | BLI_pbvh_node_planes_contain_AABB (PBVHNode *node, void *data) |
void | BLI_pbvh_draw (PBVH *bvh, float(*planes)[4], float(*face_nors)[3], int smooth) |
void | BLI_pbvh_node_mark_update (PBVHNode *node) |
void | BLI_pbvh_node_get_grids (PBVH *bvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, struct DMGridData ***griddata, struct DMGridAdjacency **gridadj) |
void | BLI_pbvh_node_num_verts (PBVH *bvh, PBVHNode *node, int *uniquevert, int *totvert) |
void | BLI_pbvh_node_get_verts (PBVH *bvh, PBVHNode *node, int **vert_indices, struct MVert **verts) |
void | BLI_pbvh_node_get_BB (PBVHNode *node, float bb_min[3], float bb_max[3]) |
void | BLI_pbvh_node_get_original_BB (PBVHNode *node, float bb_min[3], float bb_max[3]) |
float | BLI_pbvh_node_get_tmin (PBVHNode *node) |
void | BLI_pbvh_update (PBVH *bvh, int flags, float(*face_nors)[3]) |
void | BLI_pbvh_redraw_BB (PBVH *bvh, float bb_min[3], float bb_max[3]) |
void | BLI_pbvh_get_grid_updates (PBVH *bvh, int clear, void ***gridfaces, int *totface) |
void | BLI_pbvh_grids_update (PBVH *bvh, struct DMGridData **grids, struct DMGridAdjacency *gridadj, void **gridfaces) |
float(* | BLI_pbvh_get_vertCos (struct PBVH *pbvh))[3] |
void | BLI_pbvh_apply_vertCos (struct PBVH *pbvh, float(*vertCos)[3]) |
int | BLI_pbvh_isDeformed (struct PBVH *pbvh) |
void | BLI_pbvh_node_get_proxies (PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count) |
void | BLI_pbvh_node_free_proxies (PBVHNode *node) |
PBVHProxyNode * | BLI_pbvh_node_add_proxy (PBVH *bvh, PBVHNode *node) |
void | BLI_pbvh_gather_proxies (PBVH *pbvh, PBVHNode ***nodes, int *totnode) |
A BVH for high poly meshes.
Definition in file BLI_pbvh.h.
#define BLI_pbvh_vertex_iter_begin | ( | bvh, | |
node, | |||
vi, | |||
mode | |||
) |
Definition at line 174 of file BLI_pbvh.h.
Referenced by calc_area_normal(), calc_area_normal_and_flatten_center(), calc_flatten_center(), do_clay_brush(), do_clay_tubes_brush(), do_crease_brush(), do_draw_brush(), do_fill_brush(), do_flatten_brush(), do_grab_brush(), do_inflate_brush(), do_layer_brush(), do_mesh_smooth_brush(), do_nudge_brush(), do_pinch_brush(), do_rotate_brush(), do_scrape_brush(), do_snake_hook_brush(), do_thumb_brush(), sculpt_combine_proxies(), sculpt_flush_stroke_deform(), sculpt_restore_mesh(), sculpt_undo_push_node(), and update_node_vb().
#define BLI_pbvh_vertex_iter_end |
} \ } \ }
Definition at line 232 of file BLI_pbvh.h.
Referenced by calc_area_normal(), calc_area_normal_and_flatten_center(), calc_flatten_center(), do_clay_brush(), do_clay_tubes_brush(), do_crease_brush(), do_draw_brush(), do_fill_brush(), do_flatten_brush(), do_grab_brush(), do_inflate_brush(), do_layer_brush(), do_mesh_smooth_brush(), do_nudge_brush(), do_pinch_brush(), do_rotate_brush(), do_scrape_brush(), do_snake_hook_brush(), do_thumb_brush(), sculpt_combine_proxies(), sculpt_flush_stroke_deform(), sculpt_restore_mesh(), sculpt_undo_push_node(), and update_node_vb().
#define PBVH_ITER_ALL 0 |
Definition at line 137 of file BLI_pbvh.h.
Referenced by sculpt_undo_push_node(), and update_node_vb().
#define PBVH_ITER_UNIQUE 1 |
Definition at line 138 of file BLI_pbvh.h.
Referenced by calc_area_normal(), calc_area_normal_and_flatten_center(), calc_flatten_center(), do_clay_brush(), do_clay_tubes_brush(), do_crease_brush(), do_draw_brush(), do_fill_brush(), do_flatten_brush(), do_grab_brush(), do_inflate_brush(), do_layer_brush(), do_mesh_smooth_brush(), do_nudge_brush(), do_pinch_brush(), do_rotate_brush(), do_scrape_brush(), do_snake_hook_brush(), do_thumb_brush(), sculpt_combine_proxies(), sculpt_flush_stroke_deform(), and sculpt_restore_mesh().
typedef void(* BLI_pbvh_HitCallback)(PBVHNode *node, void *data) |
Definition at line 49 of file BLI_pbvh.h.
typedef void(* BLI_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin) |
Definition at line 50 of file BLI_pbvh.h.
typedef int(* BLI_pbvh_SearchCallback)(PBVHNode *node, void *data) |
Definition at line 47 of file BLI_pbvh.h.
Definition at line 37 of file BLI_pbvh.h.
Definition at line 38 of file BLI_pbvh.h.
typedef struct PBVHVertexIter PBVHVertexIter |
enum PBVHNodeFlags |
PBVH_Leaf | |
PBVH_UpdateNormals | |
PBVH_UpdateBB | |
PBVH_UpdateOriginalBB | |
PBVH_UpdateDrawBuffers | |
PBVH_UpdateRedraw |
Definition at line 92 of file BLI_pbvh.h.
void BLI_pbvh_apply_vertCos | ( | struct PBVH * | pbvh, |
float(*) | vertCos[3] | ||
) |
Definition at line 1562 of file pbvh.c.
References BLI_pbvh_node_mark_update(), BLI_pbvh_update(), MVert::co, copy_v3_v3(), PBVH::deformed, PBVH::faces, MVert::flag, ME_VERT_PBVH_UPDATE, MEM_dupallocN(), mesh_calc_normals(), PBVH::nodes, NULL, PBVH_UpdateBB, PBVH_UpdateOriginalBB, PBVH::totnode, PBVH::totprim, PBVH::totvert, and PBVH::verts.
Referenced by cdDM_getPBVH(), sculpt_undo_restore(), and sculpt_update_mesh_elements().
void BLI_pbvh_build_grids | ( | PBVH * | bvh, |
struct DMGridData ** | grids, | ||
struct DMGridAdjacency * | gridadj, | ||
int | totgrid, | ||
int | gridsize, | ||
void ** | gridfaces | ||
) |
Definition at line 590 of file pbvh.c.
References BB_expand(), BB_reset(), BBC_update_centroid(), co, PBVH::gridadj, PBVH::gridfaces, PBVH::grids, PBVH::gridsize, i, LEAF_LIMIT, PBVH::leaf_limit, MAX2, MEM_freeN(), MEM_mallocN(), NULL, pbvh_build(), and PBVH::totgrid.
Referenced by ccgDM_getPBVH().
void BLI_pbvh_build_mesh | ( | PBVH * | bvh, |
struct MFace * | faces, | ||
struct MVert * | verts, | ||
int | totface, | ||
int | totvert | ||
) |
Definition at line 550 of file pbvh.c.
References BB_expand(), BB_reset(), BBC_update_centroid(), BLI_bitmap_new(), MVert::co, PBVH::faces, i, LEAF_LIMIT, PBVH::leaf_limit, MEM_freeN(), MEM_mallocN(), NULL, pbvh_build(), PBVH::totvert, MFace::v1, MFace::v4, PBVH::vert_bitmap, and PBVH::verts.
Referenced by ccgDM_getPBVH(), and cdDM_getPBVH().
void BLI_pbvh_draw | ( | PBVH * | bvh, |
float(*) | planes[4], | ||
float(*) | face_nors[3], | ||
int | smooth | ||
) |
Definition at line 1513 of file pbvh.c.
References BLI_pbvh_node_draw(), BLI_pbvh_node_planes_contain_AABB(), BLI_pbvh_search_callback(), BLI_pbvh_search_gather(), MEM_freeN(), nodes, NULL, pbvh_update_draw_buffers(), pbvh_update_normals(), PBVH_UpdateDrawBuffers, PBVH_UpdateNormals, SET_INT_IN_POINTER, and update_search_cb().
Referenced by ccgDM_drawFacesSolid(), and cdDM_drawFacesSolid().
void BLI_pbvh_free | ( | PBVH * | bvh | ) |
Definition at line 636 of file pbvh.c.
References PBVH::deformed, PBVHNode::draw_buffers, PBVHNode::face_vert_indices, PBVH::faces, PBVHNode::flag, GPU_free_buffers(), i, MEM_freeN(), PBVH::nodes, PBVH_Leaf, PBVH::prim_indices, PBVH::totnode, PBVHNode::vert_indices, and PBVH::verts.
Referenced by free_sculptsession(), multires_force_update(), and object_sculpt_modifiers_changed().
Definition at line 1650 of file pbvh.c.
References MEM_callocN(), MEM_freeN(), PBVH::nodes, NULL, and PBVH::totnode.
Referenced by sculpt_combine_proxies().
void BLI_pbvh_get_grid_updates | ( | PBVH * | bvh, |
int | clear, | ||
void *** | gridfaces, | ||
int * | totface | ||
) |
Definition at line 1173 of file pbvh.c.
References BLI_ghash_free(), BLI_ghash_insert(), BLI_ghash_lookup(), BLI_ghash_new(), BLI_ghash_size(), BLI_ghashIterator_free(), BLI_ghashIterator_getKey(), BLI_ghashIterator_isDone(), BLI_ghashIterator_new(), BLI_ghashIterator_step(), BLI_ghashutil_ptrcmp(), BLI_ghashutil_ptrhash(), PBVHNode::flag, PBVH::gridfaces, i, MEM_callocN(), NULL, pbvh_iter_begin(), pbvh_iter_end(), pbvh_iter_next(), PBVH_UpdateNormals, PBVHNode::prim_indices, and PBVHNode::totprim.
Referenced by ccgdm_pbvh_update(), and multires_stitch_grids().
float(* BLI_pbvh_get_vertCos | ( | struct PBVH * | pbvh | ) | )[3] |
Definition at line 1542 of file pbvh.c.
References co, copy_v3_v3(), MEM_callocN(), and NULL.
Referenced by sculpt_update_keyblock().
void BLI_pbvh_grids_update | ( | PBVH * | bvh, |
struct DMGridData ** | grids, | ||
struct DMGridAdjacency * | gridadj, | ||
void ** | gridfaces | ||
) |
Definition at line 1535 of file pbvh.c.
References PBVH::gridadj, PBVH::gridfaces, and PBVH::grids.
Referenced by ccgDM_getPBVH().
int BLI_pbvh_isDeformed | ( | struct PBVH * | pbvh | ) |
Definition at line 1599 of file pbvh.c.
References PBVH::deformed.
Referenced by sculpt_update_mesh_elements().
PBVH* BLI_pbvh_new | ( | void | ) |
Definition at line 629 of file pbvh.c.
References MEM_callocN().
Referenced by ccgDM_getPBVH(), and cdDM_getPBVH().
PBVHProxyNode* BLI_pbvh_node_add_proxy | ( | PBVH * | bvh, |
PBVHNode * | node | ||
) |
Definition at line 1605 of file pbvh.c.
References PBVHProxyNode::co, PBVH::grids, PBVH::gridsize, MEM_callocN(), MEM_mallocN(), MEM_reallocN(), PBVHNode::proxies, PBVHNode::proxy_count, PBVHNode::totprim, and PBVHNode::uniq_verts.
Referenced by do_clay_brush(), do_clay_tubes_brush(), do_crease_brush(), do_draw_brush(), do_fill_brush(), do_flatten_brush(), do_grab_brush(), do_inflate_brush(), do_nudge_brush(), do_pinch_brush(), do_rotate_brush(), do_scrape_brush(), do_snake_hook_brush(), and do_thumb_brush().
void BLI_pbvh_node_draw | ( | PBVHNode * | node, |
void * | data | ||
) |
Referenced by BLI_pbvh_draw().
void BLI_pbvh_node_free_proxies | ( | PBVHNode * | node | ) |
Definition at line 1632 of file pbvh.c.
References PBVHProxyNode::co, MEM_freeN(), p, PBVHNode::proxies, and PBVHNode::proxy_count.
Referenced by sculpt_combine_proxies().
void BLI_pbvh_node_get_BB | ( | PBVHNode * | node, |
float | bb_min[3], | ||
float | bb_max[3] | ||
) |
Definition at line 1271 of file pbvh.c.
References BB::bmax, BB::bmin, copy_v3_v3(), and PBVHNode::vb.
Referenced by BLI_pbvh_node_planes_contain_AABB(), ray_aabb_intersect(), and sculpt_search_sphere_cb().
void BLI_pbvh_node_get_grids | ( | PBVH * | bvh, |
PBVHNode * | node, | ||
int ** | grid_indices, | ||
int * | totgrid, | ||
int * | maxgrid, | ||
int * | gridsize, | ||
struct DMGridData *** | griddata, | ||
struct DMGridAdjacency ** | gridadj | ||
) |
Definition at line 1251 of file pbvh.c.
References PBVH::gridadj, PBVH::grids, PBVH::gridsize, NULL, PBVHNode::prim_indices, PBVH::totgrid, and PBVHNode::totprim.
Referenced by do_multires_smooth_brush(), and sculpt_undo_push_node().
void BLI_pbvh_node_get_original_BB | ( | PBVHNode * | node, |
float | bb_min[3], | ||
float | bb_max[3] | ||
) |
Definition at line 1277 of file pbvh.c.
References BB::bmax, BB::bmin, copy_v3_v3(), and PBVHNode::orig_vb.
Referenced by ray_aabb_intersect(), and sculpt_search_sphere_cb().
void BLI_pbvh_node_get_proxies | ( | PBVHNode * | node, |
PBVHProxyNode ** | proxies, | ||
int * | proxy_count | ||
) |
Definition at line 1283 of file pbvh.c.
References PBVHNode::proxies, and PBVHNode::proxy_count.
Referenced by sculpt_combine_proxies().
float BLI_pbvh_node_get_tmin | ( | PBVHNode * | node | ) |
Definition at line 892 of file pbvh.c.
References PBVHNode::tmin.
Referenced by sculpt_raycast_cb().
void BLI_pbvh_node_get_verts | ( | PBVH * | bvh, |
PBVHNode * | node, | ||
int ** | vert_indices, | ||
struct MVert ** | verts | ||
) |
Definition at line 1232 of file pbvh.c.
References PBVHNode::vert_indices, and PBVH::verts.
void BLI_pbvh_node_mark_update | ( | PBVHNode * | node | ) |
Definition at line 1227 of file pbvh.c.
References PBVHNode::flag, PBVH_UpdateBB, PBVH_UpdateDrawBuffers, PBVH_UpdateNormals, PBVH_UpdateOriginalBB, and PBVH_UpdateRedraw.
Referenced by BLI_pbvh_apply_vertCos(), do_brush_action(), object_sculpt_modifiers_changed(), sculpt_restore_mesh(), and update_cb().
Definition at line 1238 of file pbvh.c.
References PBVHNode::face_verts, PBVH::grids, PBVH::gridsize, PBVHNode::totprim, and PBVHNode::uniq_verts.
Referenced by sculpt_undo_push_node().
int BLI_pbvh_node_planes_contain_AABB | ( | PBVHNode * | node, |
void * | data | ||
) |
Definition at line 1486 of file pbvh.c.
References BLI_pbvh_node_get_BB(), data, dot_v3v3(), and i.
Referenced by BLI_pbvh_draw().
int BLI_pbvh_node_raycast | ( | PBVH * | bvh, |
PBVHNode * | node, | ||
float(*) | origco[3], | ||
float | ray_start[3], | ||
float | ray_normal[3], | ||
float * | dist | ||
) |
Definition at line 1384 of file pbvh.c.
References co, MVert::co, PBVHNode::face_vert_indices, PBVH::faces, PBVH::grids, PBVH::gridsize, i, NULL, PBVHNode::prim_indices, ray_face_intersection(), PBVHNode::totprim, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and PBVH::verts.
Referenced by sculpt_raycast_cb().
void BLI_pbvh_raycast | ( | PBVH * | bvh, |
BLI_pbvh_HitOccludedCallback | cb, | ||
void * | data, | ||
float | ray_start[3], | ||
float | ray_normal[3], | ||
int | original | ||
) |
Definition at line 1350 of file pbvh.c.
References BLI_pbvh_search_callback_occluded(), copy_v3_v3(), RaycastData::inv_dir, RaycastData::original, ray_aabb_intersect(), RaycastData::sign, and RaycastData::start.
Referenced by sculpt_stroke_get_location().
void BLI_pbvh_redraw_BB | ( | PBVH * | bvh, |
float | bb_min[3], | ||
float | bb_max[3] | ||
) |
Definition at line 1153 of file pbvh.c.
References BB_expand_with_bb(), BB_reset(), BB::bmax, BB::bmin, copy_v3_v3(), PBVHNode::flag, NULL, pbvh_iter_begin(), pbvh_iter_end(), pbvh_iter_next(), PBVH_UpdateRedraw, and PBVHNode::vb.
Referenced by sculpt_get_redraw_rect().
void BLI_pbvh_search_callback | ( | PBVH * | bvh, |
BLI_pbvh_SearchCallback | scb, | ||
void * | search_data, | ||
BLI_pbvh_HitCallback | hcb, | ||
void * | hit_data | ||
) |
Definition at line 825 of file pbvh.c.
References PBVHNode::flag, pbvh_iter_begin(), pbvh_iter_end(), pbvh_iter_next(), and PBVH_Leaf.
Referenced by BLI_pbvh_draw(), and sculpt_undo_restore().
void BLI_pbvh_search_gather | ( | PBVH * | bvh, |
BLI_pbvh_SearchCallback | scb, | ||
void * | search_data, | ||
PBVHNode *** | array, | ||
int * | tot | ||
) |
Definition at line 784 of file pbvh.c.
References MEM_callocN(), MEM_freeN(), NULL, pbvh_iter_begin(), pbvh_iter_end(), pbvh_iter_next(), and PBVH_Leaf.
Referenced by BLI_pbvh_draw(), BLI_pbvh_update(), do_brush_action(), object_sculpt_modifiers_changed(), sculpt_flush_stroke_deform(), and sculpt_restore_mesh().
void BLI_pbvh_update | ( | PBVH * | bvh, |
int | flags, | ||
float(*) | face_nors[3] | ||
) |
Definition at line 1130 of file pbvh.c.
References BLI_pbvh_search_gather(), MEM_freeN(), PBVH::nodes, nodes, pbvh_flush_bb(), pbvh_update_BB_redraw(), pbvh_update_normals(), PBVH_UpdateBB, PBVH_UpdateNormals, PBVH_UpdateOriginalBB, PBVH_UpdateRedraw, SET_INT_IN_POINTER, and update_search_cb().
Referenced by BLI_pbvh_apply_vertCos(), cdDM_update_normals_from_pbvh(), sculpt_flush_update(), sculpt_get_redraw_planes(), sculpt_stroke_done(), and sculpt_undo_restore().