Blender  V2.93
BKE_pbvh.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include "BLI_bitmap.h"
25 #include "BLI_ghash.h"
26 
27 /* For embedding CCGKey in iterator. */
28 #include "BKE_ccg.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 struct BMLog;
35 struct BMesh;
36 struct CCGElem;
37 struct CCGKey;
38 struct CustomData;
39 struct DMFlagMat;
40 struct GPU_PBVH_Buffers;
41 struct IsectRayPrecalc;
42 struct MLoop;
43 struct MLoopTri;
44 struct MPoly;
45 struct MVert;
46 struct Mesh;
47 struct PBVH;
48 struct PBVHNode;
49 struct SubdivCCG;
51 
52 typedef struct PBVH PBVH;
53 typedef struct PBVHNode PBVHNode;
54 
55 typedef struct {
56  float (*co)[3];
58 
59 typedef struct {
60  float (*color)[4];
62 
63 typedef enum {
64  PBVH_Leaf = 1 << 0,
65 
67  PBVH_UpdateBB = 1 << 2,
71  PBVH_UpdateMask = 1 << 6,
73 
75  PBVH_FullyHidden = 1 << 10,
76  PBVH_FullyMasked = 1 << 11,
77  PBVH_FullyUnmasked = 1 << 12,
78 
80  PBVH_UpdateColor = 1 << 14,
82 
83 typedef struct PBVHFrustumPlanes {
84  float (*planes)[4];
87 
90 
91 /* Callbacks */
92 
93 /* returns 1 if the search should continue from this node, 0 otherwise */
94 typedef bool (*BKE_pbvh_SearchCallback)(PBVHNode *node, void *data);
95 
96 typedef void (*BKE_pbvh_HitCallback)(PBVHNode *node, void *data);
97 typedef void (*BKE_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin);
98 
99 typedef void (*BKE_pbvh_SearchNearestCallback)(PBVHNode *node, void *data, float *tmin);
100 
101 /* Building */
102 
103 PBVH *BKE_pbvh_new(void);
105  const struct Mesh *mesh,
106  const struct MPoly *mpoly,
107  const struct MLoop *mloop,
108  struct MVert *verts,
109  int totvert,
110  struct CustomData *vdata,
111  struct CustomData *ldata,
112  struct CustomData *pdata,
113  const struct MLoopTri *looptri,
114  int looptri_num);
115 void BKE_pbvh_build_grids(PBVH *pbvh,
116  struct CCGElem **grids,
117  int totgrid,
118  struct CCGKey *key,
119  void **gridfaces,
120  struct DMFlagMat *flagmats,
121  unsigned int **grid_hidden);
122 void BKE_pbvh_build_bmesh(PBVH *pbvh,
123  struct BMesh *bm,
124  bool smooth_shading,
125  struct BMLog *log,
126  const int cd_vert_node_offset,
127  const int cd_face_node_offset);
128 void BKE_pbvh_free(PBVH *pbvh);
129 
130 /* Hierarchical Search in the BVH, two methods:
131  * - for each hit calling a callback
132  * - gather nodes in an array (easy to multithread) */
133 
134 void BKE_pbvh_search_callback(PBVH *pbvh,
136  void *search_data,
138  void *hit_data);
139 
141  PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot);
142 
143 /* Raycast
144  * the hit callback is called for all leaf nodes intersecting the ray;
145  * it's up to the callback to find the primitive within the leaves that is
146  * hit first */
147 
148 void BKE_pbvh_raycast(PBVH *pbvh,
150  void *data,
151  const float ray_start[3],
152  const float ray_normal[3],
153  bool original);
154 
155 bool BKE_pbvh_node_raycast(PBVH *pbvh,
156  PBVHNode *node,
157  float (*origco)[3],
158  bool use_origco,
159  const float ray_start[3],
160  const float ray_normal[3],
161  struct IsectRayPrecalc *isect_precalc,
162  float *depth,
163  int *active_vertex_index,
164  int *active_face_grid_index,
165  float *face_normal);
166 
168  const float ray_start[3],
169  struct IsectRayPrecalc *isect_precalc,
170  float *depth,
171  float *r_edge_length);
172 
173 /* for orthographic cameras, project the far away ray segment points to the root node so
174  * we can have better precision. */
176  PBVH *pbvh, bool original, float ray_start[3], float ray_end[3], float ray_normal[3]);
177 
180  void *data,
181  const float ray_start[3],
182  const float ray_normal[3],
183  bool original);
184 
186  PBVHNode *node,
187  float (*origco)[3],
188  bool use_origco,
189  const float ray_start[3],
190  const float ray_normal[3],
191  float *depth,
192  float *dist_sq);
193 
194 /* Drawing */
195 
197  bool update_only_visible,
198  PBVHFrustumPlanes *update_frustum,
199  PBVHFrustumPlanes *draw_frustum,
200  void (*draw_fn)(void *user_data, struct GPU_PBVH_Buffers *buffers),
201  void *user_data);
202 
204  PBVH *pbvh,
205  void (*draw_fn)(void *user_data, const float bmin[3], const float bmax[3], PBVHNodeFlags flag),
206  void *user_data);
207 
208 /* PBVH Access */
209 typedef enum {
213 } PBVHType;
214 
215 PBVHType BKE_pbvh_type(const PBVH *pbvh);
216 bool BKE_pbvh_has_faces(const PBVH *pbvh);
217 
218 /* Get the PBVH root's bounding box */
219 void BKE_pbvh_bounding_box(const PBVH *pbvh, float min[3], float max[3]);
220 
221 /* multires hidden data, only valid for type == PBVH_GRIDS */
222 unsigned int **BKE_pbvh_grid_hidden(const PBVH *pbvh);
223 
224 int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden,
225  const int *grid_indices,
226  int totgrid,
227  int gridsize);
228 
230 
231 /* multires level, only valid for type == PBVH_GRIDS */
232 const struct CCGKey *BKE_pbvh_get_grid_key(const PBVH *pbvh);
233 
234 struct CCGElem **BKE_pbvh_get_grids(const PBVH *pbvh);
236 int BKE_pbvh_get_grid_num_vertices(const PBVH *pbvh);
237 int BKE_pbvh_get_grid_num_faces(const PBVH *pbvh);
238 
239 /* Only valid for type == PBVH_BMESH */
240 struct BMesh *BKE_pbvh_get_bmesh(PBVH *pbvh);
241 void BKE_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size);
242 
243 typedef enum {
249  const float center[3],
250  const float view_normal[3],
251  float radius,
252  const bool use_frontface,
253  const bool use_projected);
254 
255 /* Node Access */
256 
265 void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden);
267 void BKE_pbvh_node_fully_masked_set(PBVHNode *node, int fully_masked);
269 void BKE_pbvh_node_fully_unmasked_set(PBVHNode *node, int fully_masked);
271 
272 void BKE_pbvh_node_get_grids(PBVH *pbvh,
273  PBVHNode *node,
274  int **grid_indices,
275  int *totgrid,
276  int *maxgrid,
277  int *gridsize,
278  struct CCGElem ***r_griddata);
279 void BKE_pbvh_node_num_verts(PBVH *pbvh, PBVHNode *node, int *r_uniquevert, int *r_totvert);
280 void BKE_pbvh_node_get_verts(PBVH *pbvh,
281  PBVHNode *node,
282  const int **r_vert_indices,
283  struct MVert **r_verts);
284 
285 void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
286 void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
287 
289 
290 /* test if AABB is at least partially inside the PBVHFrustumPlanes volume */
291 bool BKE_pbvh_node_frustum_contain_AABB(PBVHNode *node, void *frustum);
292 /* test if AABB is at least partially outside the PBVHFrustumPlanes volume */
293 bool BKE_pbvh_node_frustum_exclude_AABB(PBVHNode *node, void *frustum);
294 
300 
301 /* Update Bounding Box/Redraw and clear flags */
302 
303 void BKE_pbvh_update_bounds(PBVH *pbvh, int flags);
304 void BKE_pbvh_update_vertex_data(PBVH *pbvh, int flags);
305 void BKE_pbvh_update_visibility(PBVH *pbvh);
306 void BKE_pbvh_update_normals(PBVH *pbvh, struct SubdivCCG *subdiv_ccg);
307 void BKE_pbvh_redraw_BB(PBVH *pbvh, float bb_min[3], float bb_max[3]);
308 void BKE_pbvh_get_grid_updates(PBVH *pbvh, bool clear, void ***r_gridfaces, int *r_totface);
309 void BKE_pbvh_grids_update(PBVH *pbvh,
310  struct CCGElem **grids,
311  void **gridfaces,
312  struct DMFlagMat *flagmats,
313  unsigned int **grid_hidden);
314 void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, struct SubdivCCG *subdiv_ccg);
315 void BKE_pbvh_face_sets_set(PBVH *pbvh, int *face_sets);
316 
317 void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default);
318 
319 void BKE_pbvh_respect_hide_set(PBVH *pbvh, bool respect_hide);
320 
321 /* vertex deformer */
322 float (*BKE_pbvh_vert_coords_alloc(struct PBVH *pbvh))[3];
323 void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float (*vertCos)[3], const int totvert);
324 bool BKE_pbvh_is_deformed(struct PBVH *pbvh);
325 
326 /* Vertex Iterator */
327 
328 /* this iterator has quite a lot of code, but it's designed to:
329  * - allow the compiler to eliminate dead code and variables
330  * - spend most of the time in the relatively simple inner loop */
331 
332 /* note: PBVH_ITER_ALL does not skip hidden vertices,
333  * PBVH_ITER_UNIQUE does */
334 #define PBVH_ITER_ALL 0
335 #define PBVH_ITER_UNIQUE 1
336 
337 typedef struct PBVHVertexIter {
338  /* iteration */
339  int g;
340  int width;
341  int height;
342  int gx;
343  int gy;
344  int i;
345  int index;
347 
348  /* grid */
349  struct CCGKey key;
350  struct CCGElem **grids;
351  struct CCGElem *grid;
354  int totgrid;
355  int gridsize;
356 
357  /* mesh */
358  struct MVert *mverts;
359  int totvert;
360  const int *vert_indices;
361  struct MPropCol *vcol;
362  float *vmask;
363 
364  /* bmesh */
369 
370  /* result: these are all computed in the macro, but we assume
371  * that compiler optimization's will skip the ones we don't use */
372  struct MVert *mvert;
373  struct BMVert *bm_vert;
374  float *co;
375  short *no;
376  float *fno;
377  float *mask;
378  float *col;
379  bool visible;
381 
382 void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int mode);
383 
384 #define BKE_pbvh_vertex_iter_begin(pbvh, node, vi, mode) \
385  pbvh_vertex_iter_init(pbvh, node, &vi, mode); \
386 \
387  for (vi.i = 0, vi.g = 0; vi.g < vi.totgrid; vi.g++) { \
388  if (vi.grids) { \
389  vi.width = vi.gridsize; \
390  vi.height = vi.gridsize; \
391  vi.index = vi.grid_indices[vi.g] * vi.key.grid_area - 1; \
392  vi.grid = vi.grids[vi.grid_indices[vi.g]]; \
393  if (mode == PBVH_ITER_UNIQUE) { \
394  vi.gh = vi.grid_hidden[vi.grid_indices[vi.g]]; \
395  } \
396  } \
397  else { \
398  vi.width = vi.totvert; \
399  vi.height = 1; \
400  } \
401 \
402  for (vi.gy = 0; vi.gy < vi.height; vi.gy++) { \
403  for (vi.gx = 0; vi.gx < vi.width; vi.gx++, vi.i++) { \
404  if (vi.grid) { \
405  vi.co = CCG_elem_co(&vi.key, vi.grid); \
406  vi.fno = CCG_elem_no(&vi.key, vi.grid); \
407  vi.mask = vi.key.has_mask ? CCG_elem_mask(&vi.key, vi.grid) : NULL; \
408  vi.grid = CCG_elem_next(&vi.key, vi.grid); \
409  vi.index++; \
410  vi.visible = true; \
411  if (vi.gh) { \
412  if (BLI_BITMAP_TEST(vi.gh, vi.gy * vi.gridsize + vi.gx)) { \
413  continue; \
414  } \
415  } \
416  } \
417  else if (vi.mverts) { \
418  vi.mvert = &vi.mverts[vi.vert_indices[vi.gx]]; \
419  if (vi.respect_hide) { \
420  vi.visible = !(vi.mvert->flag & ME_HIDE); \
421  if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
422  continue; \
423  } \
424  } \
425  else { \
426  BLI_assert(vi.visible); \
427  } \
428  vi.co = vi.mvert->co; \
429  vi.no = vi.mvert->no; \
430  vi.index = vi.vert_indices[vi.i]; \
431  if (vi.vmask) { \
432  vi.mask = &vi.vmask[vi.index]; \
433  } \
434  if (vi.vcol) { \
435  vi.col = vi.vcol[vi.index].color; \
436  } \
437  } \
438  else { \
439  if (!BLI_gsetIterator_done(&vi.bm_unique_verts)) { \
440  vi.bm_vert = BLI_gsetIterator_getKey(&vi.bm_unique_verts); \
441  BLI_gsetIterator_step(&vi.bm_unique_verts); \
442  } \
443  else { \
444  vi.bm_vert = BLI_gsetIterator_getKey(&vi.bm_other_verts); \
445  BLI_gsetIterator_step(&vi.bm_other_verts); \
446  } \
447  vi.visible = !BM_elem_flag_test_bool(vi.bm_vert, BM_ELEM_HIDDEN); \
448  if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
449  continue; \
450  } \
451  vi.co = vi.bm_vert->co; \
452  vi.fno = vi.bm_vert->no; \
453  vi.index = BM_elem_index_get(vi.bm_vert); \
454  vi.mask = BM_ELEM_CD_GET_VOID_P(vi.bm_vert, vi.cd_vert_mask_offset); \
455  }
456 
457 #define BKE_pbvh_vertex_iter_end \
458  } \
459  } \
460  } \
461  ((void)0)
462 
463 void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count);
466 void BKE_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***r_array, int *r_tot);
468  int (**r_orco_tris)[3],
469  int *r_orco_tris_num,
470  float (**r_orco_coords)[3]);
471 
473 
474 // void BKE_pbvh_node_BB_reset(PBVHNode *node);
475 // void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
476 
477 bool pbvh_has_mask(PBVH *pbvh);
478 void pbvh_show_mask_set(PBVH *pbvh, bool show_mask);
479 
480 bool pbvh_has_face_sets(PBVH *pbvh);
481 void pbvh_show_face_sets_set(PBVH *pbvh, bool show_face_sets);
482 
483 /* Parallelization */
485  bool use_threading,
486  int totnode);
487 
488 struct MVert *BKE_pbvh_get_verts(const PBVH *pbvh);
489 
492 
493 #ifdef __cplusplus
494 }
495 #endif
typedef float(TangentPoint)[2]
struct CCGElem CCGElem
Definition: BKE_ccg.h:46
bool BKE_pbvh_node_fully_masked_get(PBVHNode *node)
Definition: pbvh.c:1798
void BKE_pbvh_build_grids(PBVH *pbvh, struct CCGElem **grids, int totgrid, struct CCGKey *key, void **gridfaces, struct DMFlagMat *flagmats, unsigned int **grid_hidden)
Definition: pbvh.c:625
int BKE_pbvh_get_grid_num_faces(const PBVH *pbvh)
Definition: pbvh.c:1718
void BKE_pbvh_node_free_proxies(PBVHNode *node)
Definition: pbvh.c:2869
void BKE_pbvh_set_frustum_planes(PBVH *pbvh, PBVHFrustumPlanes *planes)
Definition: pbvh.c:3026
void BKE_pbvh_node_mark_update(PBVHNode *node)
Definition: pbvh.c:1732
BLI_bitmap ** BKE_pbvh_get_grid_visibility(const PBVH *pbvh)
Definition: pbvh.c:1706
void BKE_pbvh_node_get_bm_orco_data(PBVHNode *node, int(**r_orco_tris)[3], int *r_orco_tris_num, float(**r_orco_coords)[3])
Definition: pbvh.c:1947
void BKE_pbvh_sync_face_sets_to_grids(PBVH *pbvh)
Definition: pbvh.c:387
void BKE_pbvh_node_get_verts(PBVH *pbvh, PBVHNode *node, const int **r_vert_indices, struct MVert **r_verts)
Definition: pbvh.c:1820
void BKE_pbvh_node_fully_masked_set(PBVHNode *node, int fully_masked)
Definition: pbvh.c:1786
void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3])
Definition: pbvh.c:1921
void BKE_pbvh_node_mark_update_visibility(PBVHNode *node)
Definition: pbvh.c:1748
struct CCGElem ** BKE_pbvh_get_grids(const PBVH *pbvh)
Definition: pbvh.c:1700
void BKE_pbvh_node_mark_update_color(PBVHNode *node)
Definition: pbvh.c:1743
bool pbvh_has_mask(PBVH *pbvh)
Definition: pbvh.c:2988
void BKE_pbvh_get_frustum_planes(PBVH *pbvh, PBVHFrustumPlanes *planes)
Definition: pbvh.c:3034
void BKE_pbvh_raycast_project_ray_root(PBVH *pbvh, bool original, float ray_start[3], float ray_end[3], float ray_normal[3])
Definition: pbvh.c:2353
void BKE_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***r_array, int *r_tot)
Definition: pbvh.c:2882
void BKE_pbvh_redraw_BB(PBVH *pbvh, float bb_min[3], float bb_max[3])
Definition: pbvh.c:1592
void BKE_pbvh_node_num_verts(PBVH *pbvh, PBVHNode *node, int *r_uniquevert, int *r_totvert)
Definition: pbvh.c:1834
bool BKE_pbvh_node_frustum_contain_AABB(PBVHNode *node, void *frustum)
Definition: pbvh.c:2630
void BKE_pbvh_find_nearest_to_ray(PBVH *pbvh, BKE_pbvh_HitOccludedCallback cb, void *data, const float ray_start[3], const float ray_normal[3], bool original)
Definition: pbvh.c:2430
void BKE_pbvh_bmesh_node_save_orig(struct BMesh *bm, PBVHNode *node)
Definition: pbvh_bmesh.c:2038
void BKE_pbvh_node_fully_unmasked_set(PBVHNode *node, int fully_masked)
Definition: pbvh.c:1803
void BKE_pbvh_draw_debug_cb(PBVH *pbvh, void(*draw_fn)(void *user_data, const float bmin[3], const float bmax[3], PBVHNodeFlags flag), void *user_data)
Definition: pbvh.c:2752
void BKE_pbvh_update_visibility(PBVH *pbvh)
Definition: pbvh.c:1574
void BKE_pbvh_get_grid_updates(PBVH *pbvh, bool clear, void ***r_gridfaces, int *r_totface)
Definition: pbvh.c:1614
void pbvh_show_mask_set(PBVH *pbvh, bool show_mask)
Definition: pbvh.c:3016
float(* BKE_pbvh_vert_coords_alloc(struct PBVH *pbvh))[3]
Definition: pbvh.c:2780
void BKE_pbvh_free(PBVH *pbvh)
Definition: pbvh.c:679
bool BKE_pbvh_is_deformed(struct PBVH *pbvh)
Definition: pbvh.c:2842
void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3])
Definition: pbvh.c:1915
void BKE_pbvh_node_color_buffer_free(PBVH *pbvh)
Definition: pbvh.c:2920
PBVHType BKE_pbvh_type(const PBVH *pbvh)
Definition: pbvh.c:1661
void pbvh_show_face_sets_set(PBVH *pbvh, bool show_face_sets)
Definition: pbvh.c:3021
float BKE_pbvh_node_get_tmin(PBVHNode *node)
Definition: pbvh.c:954
void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, struct SubdivCCG *subdiv_ccg)
Definition: pbvh.c:3056
bool BKE_pbvh_node_frustum_exclude_AABB(PBVHNode *node, void *frustum)
Definition: pbvh.c:2640
bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh, PBVHTopologyUpdateMode mode, const float center[3], const float view_normal[3], float radius, const bool use_frontface, const bool use_projected)
Definition: pbvh_bmesh.c:1957
void(* BKE_pbvh_HitCallback)(PBVHNode *node, void *data)
Definition: BKE_pbvh.h:96
struct BMesh * BKE_pbvh_get_bmesh(PBVH *pbvh)
Definition: pbvh.c:1724
void BKE_pbvh_node_mark_rebuild_draw(PBVHNode *node)
Definition: pbvh.c:1754
bool BKE_pbvh_node_raycast(PBVH *pbvh, PBVHNode *node, float(*origco)[3], bool use_origco, const float ray_start[3], const float ray_normal[3], struct IsectRayPrecalc *isect_precalc, float *depth, int *active_vertex_index, int *active_face_grid_index, float *face_normal)
Definition: pbvh.c:2294
void BKE_pbvh_node_mark_normals_update(PBVHNode *node)
Definition: pbvh.c:1764
void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default)
Definition: pbvh.c:2680
void BKE_pbvh_raycast(PBVH *pbvh, BKE_pbvh_HitOccludedCallback cb, void *data, const float ray_start[3], const float ray_normal[3], bool original)
Definition: pbvh.c:2006
void BKE_pbvh_build_mesh(PBVH *pbvh, const struct Mesh *mesh, const struct MPoly *mpoly, const struct MLoop *mloop, struct MVert *verts, int totvert, struct CustomData *vdata, struct CustomData *ldata, struct CustomData *pdata, const struct MLoopTri *looptri, int looptri_num)
int BKE_pbvh_get_grid_num_vertices(const PBVH *pbvh)
Definition: pbvh.c:1712
int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden, const int *grid_indices, int totgrid, int gridsize)
Definition: pbvh.c:355
bool BKE_pbvh_bmesh_node_raycast_detail(PBVHNode *node, const float ray_start[3], struct IsectRayPrecalc *isect_precalc, float *depth, float *r_edge_length)
Definition: pbvh_bmesh.c:1572
void BKE_pbvh_build_bmesh(PBVH *pbvh, struct BMesh *bm, bool smooth_shading, struct BMLog *log, const int cd_vert_node_offset, const int cd_face_node_offset)
Definition: pbvh_bmesh.c:1879
void BKE_pbvh_update_normals(PBVH *pbvh, struct SubdivCCG *subdiv_ccg)
Definition: pbvh.c:2650
PBVHTopologyUpdateMode
Definition: BKE_pbvh.h:243
@ PBVH_Collapse
Definition: BKE_pbvh.h:245
@ PBVH_Subdivide
Definition: BKE_pbvh.h:244
const struct CCGKey * BKE_pbvh_get_grid_key(const PBVH *pbvh)
Definition: pbvh.c:1694
struct GSet * BKE_pbvh_bmesh_node_other_verts(PBVHNode *node)
Definition: pbvh_bmesh.c:2126
PBVHType
Definition: BKE_pbvh.h:209
@ PBVH_GRIDS
Definition: BKE_pbvh.h:211
@ PBVH_BMESH
Definition: BKE_pbvh.h:212
@ PBVH_FACES
Definition: BKE_pbvh.h:210
bool BKE_pbvh_node_find_nearest_to_ray(PBVH *pbvh, PBVHNode *node, float(*origco)[3], bool use_origco, const float ray_start[3], const float ray_normal[3], float *depth, float *dist_sq)
Definition: pbvh.c:2554
struct GSet * BKE_pbvh_bmesh_node_faces(PBVHNode *node)
Definition: pbvh_bmesh.c:2131
struct PBVHFrustumPlanes PBVHFrustumPlanes
PBVHProxyNode * BKE_pbvh_node_add_proxy(PBVH *pbvh, PBVHNode *node)
Definition: pbvh.c:2848
bool BKE_pbvh_node_vert_update_check_any(PBVH *pbvh, PBVHNode *node)
Definition: pbvh.c:1962
PBVH * BKE_pbvh_new(void)
Definition: pbvh.c:672
bool BKE_pbvh_has_faces(const PBVH *pbvh)
Definition: pbvh.c:1666
void BKE_pbvh_node_get_grids(PBVH *pbvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, struct CCGElem ***r_griddata)
Definition: pbvh.c:1868
bool BKE_pbvh_node_fully_hidden_get(PBVHNode *node)
Definition: pbvh.c:1781
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
Definition: pbvh.c:1769
void(* BKE_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin)
Definition: BKE_pbvh.h:97
void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings, bool use_threading, int totnode)
Definition: pbvh.c:3042
struct MVert * BKE_pbvh_get_verts(const PBVH *pbvh)
Definition: pbvh.c:3050
PBVHColorBufferNode * BKE_pbvh_node_color_buffer_get(PBVHNode *node)
Definition: pbvh.c:2911
struct GSet * BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node)
Definition: pbvh_bmesh.c:2121
void BKE_pbvh_update_vertex_data(PBVH *pbvh, int flags)
Definition: pbvh.c:1432
void BKE_pbvh_bmesh_after_stroke(PBVH *pbvh)
Definition: pbvh_bmesh.c:2095
void BKE_pbvh_respect_hide_set(PBVH *pbvh, bool respect_hide)
Definition: pbvh.c:3066
void BKE_pbvh_node_mark_update_mask(PBVHNode *node)
Definition: pbvh.c:1738
bool BKE_pbvh_node_fully_unmasked_get(PBVHNode *node)
Definition: pbvh.c:1815
void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float(*vertCos)[3], const int totvert)
Definition: pbvh.c:2798
void BKE_pbvh_update_bounds(PBVH *pbvh, int flags)
Definition: pbvh.c:1410
void BKE_pbvh_bounding_box(const PBVH *pbvh, float min[3], float max[3])
Definition: pbvh.c:1675
void BKE_pbvh_search_callback(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, BKE_pbvh_HitCallback hcb, void *hit_data)
Definition: pbvh.c:876
void BKE_pbvh_node_mark_redraw(PBVHNode *node)
Definition: pbvh.c:1759
void(* BKE_pbvh_SearchNearestCallback)(PBVHNode *node, void *data, float *tmin)
Definition: BKE_pbvh.h:99
void BKE_pbvh_grids_update(PBVH *pbvh, struct CCGElem **grids, void **gridfaces, struct DMFlagMat *flagmats, unsigned int **grid_hidden)
Definition: pbvh.c:2764
unsigned int ** BKE_pbvh_grid_hidden(const PBVH *pbvh)
Definition: pbvh.c:1688
struct PBVHVertexIter PBVHVertexIter
void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int mode)
Definition: pbvh.c:2931
void BKE_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size)
Definition: pbvh_bmesh.c:2110
void BKE_pbvh_face_sets_set(PBVH *pbvh, int *face_sets)
Definition: pbvh.c:3061
void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count)
Definition: pbvh.c:1927
void BKE_pbvh_node_mark_topology_update(PBVHNode *node)
Definition: pbvh_bmesh.c:2116
void BKE_pbvh_search_gather(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot)
Definition: pbvh.c:843
void BKE_pbvh_draw_cb(PBVH *pbvh, bool update_only_visible, PBVHFrustumPlanes *update_frustum, PBVHFrustumPlanes *draw_frustum, void(*draw_fn)(void *user_data, struct GPU_PBVH_Buffers *buffers), void *user_data)
PBVHNodeFlags
Definition: BKE_pbvh.h:63
@ PBVH_FullyMasked
Definition: BKE_pbvh.h:76
@ PBVH_UpdateDrawBuffers
Definition: BKE_pbvh.h:69
@ PBVH_RebuildDrawBuffers
Definition: BKE_pbvh.h:74
@ PBVH_UpdateVisibility
Definition: BKE_pbvh.h:72
@ PBVH_UpdateMask
Definition: BKE_pbvh.h:71
@ PBVH_UpdateColor
Definition: BKE_pbvh.h:80
@ PBVH_UpdateNormals
Definition: BKE_pbvh.h:66
@ PBVH_UpdateTopology
Definition: BKE_pbvh.h:79
@ PBVH_FullyHidden
Definition: BKE_pbvh.h:75
@ PBVH_UpdateBB
Definition: BKE_pbvh.h:67
@ PBVH_Leaf
Definition: BKE_pbvh.h:64
@ PBVH_UpdateOriginalBB
Definition: BKE_pbvh.h:68
@ PBVH_UpdateRedraw
Definition: BKE_pbvh.h:70
@ PBVH_FullyUnmasked
Definition: BKE_pbvh.h:77
bool(* BKE_pbvh_SearchCallback)(PBVHNode *node, void *data)
Definition: BKE_pbvh.h:94
bool pbvh_has_face_sets(PBVH *pbvh)
Definition: pbvh.c:3002
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:32
struct GSet GSet
Definition: BLI_ghash.h:189
NSNotificationCenter * center
ATTR_WARN_UNUSED_RESULT BMesh * bm
static unsigned long seed
Definition: btSoftBody.h:39
OperationNode * node
void * user_data
static float verts[][3]
static void clear(Message *msg)
Definition: msgfmt.c:294
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:303
#define min(a, b)
Definition: sort.c:51
Definition: BKE_ccg.h:48
float(* planes)[4]
Definition: BKE_pbvh.h:84
struct MVert * mvert
Definition: BKE_pbvh.h:372
int * grid_indices
Definition: BKE_pbvh.h:353
short * no
Definition: BKE_pbvh.h:375
bool respect_hide
Definition: BKE_pbvh.h:346
struct CCGKey key
Definition: BKE_pbvh.h:349
float * co
Definition: BKE_pbvh.h:374
int cd_vert_mask_offset
Definition: BKE_pbvh.h:368
float * fno
Definition: BKE_pbvh.h:376
float * col
Definition: BKE_pbvh.h:378
BLI_bitmap ** grid_hidden
Definition: BKE_pbvh.h:352
struct GSetIterator bm_other_verts
Definition: BKE_pbvh.h:366
struct GSetIterator bm_unique_verts
Definition: BKE_pbvh.h:365
BLI_bitmap * gh
Definition: BKE_pbvh.h:352
struct BMVert * bm_vert
Definition: BKE_pbvh.h:373
float * vmask
Definition: BKE_pbvh.h:362
struct CCGElem ** grids
Definition: BKE_pbvh.h:350
struct CCGElem * grid
Definition: BKE_pbvh.h:351
float * mask
Definition: BKE_pbvh.h:377
const int * vert_indices
Definition: BKE_pbvh.h:360
struct MPropCol * vcol
Definition: BKE_pbvh.h:361
struct CustomData * bm_vdata
Definition: BKE_pbvh.h:367
struct MVert * mverts
Definition: BKE_pbvh.h:358
float max