Blender  V3.3
BKE_pbvh.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
10 #include "BLI_bitmap.h"
11 #include "BLI_ghash.h"
12 
13 /* For embedding CCGKey in iterator. */
14 #include "BKE_attribute.h"
15 #include "BKE_ccg.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 struct BMLog;
22 struct BMesh;
23 struct CCGElem;
24 struct CCGKey;
25 struct CustomData;
26 struct DMFlagMat;
27 struct GPU_PBVH_Buffers;
28 struct IsectRayPrecalc;
29 struct MLoop;
30 struct MLoopTri;
31 struct MPoly;
32 struct MVert;
33 struct Mesh;
34 struct MeshElemMap;
35 struct PBVH;
36 struct PBVHNode;
37 struct SubdivCCG;
39 struct Image;
40 struct ImageUser;
41 struct MeshElemMap;
42 
43 typedef struct PBVH PBVH;
44 typedef struct PBVHNode PBVHNode;
45 
46 typedef struct {
47  float (*co)[3];
49 
50 typedef struct {
51  float (*color)[4];
53 
54 typedef struct PBVHPixelsNode {
60  void *node_data;
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,
81  PBVH_RebuildPixels = 1 << 15,
82 
84 
85 typedef struct PBVHFrustumPlanes {
86  float (*planes)[4];
89 
92 
93 /* Callbacks */
94 
99 
101 typedef void (*BKE_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin);
102 
103 typedef void (*BKE_pbvh_SearchNearestCallback)(PBVHNode *node, void *data, float *tmin);
104 
105 /* Building */
106 
107 PBVH *BKE_pbvh_new(void);
115  struct Mesh *mesh,
116  const struct MPoly *mpoly,
117  const struct MLoop *mloop,
118  struct MVert *verts,
119  int totvert,
120  struct CustomData *vdata,
121  struct CustomData *ldata,
122  struct CustomData *pdata,
123  const struct MLoopTri *looptri,
124  int looptri_num);
128 void BKE_pbvh_build_grids(PBVH *pbvh,
129  struct CCGElem **grids,
130  int totgrid,
131  struct CCGKey *key,
132  void **gridfaces,
133  struct DMFlagMat *flagmats,
134  unsigned int **grid_hidden);
138 void BKE_pbvh_build_bmesh(PBVH *pbvh,
139  struct BMesh *bm,
140  bool smooth_shading,
141  struct BMLog *log,
142  int cd_vert_node_offset,
143  int cd_face_node_offset);
144 
145 void BKE_pbvh_build_pixels(PBVH *pbvh,
146  struct Mesh *mesh,
147  struct Image *image,
148  struct ImageUser *image_user);
149 void BKE_pbvh_free(PBVH *pbvh);
150 
151 /* Hierarchical Search in the BVH, two methods:
152  * - For each hit calling a callback.
153  * - Gather nodes in an array (easy to multi-thread). */
154 
155 void BKE_pbvh_search_callback(PBVH *pbvh,
157  void *search_data,
159  void *hit_data);
160 
162  PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot);
163 
164 /* Ray-cast
165  * the hit callback is called for all leaf nodes intersecting the ray;
166  * it's up to the callback to find the primitive within the leaves that is
167  * hit first */
168 
169 void BKE_pbvh_raycast(PBVH *pbvh,
171  void *data,
172  const float ray_start[3],
173  const float ray_normal[3],
174  bool original);
175 
176 bool BKE_pbvh_node_raycast(PBVH *pbvh,
177  PBVHNode *node,
178  float (*origco)[3],
179  bool use_origco,
180  const float ray_start[3],
181  const float ray_normal[3],
182  struct IsectRayPrecalc *isect_precalc,
183  float *depth,
184  int *active_vertex_index,
185  int *active_face_grid_index,
186  float *face_normal);
187 
189  const float ray_start[3],
190  struct IsectRayPrecalc *isect_precalc,
191  float *depth,
192  float *r_edge_length);
193 
199  PBVH *pbvh, bool original, float ray_start[3], float ray_end[3], float ray_normal[3]);
200 
203  void *data,
204  const float ray_start[3],
205  const float ray_normal[3],
206  bool original);
207 
209  PBVHNode *node,
210  float (*origco)[3],
211  bool use_origco,
212  const float ray_start[3],
213  const float ray_normal[3],
214  float *depth,
215  float *dist_sq);
216 
217 /* Drawing */
218 
220  bool update_only_visible,
221  PBVHFrustumPlanes *update_frustum,
222  PBVHFrustumPlanes *draw_frustum,
223  void (*draw_fn)(void *user_data, struct GPU_PBVH_Buffers *buffers),
224  void *user_data,
225  bool full_render);
226 
228  PBVH *pbvh,
229  void (*draw_fn)(void *user_data, const float bmin[3], const float bmax[3], PBVHNodeFlags flag),
230  void *user_data);
231 
232 /* PBVH Access */
233 typedef enum {
237 } PBVHType;
238 
239 PBVHType BKE_pbvh_type(const PBVH *pbvh);
240 bool BKE_pbvh_has_faces(const PBVH *pbvh);
241 
245 void BKE_pbvh_bounding_box(const PBVH *pbvh, float min[3], float max[3]);
246 
250 unsigned int **BKE_pbvh_grid_hidden(const PBVH *pbvh);
251 
255 int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden,
256  const int *grid_indices,
257  int totgrid,
258  int gridsize);
259 
261 
265 const struct CCGKey *BKE_pbvh_get_grid_key(const PBVH *pbvh);
266 
267 struct CCGElem **BKE_pbvh_get_grids(const PBVH *pbvh);
269 int BKE_pbvh_get_grid_num_vertices(const PBVH *pbvh);
270 int BKE_pbvh_get_grid_num_faces(const PBVH *pbvh);
271 
275 struct BMesh *BKE_pbvh_get_bmesh(PBVH *pbvh);
276 void BKE_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size);
277 
278 typedef enum {
287  const float center[3],
288  const float view_normal[3],
289  float radius,
290  bool use_frontface,
291  bool use_projected);
292 
293 /* Node Access */
294 
303 void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden);
305 void BKE_pbvh_node_fully_masked_set(PBVHNode *node, int fully_masked);
307 void BKE_pbvh_node_fully_unmasked_set(PBVHNode *node, int fully_masked);
309 
311 void BKE_pbvh_vert_tag_update_normal(PBVH *pbvh, int index);
312 
313 void BKE_pbvh_node_get_grids(PBVH *pbvh,
314  PBVHNode *node,
315  int **grid_indices,
316  int *totgrid,
317  int *maxgrid,
318  int *gridsize,
319  struct CCGElem ***r_griddata);
320 void BKE_pbvh_node_num_verts(PBVH *pbvh, PBVHNode *node, int *r_uniquevert, int *r_totvert);
321 void BKE_pbvh_node_get_verts(PBVH *pbvh,
322  PBVHNode *node,
323  const int **r_vert_indices,
324  struct MVert **r_verts);
326  PBVHNode *node,
327  const int **r_loop_indices,
328  const struct MLoop **r_loops);
329 
330 void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
331 void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
332 
334 
338 bool BKE_pbvh_node_frustum_contain_AABB(PBVHNode *node, void *frustum);
342 bool BKE_pbvh_node_frustum_exclude_AABB(PBVHNode *node, void *frustum);
343 
355 
356 /* Update Bounding Box/Redraw and clear flags. */
357 
358 void BKE_pbvh_update_bounds(PBVH *pbvh, int flags);
359 void BKE_pbvh_update_vertex_data(PBVH *pbvh, int flags);
360 void BKE_pbvh_update_visibility(PBVH *pbvh);
361 void BKE_pbvh_update_normals(PBVH *pbvh, struct SubdivCCG *subdiv_ccg);
362 void BKE_pbvh_redraw_BB(PBVH *pbvh, float bb_min[3], float bb_max[3]);
363 void BKE_pbvh_get_grid_updates(PBVH *pbvh, bool clear, void ***r_gridfaces, int *r_totface);
364 void BKE_pbvh_grids_update(PBVH *pbvh,
365  struct CCGElem **grids,
366  void **gridfaces,
367  struct DMFlagMat *flagmats,
368  unsigned int **grid_hidden);
369 void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, struct SubdivCCG *subdiv_ccg);
370 void BKE_pbvh_face_sets_set(PBVH *pbvh, int *face_sets);
371 
372 void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default);
373 
374 void BKE_pbvh_respect_hide_set(PBVH *pbvh, bool respect_hide);
375 
376 /* Vertex Deformer. */
377 
378 float (*BKE_pbvh_vert_coords_alloc(struct PBVH *pbvh))[3];
379 void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float (*vertCos)[3], int totvert);
380 bool BKE_pbvh_is_deformed(struct PBVH *pbvh);
381 
382 /* Vertex Iterator. */
383 
384 /* This iterator has quite a lot of code, but it's designed to:
385  * - allow the compiler to eliminate dead code and variables
386  * - spend most of the time in the relatively simple inner loop */
387 
388 /* NOTE: PBVH_ITER_ALL does not skip hidden vertices,
389  * PBVH_ITER_UNIQUE does */
390 #define PBVH_ITER_ALL 0
391 #define PBVH_ITER_UNIQUE 1
392 
393 typedef struct PBVHVertexIter {
394  /* iteration */
395  int g;
396  int width;
397  int height;
398  int gx;
399  int gy;
400  int i;
401  int index;
403 
404  /* grid */
405  struct CCGKey key;
406  struct CCGElem **grids;
407  struct CCGElem *grid;
410  int totgrid;
411  int gridsize;
412 
413  /* mesh */
414  struct MVert *mverts;
416  int totvert;
417  const int *vert_indices;
418  float *vmask;
419 
420  /* bmesh */
425 
426  /* result: these are all computed in the macro, but we assume
427  * that compiler optimization's will skip the ones we don't use */
428  struct MVert *mvert;
429  struct BMVert *bm_vert;
430  float *co;
431  float *no;
432  float *fno;
433  float *mask;
434  bool visible;
436 
437 void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int mode);
438 
439 #define BKE_pbvh_vertex_iter_begin(pbvh, node, vi, mode) \
440  pbvh_vertex_iter_init(pbvh, node, &vi, mode); \
441 \
442  for (vi.i = 0, vi.g = 0; vi.g < vi.totgrid; vi.g++) { \
443  if (vi.grids) { \
444  vi.width = vi.gridsize; \
445  vi.height = vi.gridsize; \
446  vi.index = vi.grid_indices[vi.g] * vi.key.grid_area - 1; \
447  vi.grid = vi.grids[vi.grid_indices[vi.g]]; \
448  if (mode == PBVH_ITER_UNIQUE) { \
449  vi.gh = vi.grid_hidden[vi.grid_indices[vi.g]]; \
450  } \
451  } \
452  else { \
453  vi.width = vi.totvert; \
454  vi.height = 1; \
455  } \
456 \
457  for (vi.gy = 0; vi.gy < vi.height; vi.gy++) { \
458  for (vi.gx = 0; vi.gx < vi.width; vi.gx++, vi.i++) { \
459  if (vi.grid) { \
460  vi.co = CCG_elem_co(&vi.key, vi.grid); \
461  vi.fno = CCG_elem_no(&vi.key, vi.grid); \
462  vi.mask = vi.key.has_mask ? CCG_elem_mask(&vi.key, vi.grid) : NULL; \
463  vi.grid = CCG_elem_next(&vi.key, vi.grid); \
464  vi.index++; \
465  vi.visible = true; \
466  if (vi.gh) { \
467  if (BLI_BITMAP_TEST(vi.gh, vi.gy * vi.gridsize + vi.gx)) { \
468  continue; \
469  } \
470  } \
471  } \
472  else if (vi.mverts) { \
473  vi.mvert = &vi.mverts[vi.vert_indices[vi.gx]]; \
474  if (vi.respect_hide) { \
475  vi.visible = !(vi.mvert->flag & ME_HIDE); \
476  if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
477  continue; \
478  } \
479  } \
480  else { \
481  BLI_assert(vi.visible); \
482  } \
483  vi.co = vi.mvert->co; \
484  vi.no = vi.vert_normals[vi.vert_indices[vi.gx]]; \
485  vi.index = vi.vert_indices[vi.i]; \
486  if (vi.vmask) { \
487  vi.mask = &vi.vmask[vi.index]; \
488  } \
489  } \
490  else { \
491  if (!BLI_gsetIterator_done(&vi.bm_unique_verts)) { \
492  vi.bm_vert = (BMVert *)BLI_gsetIterator_getKey(&vi.bm_unique_verts); \
493  BLI_gsetIterator_step(&vi.bm_unique_verts); \
494  } \
495  else { \
496  vi.bm_vert = (BMVert *)BLI_gsetIterator_getKey(&vi.bm_other_verts); \
497  BLI_gsetIterator_step(&vi.bm_other_verts); \
498  } \
499  vi.visible = !BM_elem_flag_test_bool(vi.bm_vert, BM_ELEM_HIDDEN); \
500  if (mode == PBVH_ITER_UNIQUE && !vi.visible) { \
501  continue; \
502  } \
503  vi.co = vi.bm_vert->co; \
504  vi.fno = vi.bm_vert->no; \
505  vi.index = BM_elem_index_get(vi.bm_vert); \
506  vi.mask = (float *)BM_ELEM_CD_GET_VOID_P(vi.bm_vert, vi.cd_vert_mask_offset); \
507  }
508 
509 #define BKE_pbvh_vertex_iter_end \
510  } \
511  } \
512  } \
513  ((void)0)
514 
515 void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count);
518 void BKE_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***r_array, int *r_tot);
520  int (**r_orco_tris)[3],
521  int *r_orco_tris_num,
522  float (**r_orco_coords)[3]);
523 
530 
531 // void BKE_pbvh_node_BB_reset(PBVHNode *node);
532 // void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
533 
534 bool pbvh_has_mask(const PBVH *pbvh);
535 void pbvh_show_mask_set(PBVH *pbvh, bool show_mask);
536 
537 bool pbvh_has_face_sets(PBVH *pbvh);
538 void pbvh_show_face_sets_set(PBVH *pbvh, bool show_face_sets);
539 
540 /* Parallelization. */
541 
543  bool use_threading,
544  int totnode);
545 
546 struct MVert *BKE_pbvh_get_verts(const PBVH *pbvh);
547 const float (*BKE_pbvh_get_vert_normals(const PBVH *pbvh))[3];
548 
551 bool BKE_pbvh_get_color_layer(const struct Mesh *me,
552  CustomDataLayer **r_layer,
553  eAttrDomain *r_attr);
554 
555 /* Swaps colors at each element in indices (of domain pbvh->vcol_domain)
556  * with values in colors. */
557 void BKE_pbvh_swap_colors(PBVH *pbvh,
558  const int *indices,
559  const int indices_num,
560  float (*colors)[4]);
561 
562 /* Stores colors from the elements in indices (of domain pbvh->vcol_domain)
563  * into colors. */
564 void BKE_pbvh_store_colors(PBVH *pbvh,
565  const int *indices,
566  const int indices_num,
567  float (*colors)[4]);
568 
569 /* Like BKE_pbvh_store_colors but handles loop->vert conversion */
571  const int *indices,
572  const int indices_num,
573  float (*colors)[4]);
574 
575 bool BKE_pbvh_is_drawing(const PBVH *pbvh);
576 void BKE_pbvh_is_drawing_set(PBVH *pbvh, bool val);
577 
578 /* Do not call in PBVH_GRIDS mode */
579 void BKE_pbvh_node_num_loops(PBVH *pbvh, PBVHNode *node, int *r_totloop);
580 
581 void BKE_pbvh_update_active_vcol(PBVH *pbvh, const struct Mesh *mesh);
582 void BKE_pbvh_pmap_set(PBVH *pbvh, const struct MeshElemMap *pmap);
583 
584 void BKE_pbvh_vertex_color_set(PBVH *pbvh, int vertex, const float color[4]);
585 void BKE_pbvh_vertex_color_get(const PBVH *pbvh, int vertex, float r_color[4]);
586 
587 void BKE_pbvh_ensure_node_loops(PBVH *pbvh);
588 bool BKE_pbvh_draw_cache_invalid(const PBVH *pbvh);
589 
590 #ifdef __cplusplus
591 }
592 #endif
typedef float(TangentPoint)[2]
Generic geometry attributes built on CustomData.
eAttrDomain
Definition: BKE_attribute.h:25
struct CCGElem CCGElem
Definition: BKE_ccg.h:30
bool BKE_pbvh_node_fully_masked_get(PBVHNode *node)
Definition: pbvh.c:1945
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:608
int BKE_pbvh_get_grid_num_faces(const PBVH *pbvh)
Definition: pbvh.c:1855
void BKE_pbvh_node_free_proxies(PBVHNode *node)
Definition: pbvh.c:3037
void BKE_pbvh_set_frustum_planes(PBVH *pbvh, PBVHFrustumPlanes *planes)
Definition: pbvh.c:3195
void BKE_pbvh_node_mark_update(PBVHNode *node)
Definition: pbvh.c:1869
BLI_bitmap ** BKE_pbvh_get_grid_visibility(const PBVH *pbvh)
Definition: pbvh.c:1843
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:2116
void BKE_pbvh_sync_face_sets_to_grids(PBVH *pbvh)
Definition: pbvh.c:371
void BKE_pbvh_node_get_verts(PBVH *pbvh, PBVHNode *node, const int **r_vert_indices, struct MVert **r_verts)
Definition: pbvh.c:1989
void BKE_pbvh_node_fully_masked_set(PBVHNode *node, int fully_masked)
Definition: pbvh.c:1933
void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3])
Definition: pbvh.c:2090
void BKE_pbvh_is_drawing_set(PBVH *pbvh, bool val)
Definition: pbvh.c:3255
void BKE_pbvh_build_mesh(PBVH *pbvh, 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)
void BKE_pbvh_node_mark_update_visibility(PBVHNode *node)
Definition: pbvh.c:1895
struct CCGElem ** BKE_pbvh_get_grids(const PBVH *pbvh)
Definition: pbvh.c:1837
void BKE_pbvh_node_mark_update_color(PBVHNode *node)
Definition: pbvh.c:1880
void BKE_pbvh_get_frustum_planes(PBVH *pbvh, PBVHFrustumPlanes *planes)
Definition: pbvh.c:3203
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:2516
void BKE_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***r_array, int *r_tot)
Definition: pbvh.c:3050
void BKE_pbvh_update_active_vcol(PBVH *pbvh, const struct Mesh *mesh)
void BKE_pbvh_redraw_BB(PBVH *pbvh, float bb_min[3], float bb_max[3])
Definition: pbvh.c:1729
void BKE_pbvh_node_num_verts(PBVH *pbvh, PBVHNode *node, int *r_uniquevert, int *r_totvert)
Definition: pbvh.c:2003
bool BKE_pbvh_node_frustum_contain_AABB(PBVHNode *node, void *frustum)
Definition: pbvh.c:2793
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:2593
void BKE_pbvh_bmesh_node_save_orig(struct BMesh *bm, PBVHNode *node)
Definition: pbvh_bmesh.c:2020
void BKE_pbvh_node_fully_unmasked_set(PBVHNode *node, int fully_masked)
Definition: pbvh.c:1950
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:2920
void BKE_pbvh_pmap_set(PBVH *pbvh, const struct MeshElemMap *pmap)
void BKE_pbvh_swap_colors(PBVH *pbvh, const int *indices, const int indices_num, float(*colors)[4])
Definition: pbvh.cc:163
void BKE_pbvh_update_visibility(PBVH *pbvh)
Definition: pbvh.c:1711
void BKE_pbvh_store_colors_vertex(PBVH *pbvh, const int *indices, const int indices_num, float(*colors)[4])
Definition: pbvh.cc:193
void BKE_pbvh_get_grid_updates(PBVH *pbvh, bool clear, void ***r_gridfaces, int *r_totface)
Definition: pbvh.c:1751
void pbvh_show_mask_set(PBVH *pbvh, bool show_mask)
Definition: pbvh.c:3185
float(* BKE_pbvh_vert_coords_alloc(struct PBVH *pbvh))[3]
Definition: pbvh.c:2948
struct PBVHPixelsNode PBVHPixelsNode
void BKE_pbvh_free(PBVH *pbvh)
Definition: pbvh.c:663
bool BKE_pbvh_is_deformed(struct PBVH *pbvh)
Definition: pbvh.c:3010
void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3])
Definition: pbvh.c:2084
void BKE_pbvh_node_color_buffer_free(PBVH *pbvh)
Definition: pbvh.c:3088
PBVHType BKE_pbvh_type(const PBVH *pbvh)
Definition: pbvh.c:1798
void pbvh_show_face_sets_set(PBVH *pbvh, bool show_face_sets)
Definition: pbvh.c:3190
float BKE_pbvh_node_get_tmin(PBVHNode *node)
Definition: pbvh.c:949
bool BKE_pbvh_is_drawing(const PBVH *pbvh)
Definition: pbvh.c:3245
void BKE_pbvh_subdiv_cgg_set(PBVH *pbvh, struct SubdivCCG *subdiv_ccg)
Definition: pbvh.c:3231
void BKE_pbvh_store_colors(PBVH *pbvh, const int *indices, const int indices_num, float(*colors)[4])
Definition: pbvh.cc:179
void BKE_pbvh_mark_rebuild_pixels(PBVH *pbvh)
Definition: pbvh.c:1885
bool BKE_pbvh_node_frustum_exclude_AABB(PBVHNode *node, void *frustum)
Definition: pbvh.c:2803
bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh, PBVHTopologyUpdateMode mode, const float center[3], const float view_normal[3], float radius, bool use_frontface, bool use_projected)
Definition: pbvh_bmesh.c:1943
bool BKE_pbvh_node_has_vert_with_normal_update_tag(PBVH *pbvh, PBVHNode *node)
Definition: pbvh.c:2126
void(* BKE_pbvh_HitCallback)(PBVHNode *node, void *data)
Definition: BKE_pbvh.h:100
void BKE_pbvh_build_bmesh(PBVH *pbvh, struct BMesh *bm, bool smooth_shading, struct BMLog *log, int cd_vert_node_offset, int cd_face_node_offset)
Definition: pbvh_bmesh.c:1866
struct BMesh * BKE_pbvh_get_bmesh(PBVH *pbvh)
Definition: pbvh.c:1861
void BKE_pbvh_node_mark_rebuild_draw(PBVHNode *node)
Definition: pbvh.c:1901
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:2457
void BKE_pbvh_node_mark_normals_update(PBVHNode *node)
Definition: pbvh.c:1911
void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float(*vertCos)[3], int totvert)
Definition: pbvh.c:2966
void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default)
Definition: pbvh.c:2843
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:2169
void BKE_pbvh_node_get_loops(PBVH *pbvh, PBVHNode *node, const int **r_loop_indices, const struct MLoop **r_loops)
void BKE_pbvh_vert_tag_update_normal(PBVH *pbvh, int index)
Definition: pbvh.c:1967
const float(* BKE_pbvh_get_vert_normals(const PBVH *pbvh))[3]
Definition: pbvh.c:3225
int BKE_pbvh_get_grid_num_vertices(const PBVH *pbvh)
Definition: pbvh.c:1849
int BKE_pbvh_count_grid_quads(BLI_bitmap **grid_hidden, const int *grid_indices, int totgrid, int gridsize)
Definition: pbvh.c:339
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:1560
bool pbvh_has_mask(const PBVH *pbvh)
Definition: pbvh.c:3157
void BKE_pbvh_update_normals(PBVH *pbvh, struct SubdivCCG *subdiv_ccg)
Definition: pbvh.c:2813
PBVHTopologyUpdateMode
Definition: BKE_pbvh.h:278
@ PBVH_Collapse
Definition: BKE_pbvh.h:280
@ PBVH_Subdivide
Definition: BKE_pbvh.h:279
const struct CCGKey * BKE_pbvh_get_grid_key(const PBVH *pbvh)
Definition: pbvh.c:1831
struct GSet * BKE_pbvh_bmesh_node_other_verts(PBVHNode *node)
Definition: pbvh_bmesh.c:2108
void BKE_pbvh_build_pixels(PBVH *pbvh, struct Mesh *mesh, struct Image *image, struct ImageUser *image_user)
Definition: pbvh_pixels.cc:383
PBVHType
Definition: BKE_pbvh.h:233
@ PBVH_GRIDS
Definition: BKE_pbvh.h:235
@ PBVH_BMESH
Definition: BKE_pbvh.h:236
@ PBVH_FACES
Definition: BKE_pbvh.h:234
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:2717
struct GSet * BKE_pbvh_bmesh_node_faces(PBVHNode *node)
Definition: pbvh_bmesh.c:2113
void BKE_pbvh_ensure_node_loops(PBVH *pbvh)
Definition: pbvh.c:3280
struct PBVHFrustumPlanes PBVHFrustumPlanes
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, bool full_render)
PBVHProxyNode * BKE_pbvh_node_add_proxy(PBVH *pbvh, PBVHNode *node)
Definition: pbvh.c:3016
PBVH * BKE_pbvh_new(void)
Definition: pbvh.c:655
bool BKE_pbvh_has_faces(const PBVH *pbvh)
Definition: pbvh.c:1803
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:2037
void BKE_pbvh_vertex_color_set(PBVH *pbvh, int vertex, const float color[4])
Definition: pbvh.cc:155
bool BKE_pbvh_node_fully_hidden_get(PBVHNode *node)
Definition: pbvh.c:1928
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
Definition: pbvh.c:1916
void(* BKE_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin)
Definition: BKE_pbvh.h:101
void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings, bool use_threading, int totnode)
Definition: pbvh.c:3211
struct MVert * BKE_pbvh_get_verts(const PBVH *pbvh)
Definition: pbvh.c:3219
void BKE_pbvh_node_num_loops(PBVH *pbvh, PBVHNode *node, int *r_totloop)
Definition: pbvh.c:3260
PBVHColorBufferNode * BKE_pbvh_node_color_buffer_get(PBVHNode *node)
Definition: pbvh.c:3079
struct GSet * BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node)
Definition: pbvh_bmesh.c:2103
void BKE_pbvh_update_vertex_data(PBVH *pbvh, int flags)
Definition: pbvh.c:1567
void BKE_pbvh_bmesh_after_stroke(PBVH *pbvh)
Definition: pbvh_bmesh.c:2077
void BKE_pbvh_vertex_color_get(const PBVH *pbvh, int vertex, float r_color[4])
Definition: pbvh.cc:147
void BKE_pbvh_respect_hide_set(PBVH *pbvh, bool respect_hide)
Definition: pbvh.c:3241
void BKE_pbvh_node_mark_update_mask(PBVHNode *node)
Definition: pbvh.c:1875
bool BKE_pbvh_node_fully_unmasked_get(PBVHNode *node)
Definition: pbvh.c:1962
void BKE_pbvh_update_bounds(PBVH *pbvh, int flags)
Definition: pbvh.c:1545
void BKE_pbvh_bounding_box(const PBVH *pbvh, float min[3], float max[3])
Definition: pbvh.c:1812
void BKE_pbvh_search_callback(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, BKE_pbvh_HitCallback hcb, void *hit_data)
Definition: pbvh.c:871
bool BKE_pbvh_draw_cache_invalid(const PBVH *pbvh)
Definition: pbvh.c:3250
void BKE_pbvh_node_mark_redraw(PBVHNode *node)
Definition: pbvh.c:1906
void(* BKE_pbvh_SearchNearestCallback)(PBVHNode *node, void *data, float *tmin)
Definition: BKE_pbvh.h:103
void BKE_pbvh_grids_update(PBVH *pbvh, struct CCGElem **grids, void **gridfaces, struct DMFlagMat *flagmats, unsigned int **grid_hidden)
Definition: pbvh.c:2932
unsigned int ** BKE_pbvh_grid_hidden(const PBVH *pbvh)
Definition: pbvh.c:1825
struct PBVHVertexIter PBVHVertexIter
void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int mode)
Definition: pbvh.c:3099
void BKE_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size)
Definition: pbvh_bmesh.c:2092
void BKE_pbvh_face_sets_set(PBVH *pbvh, int *face_sets)
Definition: pbvh.c:3236
void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count)
Definition: pbvh.c:2096
void BKE_pbvh_node_mark_topology_update(PBVHNode *node)
Definition: pbvh_bmesh.c:2098
void BKE_pbvh_search_gather(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot)
Definition: pbvh.c:838
PBVHNodeFlags
Definition: BKE_pbvh.h:63
@ PBVH_RebuildPixels
Definition: BKE_pbvh.h:81
@ 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_get_color_layer(const struct Mesh *me, CustomDataLayer **r_layer, eAttrDomain *r_attr)
bool(* BKE_pbvh_SearchCallback)(PBVHNode *node, void *data)
Definition: BKE_pbvh.h:98
bool pbvh_has_face_sets(PBVH *pbvh)
Definition: pbvh.c:3171
unsigned int BLI_bitmap
Definition: BLI_bitmap.h:16
struct GSet GSet
Definition: BLI_ghash.h:340
NSNotificationCenter * center
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
ATTR_WARN_UNUSED_RESULT BMesh * bm
static unsigned long seed
Definition: btSoftBody.h:39
OperationNode * node
void * user_data
SyclQueue void void size_t num_bytes void
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
static float verts[][3]
ccl_gpu_kernel_postfix int ccl_global int * indices
ccl_device_inline float3 log(float3 v)
Definition: math_float3.h:397
static void clear(Message *msg)
Definition: msgfmt.c:278
#define min(a, b)
Definition: sort.c:35
Definition: BKE_ccg.h:32
float(* planes)[4]
Definition: BKE_pbvh.h:86
void * node_data
Definition: BKE_pbvh.h:60
struct MVert * mvert
Definition: BKE_pbvh.h:428
int * grid_indices
Definition: BKE_pbvh.h:409
bool respect_hide
Definition: BKE_pbvh.h:402
struct CCGKey key
Definition: BKE_pbvh.h:405
float * co
Definition: BKE_pbvh.h:430
int cd_vert_mask_offset
Definition: BKE_pbvh.h:424
float * fno
Definition: BKE_pbvh.h:432
float * no
Definition: BKE_pbvh.h:431
BLI_bitmap ** grid_hidden
Definition: BKE_pbvh.h:408
struct GSetIterator bm_other_verts
Definition: BKE_pbvh.h:422
struct GSetIterator bm_unique_verts
Definition: BKE_pbvh.h:421
BLI_bitmap * gh
Definition: BKE_pbvh.h:408
struct BMVert * bm_vert
Definition: BKE_pbvh.h:429
float * vmask
Definition: BKE_pbvh.h:418
struct CCGElem ** grids
Definition: BKE_pbvh.h:406
struct CCGElem * grid
Definition: BKE_pbvh.h:407
float(* vert_normals)[3]
Definition: BKE_pbvh.h:415
float * mask
Definition: BKE_pbvh.h:433
const int * vert_indices
Definition: BKE_pbvh.h:417
struct CustomData * bm_vdata
Definition: BKE_pbvh.h:423
struct MVert * mverts
Definition: BKE_pbvh.h:414
float max