Code cleanup: rename BLI_pbvh to BKE_pbvh
This commit is contained in:
@@ -18,8 +18,8 @@
|
|||||||
* ***** END GPL LICENSE BLOCK *****
|
* ***** END GPL LICENSE BLOCK *****
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BLI_PBVH_H__
|
#ifndef __BKE_PBVH_H__
|
||||||
#define __BLI_PBVH_H__
|
#define __BKE_PBVH_H__
|
||||||
|
|
||||||
/** \file BKE_pbvh.h
|
/** \file BKE_pbvh.h
|
||||||
* \ingroup bke
|
* \ingroup bke
|
||||||
@@ -54,35 +54,35 @@ typedef struct {
|
|||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
|
|
||||||
/* returns 1 if the search should continue from this node, 0 otherwise */
|
/* returns 1 if the search should continue from this node, 0 otherwise */
|
||||||
typedef int (*BLI_pbvh_SearchCallback)(PBVHNode *node, void *data);
|
typedef int (*BKE_pbvh_SearchCallback)(PBVHNode *node, void *data);
|
||||||
|
|
||||||
typedef void (*BLI_pbvh_HitCallback)(PBVHNode *node, void *data);
|
typedef void (*BKE_pbvh_HitCallback)(PBVHNode *node, void *data);
|
||||||
typedef void (*BLI_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin);
|
typedef void (*BKE_pbvh_HitOccludedCallback)(PBVHNode *node, void *data, float *tmin);
|
||||||
|
|
||||||
/* Building */
|
/* Building */
|
||||||
|
|
||||||
PBVH *BLI_pbvh_new(void);
|
PBVH *BKE_pbvh_new(void);
|
||||||
void BLI_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts,
|
void BKE_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts,
|
||||||
int totface, int totvert, struct CustomData *vdata);
|
int totface, int totvert, struct CustomData *vdata);
|
||||||
void BLI_pbvh_build_grids(PBVH *bvh, struct CCGElem **grid_elems,
|
void BKE_pbvh_build_grids(PBVH *bvh, struct CCGElem **grid_elems,
|
||||||
struct DMGridAdjacency *gridadj, int totgrid,
|
struct DMGridAdjacency *gridadj, int totgrid,
|
||||||
struct CCGKey *key, void **gridfaces, struct DMFlagMat *flagmats,
|
struct CCGKey *key, void **gridfaces, struct DMFlagMat *flagmats,
|
||||||
unsigned int **grid_hidden);
|
unsigned int **grid_hidden);
|
||||||
void BLI_pbvh_build_bmesh(PBVH *bvh, struct BMesh *bm, int smooth_shading,
|
void BKE_pbvh_build_bmesh(PBVH *bvh, struct BMesh *bm, int smooth_shading,
|
||||||
struct BMLog *log);
|
struct BMLog *log);
|
||||||
|
|
||||||
void BLI_pbvh_free(PBVH *bvh);
|
void BKE_pbvh_free(PBVH *bvh);
|
||||||
|
|
||||||
/* Hierarchical Search in the BVH, two methods:
|
/* Hierarchical Search in the BVH, two methods:
|
||||||
* - for each hit calling a callback
|
* - for each hit calling a callback
|
||||||
* - gather nodes in an array (easy to multithread) */
|
* - gather nodes in an array (easy to multithread) */
|
||||||
|
|
||||||
void BLI_pbvh_search_callback(PBVH *bvh,
|
void BKE_pbvh_search_callback(PBVH *bvh,
|
||||||
BLI_pbvh_SearchCallback scb, void *search_data,
|
BKE_pbvh_SearchCallback scb, void *search_data,
|
||||||
BLI_pbvh_HitCallback hcb, void *hit_data);
|
BKE_pbvh_HitCallback hcb, void *hit_data);
|
||||||
|
|
||||||
void BLI_pbvh_search_gather(PBVH *bvh,
|
void BKE_pbvh_search_gather(PBVH *bvh,
|
||||||
BLI_pbvh_SearchCallback scb, void *search_data,
|
BKE_pbvh_SearchCallback scb, void *search_data,
|
||||||
PBVHNode ***array, int *tot);
|
PBVHNode ***array, int *tot);
|
||||||
|
|
||||||
/* Raycast
|
/* Raycast
|
||||||
@@ -90,18 +90,18 @@ void BLI_pbvh_search_gather(PBVH *bvh,
|
|||||||
* it's up to the callback to find the primitive within the leaves that is
|
* it's up to the callback to find the primitive within the leaves that is
|
||||||
* hit first */
|
* hit first */
|
||||||
|
|
||||||
void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data,
|
void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
|
||||||
const float ray_start[3], const float ray_normal[3],
|
const float ray_start[3], const float ray_normal[3],
|
||||||
int original);
|
int original);
|
||||||
|
|
||||||
int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco,
|
int BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco,
|
||||||
const float ray_start[3], const float ray_normal[3],
|
const float ray_start[3], const float ray_normal[3],
|
||||||
float *dist);
|
float *dist);
|
||||||
|
|
||||||
/* Drawing */
|
/* Drawing */
|
||||||
|
|
||||||
void BLI_pbvh_node_draw(PBVHNode *node, void *data);
|
void BKE_pbvh_node_draw(PBVHNode *node, void *data);
|
||||||
void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
|
void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
|
||||||
int (*setMaterial)(int, void *attribs), int wireframe);
|
int (*setMaterial)(int, void *attribs), int wireframe);
|
||||||
|
|
||||||
/* PBVH Access */
|
/* PBVH Access */
|
||||||
@@ -111,23 +111,23 @@ typedef enum {
|
|||||||
PBVH_BMESH
|
PBVH_BMESH
|
||||||
} PBVHType;
|
} PBVHType;
|
||||||
|
|
||||||
PBVHType BLI_pbvh_type(const PBVH *bvh);
|
PBVHType BKE_pbvh_type(const PBVH *bvh);
|
||||||
|
|
||||||
/* multires hidden data, only valid for type == PBVH_GRIDS */
|
/* multires hidden data, only valid for type == PBVH_GRIDS */
|
||||||
unsigned int **BLI_pbvh_grid_hidden(const PBVH *bvh);
|
unsigned int **BKE_pbvh_grid_hidden(const PBVH *bvh);
|
||||||
|
|
||||||
/* multires level, only valid for type == PBVH_GRIDS */
|
/* multires level, only valid for type == PBVH_GRIDS */
|
||||||
void BLI_pbvh_get_grid_key(const PBVH *pbvh, struct CCGKey *key);
|
void BKE_pbvh_get_grid_key(const PBVH *pbvh, struct CCGKey *key);
|
||||||
|
|
||||||
/* Only valid for type == PBVH_BMESH */
|
/* Only valid for type == PBVH_BMESH */
|
||||||
BMesh *BLI_pbvh_get_bmesh(PBVH *pbvh);
|
BMesh *BKE_pbvh_get_bmesh(PBVH *pbvh);
|
||||||
void BLI_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size);
|
void BKE_pbvh_bmesh_detail_size_set(PBVH *pbvh, float detail_size);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PBVH_Subdivide = 1,
|
PBVH_Subdivide = 1,
|
||||||
PBVH_Collapse = 2,
|
PBVH_Collapse = 2,
|
||||||
} PBVHTopologyUpdateMode;
|
} PBVHTopologyUpdateMode;
|
||||||
int BLI_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode,
|
int BKE_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode,
|
||||||
const float center[3], float radius);
|
const float center[3], float radius);
|
||||||
|
|
||||||
/* Node Access */
|
/* Node Access */
|
||||||
@@ -147,55 +147,55 @@ typedef enum {
|
|||||||
PBVH_UpdateTopology = 256,
|
PBVH_UpdateTopology = 256,
|
||||||
} PBVHNodeFlags;
|
} PBVHNodeFlags;
|
||||||
|
|
||||||
void BLI_pbvh_node_mark_update(PBVHNode *node);
|
void BKE_pbvh_node_mark_update(PBVHNode *node);
|
||||||
void BLI_pbvh_node_mark_rebuild_draw(PBVHNode *node);
|
void BKE_pbvh_node_mark_rebuild_draw(PBVHNode *node);
|
||||||
void BLI_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden);
|
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden);
|
||||||
void BLI_pbvh_node_mark_topology_update(PBVHNode *node);
|
void BKE_pbvh_node_mark_topology_update(PBVHNode *node);
|
||||||
|
|
||||||
void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node,
|
void BKE_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node,
|
||||||
int **grid_indices, int *totgrid, int *maxgrid, int *gridsize,
|
int **grid_indices, int *totgrid, int *maxgrid, int *gridsize,
|
||||||
struct CCGElem ***grid_elems, struct DMGridAdjacency **gridadj);
|
struct CCGElem ***grid_elems, struct DMGridAdjacency **gridadj);
|
||||||
void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node,
|
void BKE_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node,
|
||||||
int *uniquevert, int *totvert);
|
int *uniquevert, int *totvert);
|
||||||
void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node,
|
void BKE_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node,
|
||||||
int **vert_indices, struct MVert **verts);
|
int **vert_indices, struct MVert **verts);
|
||||||
|
|
||||||
void BLI_pbvh_node_get_BB(PBVHNode * node, float bb_min[3], float bb_max[3]);
|
void BKE_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]);
|
void BKE_pbvh_node_get_original_BB(PBVHNode * node, float bb_min[3], float bb_max[3]);
|
||||||
|
|
||||||
float BLI_pbvh_node_get_tmin(PBVHNode *node);
|
float BKE_pbvh_node_get_tmin(PBVHNode *node);
|
||||||
|
|
||||||
/* test if AABB is at least partially inside the planes' volume */
|
/* test if AABB is at least partially inside the planes' volume */
|
||||||
int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data);
|
int BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data);
|
||||||
/* test if AABB is at least partially outside the planes' volume */
|
/* test if AABB is at least partially outside the planes' volume */
|
||||||
int BLI_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data);
|
int BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data);
|
||||||
|
|
||||||
struct GHash *BLI_pbvh_bmesh_node_unique_verts(PBVHNode *node);
|
struct GHash *BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node);
|
||||||
struct GHash *BLI_pbvh_bmesh_node_other_verts(PBVHNode *node);
|
struct GHash *BKE_pbvh_bmesh_node_other_verts(PBVHNode *node);
|
||||||
void BLI_pbvh_bmesh_node_save_orig(PBVHNode *node);
|
void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node);
|
||||||
void BLI_pbvh_bmesh_after_stroke(PBVH *bvh);
|
void BKE_pbvh_bmesh_after_stroke(PBVH *bvh);
|
||||||
|
|
||||||
/* Update Normals/Bounding Box/Draw Buffers/Redraw and clear flags */
|
/* Update Normals/Bounding Box/Draw Buffers/Redraw and clear flags */
|
||||||
|
|
||||||
void BLI_pbvh_update(PBVH *bvh, int flags, float (*face_nors)[3]);
|
void BKE_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 BKE_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 BKE_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface);
|
||||||
void BLI_pbvh_grids_update(PBVH *bvh, struct CCGElem **grid_elems,
|
void BKE_pbvh_grids_update(PBVH *bvh, struct CCGElem **grid_elems,
|
||||||
struct DMGridAdjacency *gridadj, void **gridfaces,
|
struct DMGridAdjacency *gridadj, void **gridfaces,
|
||||||
struct DMFlagMat *flagmats, unsigned int **grid_hidden);
|
struct DMFlagMat *flagmats, unsigned int **grid_hidden);
|
||||||
|
|
||||||
/* Layer displacement */
|
/* Layer displacement */
|
||||||
|
|
||||||
/* Get the node's displacement layer, creating it if necessary */
|
/* Get the node's displacement layer, creating it if necessary */
|
||||||
float *BLI_pbvh_node_layer_disp_get(PBVH *pbvh, PBVHNode *node);
|
float *BKE_pbvh_node_layer_disp_get(PBVH *pbvh, PBVHNode *node);
|
||||||
|
|
||||||
/* If the node has a displacement layer, free it and set to null */
|
/* If the node has a displacement layer, free it and set to null */
|
||||||
void BLI_pbvh_node_layer_disp_free(PBVHNode *node);
|
void BKE_pbvh_node_layer_disp_free(PBVHNode *node);
|
||||||
|
|
||||||
/* vertex deformer */
|
/* vertex deformer */
|
||||||
float (*BLI_pbvh_get_vertCos(struct PBVH *pbvh))[3];
|
float (*BKE_pbvh_get_vertCos(struct PBVH *pbvh))[3];
|
||||||
void BLI_pbvh_apply_vertCos(struct PBVH *pbvh, float (*vertCos)[3]);
|
void BKE_pbvh_apply_vertCos(struct PBVH *pbvh, float (*vertCos)[3]);
|
||||||
int BLI_pbvh_isDeformed(struct PBVH *pbvh);
|
int BKE_pbvh_isDeformed(struct PBVH *pbvh);
|
||||||
|
|
||||||
/* Vertex Iterator */
|
/* Vertex Iterator */
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ typedef struct PBVHVertexIter {
|
|||||||
void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
|
void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
|
||||||
PBVHVertexIter *vi, int mode);
|
PBVHVertexIter *vi, int mode);
|
||||||
|
|
||||||
#define BLI_pbvh_vertex_iter_begin(bvh, node, vi, mode) \
|
#define BKE_pbvh_vertex_iter_begin(bvh, node, vi, mode) \
|
||||||
pbvh_vertex_iter_init(bvh, node, &vi, mode); \
|
pbvh_vertex_iter_init(bvh, node, &vi, mode); \
|
||||||
\
|
\
|
||||||
for (vi.i = 0, vi.g = 0; vi.g < vi.totgrid; vi.g++) { \
|
for (vi.i = 0, vi.g = 0; vi.g < vi.totgrid; vi.g++) { \
|
||||||
@@ -310,20 +310,20 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
|
|||||||
CD_PAINT_MASK); \
|
CD_PAINT_MASK); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BLI_pbvh_vertex_iter_end \
|
#define BKE_pbvh_vertex_iter_end \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count);
|
void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count);
|
||||||
void BLI_pbvh_node_free_proxies(PBVHNode *node);
|
void BKE_pbvh_node_free_proxies(PBVHNode *node);
|
||||||
PBVHProxyNode *BLI_pbvh_node_add_proxy(PBVH *bvh, PBVHNode *node);
|
PBVHProxyNode *BKE_pbvh_node_add_proxy(PBVH *bvh, PBVHNode *node);
|
||||||
void BLI_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***nodes, int *totnode);
|
void BKE_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***nodes, int *totnode);
|
||||||
|
|
||||||
//void BLI_pbvh_node_BB_reset(PBVHNode *node);
|
//void BKE_pbvh_node_BB_reset(PBVHNode *node);
|
||||||
//void BLI_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
|
//void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
|
||||||
|
|
||||||
void pbvh_show_diffuse_color_set(PBVH *bvh, int show_diffuse_color);
|
void pbvh_show_diffuse_color_set(PBVH *bvh, int show_diffuse_color);
|
||||||
|
|
||||||
#endif /* __BLI_PBVH_H__ */
|
#endif /* __BKE_PBVH_H__ */
|
||||||
|
|
||||||
|
|||||||
@@ -264,10 +264,10 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
|
|||||||
|
|
||||||
/* Sculpting on a BMesh (dynamic-topology) gets a special PBVH */
|
/* Sculpting on a BMesh (dynamic-topology) gets a special PBVH */
|
||||||
if (!cddm->pbvh && ob->sculpt->bm) {
|
if (!cddm->pbvh && ob->sculpt->bm) {
|
||||||
cddm->pbvh = BLI_pbvh_new();
|
cddm->pbvh = BKE_pbvh_new();
|
||||||
cddm->pbvh_draw = TRUE;
|
cddm->pbvh_draw = TRUE;
|
||||||
|
|
||||||
BLI_pbvh_build_bmesh(cddm->pbvh, ob->sculpt->bm,
|
BKE_pbvh_build_bmesh(cddm->pbvh, ob->sculpt->bm,
|
||||||
ob->sculpt->bm_smooth_shading,
|
ob->sculpt->bm_smooth_shading,
|
||||||
ob->sculpt->bm_log);
|
ob->sculpt->bm_log);
|
||||||
}
|
}
|
||||||
@@ -281,14 +281,14 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
|
|||||||
Mesh *me = ob->data;
|
Mesh *me = ob->data;
|
||||||
int deformed = 0;
|
int deformed = 0;
|
||||||
|
|
||||||
cddm->pbvh = BLI_pbvh_new();
|
cddm->pbvh = BKE_pbvh_new();
|
||||||
cddm->pbvh_draw = can_pbvh_draw(ob, dm);
|
cddm->pbvh_draw = can_pbvh_draw(ob, dm);
|
||||||
|
|
||||||
pbvh_show_diffuse_color_set(cddm->pbvh, ob->sculpt->show_diffuse_color);
|
pbvh_show_diffuse_color_set(cddm->pbvh, ob->sculpt->show_diffuse_color);
|
||||||
|
|
||||||
BKE_mesh_tessface_ensure(me);
|
BKE_mesh_tessface_ensure(me);
|
||||||
|
|
||||||
BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
|
BKE_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
|
||||||
me->totface, me->totvert, &me->vdata);
|
me->totface, me->totvert, &me->vdata);
|
||||||
|
|
||||||
deformed = ss->modifiers_active || me->key;
|
deformed = ss->modifiers_active || me->key;
|
||||||
@@ -301,7 +301,7 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
|
|||||||
totvert = deformdm->getNumVerts(deformdm);
|
totvert = deformdm->getNumVerts(deformdm);
|
||||||
vertCos = MEM_callocN(3 * totvert * sizeof(float), "cdDM_getPBVH vertCos");
|
vertCos = MEM_callocN(3 * totvert * sizeof(float), "cdDM_getPBVH vertCos");
|
||||||
deformdm->getVertCos(deformdm, vertCos);
|
deformdm->getVertCos(deformdm, vertCos);
|
||||||
BLI_pbvh_apply_vertCos(cddm->pbvh, vertCos);
|
BKE_pbvh_apply_vertCos(cddm->pbvh, vertCos);
|
||||||
MEM_freeN(vertCos);
|
MEM_freeN(vertCos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,7 +321,7 @@ static void cdDM_update_normals_from_pbvh(DerivedMesh *dm)
|
|||||||
|
|
||||||
face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
|
face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
|
||||||
|
|
||||||
BLI_pbvh_update(cddm->pbvh, PBVH_UpdateNormals, face_nors);
|
BKE_pbvh_update(cddm->pbvh, PBVH_UpdateNormals, face_nors);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cdDM_drawVerts(DerivedMesh *dm)
|
static void cdDM_drawVerts(DerivedMesh *dm)
|
||||||
@@ -427,9 +427,9 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (cddm->pbvh && cddm->pbvh_draw &&
|
if (cddm->pbvh && cddm->pbvh_draw &&
|
||||||
BLI_pbvh_type(cddm->pbvh) == PBVH_BMESH)
|
BKE_pbvh_type(cddm->pbvh) == PBVH_BMESH)
|
||||||
{
|
{
|
||||||
BLI_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, TRUE);
|
BKE_pbvh_draw(cddm->pbvh, NULL, NULL, NULL, TRUE);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -549,7 +549,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
|
|||||||
if (dm->numTessFaceData) {
|
if (dm->numTessFaceData) {
|
||||||
float (*face_nors)[3] = CustomData_get_layer(&dm->faceData, CD_NORMAL);
|
float (*face_nors)[3] = CustomData_get_layer(&dm->faceData, CD_NORMAL);
|
||||||
|
|
||||||
BLI_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors,
|
BKE_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors,
|
||||||
setMaterial, FALSE);
|
setMaterial, FALSE);
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ void multires_force_update(Object *ob)
|
|||||||
ob->derivedFinal = NULL;
|
ob->derivedFinal = NULL;
|
||||||
}
|
}
|
||||||
if (ob->sculpt && ob->sculpt->pbvh) {
|
if (ob->sculpt && ob->sculpt->pbvh) {
|
||||||
BLI_pbvh_free(ob->sculpt->pbvh);
|
BKE_pbvh_free(ob->sculpt->pbvh);
|
||||||
ob->sculpt->pbvh = NULL;
|
ob->sculpt->pbvh = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1407,7 +1407,7 @@ void multires_stitch_grids(Object *ob)
|
|||||||
int totface;
|
int totface;
|
||||||
|
|
||||||
if (ccgdm->pbvh) {
|
if (ccgdm->pbvh) {
|
||||||
BLI_pbvh_get_grid_updates(ccgdm->pbvh, 0, (void ***)&faces, &totface);
|
BKE_pbvh_get_grid_updates(ccgdm->pbvh, 0, (void ***)&faces, &totface);
|
||||||
|
|
||||||
if (totface) {
|
if (totface) {
|
||||||
ccgSubSurf_stitchFaces(ccgdm->ss, 0, faces, totface);
|
ccgSubSurf_stitchFaces(ccgdm->ss, 0, faces, totface);
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ void free_sculptsession(Object *ob)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ss->pbvh)
|
if (ss->pbvh)
|
||||||
BLI_pbvh_free(ss->pbvh);
|
BKE_pbvh_free(ss->pbvh);
|
||||||
if (ss->bm_log)
|
if (ss->bm_log)
|
||||||
BM_log_free(ss->bm_log);
|
BM_log_free(ss->bm_log);
|
||||||
|
|
||||||
@@ -2815,7 +2815,7 @@ void BKE_object_sculpt_modifiers_changed(Object *ob)
|
|||||||
* changing PVBH node organization, we hope topology does not change in
|
* changing PVBH node organization, we hope topology does not change in
|
||||||
* the meantime .. weak */
|
* the meantime .. weak */
|
||||||
if (ss->pbvh) {
|
if (ss->pbvh) {
|
||||||
BLI_pbvh_free(ss->pbvh);
|
BKE_pbvh_free(ss->pbvh);
|
||||||
ss->pbvh = NULL;
|
ss->pbvh = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2825,10 +2825,10 @@ void BKE_object_sculpt_modifiers_changed(Object *ob)
|
|||||||
PBVHNode **nodes;
|
PBVHNode **nodes;
|
||||||
int n, totnode;
|
int n, totnode;
|
||||||
|
|
||||||
BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
|
BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
|
||||||
|
|
||||||
for (n = 0; n < totnode; n++)
|
for (n = 0; n < totnode; n++)
|
||||||
BLI_pbvh_node_mark_update(nodes[n]);
|
BKE_pbvh_node_mark_update(nodes[n]);
|
||||||
|
|
||||||
MEM_freeN(nodes);
|
MEM_freeN(nodes);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ typedef struct PBVHStack {
|
|||||||
|
|
||||||
typedef struct PBVHIter {
|
typedef struct PBVHIter {
|
||||||
PBVH *bvh;
|
PBVH *bvh;
|
||||||
BLI_pbvh_SearchCallback scb;
|
BKE_pbvh_SearchCallback scb;
|
||||||
void *search_data;
|
void *search_data;
|
||||||
|
|
||||||
PBVHStack *stack;
|
PBVHStack *stack;
|
||||||
@@ -132,11 +132,11 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node)
|
|||||||
if (node->flag & PBVH_Leaf) {
|
if (node->flag & PBVH_Leaf) {
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(bvh, node, vd, PBVH_ITER_ALL)
|
BKE_pbvh_vertex_iter_begin(bvh, node, vd, PBVH_ITER_ALL)
|
||||||
{
|
{
|
||||||
BB_expand(&vb, vd.co);
|
BB_expand(&vb, vd.co);
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BB_expand_with_bb(&vb,
|
BB_expand_with_bb(&vb,
|
||||||
@@ -148,12 +148,12 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node)
|
|||||||
node->vb = vb;
|
node->vb = vb;
|
||||||
}
|
}
|
||||||
|
|
||||||
//void BLI_pbvh_node_BB_reset(PBVHNode *node)
|
//void BKE_pbvh_node_BB_reset(PBVHNode *node)
|
||||||
//{
|
//{
|
||||||
// BB_reset(&node->vb);
|
// BB_reset(&node->vb);
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//void BLI_pbvh_node_BB_expand(PBVHNode *node, float co[3])
|
//void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3])
|
||||||
//{
|
//{
|
||||||
// BB_expand(&node->vb, co);
|
// BB_expand(&node->vb, co);
|
||||||
//}
|
//}
|
||||||
@@ -493,7 +493,7 @@ static void pbvh_build(PBVH *bvh, BB *cb, BBC *prim_bbc, int totprim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do a full rebuild with on Mesh data structure */
|
/* Do a full rebuild with on Mesh data structure */
|
||||||
void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int totvert, struct CustomData *vdata)
|
void BKE_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int totvert, struct CustomData *vdata)
|
||||||
{
|
{
|
||||||
BBC *prim_bbc = NULL;
|
BBC *prim_bbc = NULL;
|
||||||
BB cb;
|
BB cb;
|
||||||
@@ -535,7 +535,7 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Do a full rebuild with on Grids data structure */
|
/* Do a full rebuild with on Grids data structure */
|
||||||
void BLI_pbvh_build_grids(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj,
|
void BKE_pbvh_build_grids(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj,
|
||||||
int totgrid, CCGKey *key, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
|
int totgrid, CCGKey *key, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
|
||||||
{
|
{
|
||||||
BBC *prim_bbc = NULL;
|
BBC *prim_bbc = NULL;
|
||||||
@@ -578,14 +578,14 @@ void BLI_pbvh_build_grids(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj,
|
|||||||
MEM_freeN(prim_bbc);
|
MEM_freeN(prim_bbc);
|
||||||
}
|
}
|
||||||
|
|
||||||
PBVH *BLI_pbvh_new(void)
|
PBVH *BKE_pbvh_new(void)
|
||||||
{
|
{
|
||||||
PBVH *bvh = MEM_callocN(sizeof(PBVH), "pbvh");
|
PBVH *bvh = MEM_callocN(sizeof(PBVH), "pbvh");
|
||||||
|
|
||||||
return bvh;
|
return bvh;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_free(PBVH *bvh)
|
void BKE_pbvh_free(PBVH *bvh)
|
||||||
{
|
{
|
||||||
PBVHNode *node;
|
PBVHNode *node;
|
||||||
int i;
|
int i;
|
||||||
@@ -600,7 +600,7 @@ void BLI_pbvh_free(PBVH *bvh)
|
|||||||
MEM_freeN(node->vert_indices);
|
MEM_freeN(node->vert_indices);
|
||||||
if (node->face_vert_indices)
|
if (node->face_vert_indices)
|
||||||
MEM_freeN(node->face_vert_indices);
|
MEM_freeN(node->face_vert_indices);
|
||||||
BLI_pbvh_node_layer_disp_free(node);
|
BKE_pbvh_node_layer_disp_free(node);
|
||||||
|
|
||||||
if (node->bm_faces)
|
if (node->bm_faces)
|
||||||
BLI_ghash_free(node->bm_faces, NULL, NULL);
|
BLI_ghash_free(node->bm_faces, NULL, NULL);
|
||||||
@@ -635,7 +635,7 @@ void BLI_pbvh_free(PBVH *bvh)
|
|||||||
MEM_freeN(bvh);
|
MEM_freeN(bvh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pbvh_iter_begin(PBVHIter *iter, PBVH *bvh, BLI_pbvh_SearchCallback scb, void *search_data)
|
static void pbvh_iter_begin(PBVHIter *iter, PBVH *bvh, BKE_pbvh_SearchCallback scb, void *search_data)
|
||||||
{
|
{
|
||||||
iter->bvh = bvh;
|
iter->bvh = bvh;
|
||||||
iter->scb = scb;
|
iter->scb = scb;
|
||||||
@@ -746,8 +746,8 @@ static PBVHNode *pbvh_iter_next_occluded(PBVHIter *iter)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_search_gather(PBVH *bvh,
|
void BKE_pbvh_search_gather(PBVH *bvh,
|
||||||
BLI_pbvh_SearchCallback scb, void *search_data,
|
BKE_pbvh_SearchCallback scb, void *search_data,
|
||||||
PBVHNode ***r_array, int *r_tot)
|
PBVHNode ***r_array, int *r_tot)
|
||||||
{
|
{
|
||||||
PBVHIter iter;
|
PBVHIter iter;
|
||||||
@@ -787,9 +787,9 @@ void BLI_pbvh_search_gather(PBVH *bvh,
|
|||||||
*r_tot = tot;
|
*r_tot = tot;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_search_callback(PBVH *bvh,
|
void BKE_pbvh_search_callback(PBVH *bvh,
|
||||||
BLI_pbvh_SearchCallback scb, void *search_data,
|
BKE_pbvh_SearchCallback scb, void *search_data,
|
||||||
BLI_pbvh_HitCallback hcb, void *hit_data)
|
BKE_pbvh_HitCallback hcb, void *hit_data)
|
||||||
{
|
{
|
||||||
PBVHIter iter;
|
PBVHIter iter;
|
||||||
PBVHNode *node;
|
PBVHNode *node;
|
||||||
@@ -830,7 +830,7 @@ static void node_tree_insert(node_tree *tree, node_tree *new_node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void traverse_tree(node_tree *tree, BLI_pbvh_HitOccludedCallback hcb, void *hit_data, float *tmin)
|
static void traverse_tree(node_tree *tree, BKE_pbvh_HitOccludedCallback hcb, void *hit_data, float *tmin)
|
||||||
{
|
{
|
||||||
if (tree->left) traverse_tree(tree->left, hcb, hit_data, tmin);
|
if (tree->left) traverse_tree(tree->left, hcb, hit_data, tmin);
|
||||||
|
|
||||||
@@ -854,14 +854,14 @@ static void free_tree(node_tree *tree)
|
|||||||
free(tree);
|
free(tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BLI_pbvh_node_get_tmin(PBVHNode *node)
|
float BKE_pbvh_node_get_tmin(PBVHNode *node)
|
||||||
{
|
{
|
||||||
return node->tmin;
|
return node->tmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BLI_pbvh_search_callback_occluded(PBVH *bvh,
|
static void BKE_pbvh_search_callback_occluded(PBVH *bvh,
|
||||||
BLI_pbvh_SearchCallback scb, void *search_data,
|
BKE_pbvh_SearchCallback scb, void *search_data,
|
||||||
BLI_pbvh_HitOccludedCallback hcb, void *hit_data)
|
BKE_pbvh_HitOccludedCallback hcb, void *hit_data)
|
||||||
{
|
{
|
||||||
PBVHIter iter;
|
PBVHIter iter;
|
||||||
PBVHNode *node;
|
PBVHNode *node;
|
||||||
@@ -1134,7 +1134,7 @@ static int pbvh_flush_bb(PBVH *bvh, PBVHNode *node, int flag)
|
|||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_update(PBVH *bvh, int flag, float (*face_nors)[3])
|
void BKE_pbvh_update(PBVH *bvh, int flag, float (*face_nors)[3])
|
||||||
{
|
{
|
||||||
PBVHNode **nodes;
|
PBVHNode **nodes;
|
||||||
int totnode;
|
int totnode;
|
||||||
@@ -1142,7 +1142,7 @@ void BLI_pbvh_update(PBVH *bvh, int flag, float (*face_nors)[3])
|
|||||||
if (!bvh->nodes)
|
if (!bvh->nodes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BLI_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag),
|
BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag),
|
||||||
&nodes, &totnode);
|
&nodes, &totnode);
|
||||||
|
|
||||||
if (flag & PBVH_UpdateNormals)
|
if (flag & PBVH_UpdateNormals)
|
||||||
@@ -1157,7 +1157,7 @@ void BLI_pbvh_update(PBVH *bvh, int flag, float (*face_nors)[3])
|
|||||||
if (nodes) MEM_freeN(nodes);
|
if (nodes) MEM_freeN(nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3])
|
void BKE_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3])
|
||||||
{
|
{
|
||||||
PBVHIter iter;
|
PBVHIter iter;
|
||||||
PBVHNode *node;
|
PBVHNode *node;
|
||||||
@@ -1177,7 +1177,7 @@ void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3])
|
|||||||
copy_v3_v3(bb_max, bb.bmax);
|
copy_v3_v3(bb_max, bb.bmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface)
|
void BKE_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface)
|
||||||
{
|
{
|
||||||
PBVHIter iter;
|
PBVHIter iter;
|
||||||
PBVHNode *node;
|
PBVHNode *node;
|
||||||
@@ -1233,24 +1233,24 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
|
|||||||
|
|
||||||
/***************************** PBVH Access ***********************************/
|
/***************************** PBVH Access ***********************************/
|
||||||
|
|
||||||
PBVHType BLI_pbvh_type(const PBVH *bvh)
|
PBVHType BKE_pbvh_type(const PBVH *bvh)
|
||||||
{
|
{
|
||||||
return bvh->type;
|
return bvh->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_bitmap *BLI_pbvh_grid_hidden(const PBVH *bvh)
|
BLI_bitmap *BKE_pbvh_grid_hidden(const PBVH *bvh)
|
||||||
{
|
{
|
||||||
BLI_assert(bvh->type == PBVH_GRIDS);
|
BLI_assert(bvh->type == PBVH_GRIDS);
|
||||||
return bvh->grid_hidden;
|
return bvh->grid_hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_get_grid_key(const PBVH *bvh, CCGKey *key)
|
void BKE_pbvh_get_grid_key(const PBVH *bvh, CCGKey *key)
|
||||||
{
|
{
|
||||||
BLI_assert(bvh->type == PBVH_GRIDS);
|
BLI_assert(bvh->type == PBVH_GRIDS);
|
||||||
*key = bvh->gridkey;
|
*key = bvh->gridkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMesh *BLI_pbvh_get_bmesh(PBVH *bvh)
|
BMesh *BKE_pbvh_get_bmesh(PBVH *bvh)
|
||||||
{
|
{
|
||||||
BLI_assert(bvh->type == PBVH_BMESH);
|
BLI_assert(bvh->type == PBVH_BMESH);
|
||||||
return bvh->bm;
|
return bvh->bm;
|
||||||
@@ -1258,17 +1258,17 @@ BMesh *BLI_pbvh_get_bmesh(PBVH *bvh)
|
|||||||
|
|
||||||
/***************************** Node Access ***********************************/
|
/***************************** Node Access ***********************************/
|
||||||
|
|
||||||
void BLI_pbvh_node_mark_update(PBVHNode *node)
|
void BKE_pbvh_node_mark_update(PBVHNode *node)
|
||||||
{
|
{
|
||||||
node->flag |= PBVH_UpdateNormals | PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateDrawBuffers | PBVH_UpdateRedraw;
|
node->flag |= PBVH_UpdateNormals | PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateDrawBuffers | PBVH_UpdateRedraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_mark_rebuild_draw(PBVHNode *node)
|
void BKE_pbvh_node_mark_rebuild_draw(PBVHNode *node)
|
||||||
{
|
{
|
||||||
node->flag |= PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers | PBVH_UpdateRedraw;
|
node->flag |= PBVH_RebuildDrawBuffers | PBVH_UpdateDrawBuffers | PBVH_UpdateRedraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
|
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
|
||||||
{
|
{
|
||||||
BLI_assert(node->flag & PBVH_Leaf);
|
BLI_assert(node->flag & PBVH_Leaf);
|
||||||
|
|
||||||
@@ -1278,13 +1278,13 @@ void BLI_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
|
|||||||
node->flag &= ~PBVH_FullyHidden;
|
node->flag &= ~PBVH_FullyHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, MVert **verts)
|
void BKE_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, MVert **verts)
|
||||||
{
|
{
|
||||||
if (vert_indices) *vert_indices = node->vert_indices;
|
if (vert_indices) *vert_indices = node->vert_indices;
|
||||||
if (verts) *verts = bvh->verts;
|
if (verts) *verts = bvh->verts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *totvert)
|
void BKE_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *totvert)
|
||||||
{
|
{
|
||||||
int tot;
|
int tot;
|
||||||
|
|
||||||
@@ -1306,7 +1306,7 @@ void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *to
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, CCGElem ***griddata, DMGridAdjacency **gridadj)
|
void BKE_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, CCGElem ***griddata, DMGridAdjacency **gridadj)
|
||||||
{
|
{
|
||||||
switch (bvh->type) {
|
switch (bvh->type) {
|
||||||
case PBVH_GRIDS:
|
case PBVH_GRIDS:
|
||||||
@@ -1329,19 +1329,19 @@ void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node, int **grid_indices, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3])
|
void BKE_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3])
|
||||||
{
|
{
|
||||||
copy_v3_v3(bb_min, node->vb.bmin);
|
copy_v3_v3(bb_min, node->vb.bmin);
|
||||||
copy_v3_v3(bb_max, node->vb.bmax);
|
copy_v3_v3(bb_max, node->vb.bmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3])
|
void BKE_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max[3])
|
||||||
{
|
{
|
||||||
copy_v3_v3(bb_min, node->orig_vb.bmin);
|
copy_v3_v3(bb_min, node->orig_vb.bmin);
|
||||||
copy_v3_v3(bb_max, node->orig_vb.bmax);
|
copy_v3_v3(bb_max, node->orig_vb.bmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count)
|
void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *proxy_count)
|
||||||
{
|
{
|
||||||
if (node->proxy_count > 0) {
|
if (node->proxy_count > 0) {
|
||||||
if (proxies) *proxies = node->proxies;
|
if (proxies) *proxies = node->proxies;
|
||||||
@@ -1366,14 +1366,14 @@ static int ray_aabb_intersect(PBVHNode *node, void *data_v)
|
|||||||
float bb_min[3], bb_max[3];
|
float bb_min[3], bb_max[3];
|
||||||
|
|
||||||
if (rcd->original)
|
if (rcd->original)
|
||||||
BLI_pbvh_node_get_original_BB(node, bb_min, bb_max);
|
BKE_pbvh_node_get_original_BB(node, bb_min, bb_max);
|
||||||
else
|
else
|
||||||
BLI_pbvh_node_get_BB(node, bb_min, bb_max);
|
BKE_pbvh_node_get_BB(node, bb_min, bb_max);
|
||||||
|
|
||||||
return isect_ray_aabb(&rcd->ray, bb_min, bb_max, &node->tmin);
|
return isect_ray_aabb(&rcd->ray, bb_min, bb_max, &node->tmin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data,
|
void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
|
||||||
const float ray_start[3], const float ray_normal[3],
|
const float ray_start[3], const float ray_normal[3],
|
||||||
int original)
|
int original)
|
||||||
{
|
{
|
||||||
@@ -1382,7 +1382,7 @@ void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data,
|
|||||||
isect_ray_aabb_initialize(&rcd.ray, ray_start, ray_normal);
|
isect_ray_aabb_initialize(&rcd.ray, ray_start, ray_normal);
|
||||||
rcd.original = original;
|
rcd.original = original;
|
||||||
|
|
||||||
BLI_pbvh_search_callback_occluded(bvh, ray_aabb_intersect, &rcd, cb, data);
|
BKE_pbvh_search_callback_occluded(bvh, ray_aabb_intersect, &rcd, cb, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ray_face_intersection(const float ray_start[3],
|
int ray_face_intersection(const float ray_start[3],
|
||||||
@@ -1495,7 +1495,7 @@ static int pbvh_grids_node_raycast(PBVH *bvh, PBVHNode *node,
|
|||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco,
|
int BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco,
|
||||||
const float ray_start[3], const float ray_normal[3],
|
const float ray_start[3], const float ray_normal[3],
|
||||||
float *dist)
|
float *dist)
|
||||||
{
|
{
|
||||||
@@ -1528,7 +1528,7 @@ typedef struct {
|
|||||||
int wireframe;
|
int wireframe;
|
||||||
} PBVHNodeDrawData;
|
} PBVHNodeDrawData;
|
||||||
|
|
||||||
void BLI_pbvh_node_draw(PBVHNode *node, void *data_v)
|
void BKE_pbvh_node_draw(PBVHNode *node, void *data_v)
|
||||||
{
|
{
|
||||||
PBVHNodeDrawData *data = data_v;
|
PBVHNodeDrawData *data = data_v;
|
||||||
|
|
||||||
@@ -1595,19 +1595,19 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3],
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
|
int BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
|
||||||
{
|
{
|
||||||
float bb_min[3], bb_max[3];
|
float bb_min[3], bb_max[3];
|
||||||
|
|
||||||
BLI_pbvh_node_get_BB(node, bb_min, bb_max);
|
BKE_pbvh_node_get_BB(node, bb_min, bb_max);
|
||||||
return test_planes_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE;
|
return test_planes_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data)
|
int BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data)
|
||||||
{
|
{
|
||||||
float bb_min[3], bb_max[3];
|
float bb_min[3], bb_max[3];
|
||||||
|
|
||||||
BLI_pbvh_node_get_BB(node, bb_min, bb_max);
|
BKE_pbvh_node_get_BB(node, bb_min, bb_max);
|
||||||
return test_planes_aabb(bb_min, bb_max, data) != ISECT_INSIDE;
|
return test_planes_aabb(bb_min, bb_max, data) != ISECT_INSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1620,7 +1620,7 @@ static void pbvh_node_check_diffuse_changed(PBVH *bvh, PBVHNode *node)
|
|||||||
node->flag |= PBVH_UpdateDrawBuffers;
|
node->flag |= PBVH_UpdateDrawBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
|
void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
|
||||||
DMSetMaterial setMaterial, int wireframe)
|
DMSetMaterial setMaterial, int wireframe)
|
||||||
{
|
{
|
||||||
PBVHNodeDrawData draw_data = {setMaterial, wireframe};
|
PBVHNodeDrawData draw_data = {setMaterial, wireframe};
|
||||||
@@ -1630,7 +1630,7 @@ void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
|
|||||||
for (a = 0; a < bvh->totnode; a++)
|
for (a = 0; a < bvh->totnode; a++)
|
||||||
pbvh_node_check_diffuse_changed(bvh, &bvh->nodes[a]);
|
pbvh_node_check_diffuse_changed(bvh, &bvh->nodes[a]);
|
||||||
|
|
||||||
BLI_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers),
|
BKE_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(PBVH_UpdateNormals | PBVH_UpdateDrawBuffers),
|
||||||
&nodes, &totnode);
|
&nodes, &totnode);
|
||||||
|
|
||||||
pbvh_update_normals(bvh, nodes, totnode, face_nors);
|
pbvh_update_normals(bvh, nodes, totnode, face_nors);
|
||||||
@@ -1639,15 +1639,15 @@ void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
|
|||||||
if (nodes) MEM_freeN(nodes);
|
if (nodes) MEM_freeN(nodes);
|
||||||
|
|
||||||
if (planes) {
|
if (planes) {
|
||||||
BLI_pbvh_search_callback(bvh, BLI_pbvh_node_planes_contain_AABB,
|
BKE_pbvh_search_callback(bvh, BKE_pbvh_node_planes_contain_AABB,
|
||||||
planes, BLI_pbvh_node_draw, &draw_data);
|
planes, BKE_pbvh_node_draw, &draw_data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BLI_pbvh_search_callback(bvh, NULL, NULL, BLI_pbvh_node_draw, &draw_data);
|
BKE_pbvh_search_callback(bvh, NULL, NULL, BKE_pbvh_node_draw, &draw_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces,
|
void BKE_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces,
|
||||||
DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
|
DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
@@ -1661,23 +1661,23 @@ void BLI_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj,
|
|||||||
bvh->grid_hidden = grid_hidden;
|
bvh->grid_hidden = grid_hidden;
|
||||||
|
|
||||||
for (a = 0; a < bvh->totnode; ++a)
|
for (a = 0; a < bvh->totnode; ++a)
|
||||||
BLI_pbvh_node_mark_rebuild_draw(&bvh->nodes[a]);
|
BKE_pbvh_node_mark_rebuild_draw(&bvh->nodes[a]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the node's displacement layer, creating it if necessary */
|
/* Get the node's displacement layer, creating it if necessary */
|
||||||
float *BLI_pbvh_node_layer_disp_get(PBVH *bvh, PBVHNode *node)
|
float *BKE_pbvh_node_layer_disp_get(PBVH *bvh, PBVHNode *node)
|
||||||
{
|
{
|
||||||
if (!node->layer_disp) {
|
if (!node->layer_disp) {
|
||||||
int totvert = 0;
|
int totvert = 0;
|
||||||
BLI_pbvh_node_num_verts(bvh, node, &totvert, NULL);
|
BKE_pbvh_node_num_verts(bvh, node, &totvert, NULL);
|
||||||
node->layer_disp = MEM_callocN(sizeof(float) * totvert, "layer disp");
|
node->layer_disp = MEM_callocN(sizeof(float) * totvert, "layer disp");
|
||||||
}
|
}
|
||||||
return node->layer_disp;
|
return node->layer_disp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the node has a displacement layer, free it and set to null */
|
/* If the node has a displacement layer, free it and set to null */
|
||||||
void BLI_pbvh_node_layer_disp_free(PBVHNode *node)
|
void BKE_pbvh_node_layer_disp_free(PBVHNode *node)
|
||||||
{
|
{
|
||||||
if (node->layer_disp) {
|
if (node->layer_disp) {
|
||||||
MEM_freeN(node->layer_disp);
|
MEM_freeN(node->layer_disp);
|
||||||
@@ -1685,7 +1685,7 @@ void BLI_pbvh_node_layer_disp_free(PBVHNode *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float (*BLI_pbvh_get_vertCos(PBVH * pbvh))[3]
|
float (*BKE_pbvh_get_vertCos(PBVH * pbvh))[3]
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
float (*vertCos)[3] = NULL;
|
float (*vertCos)[3] = NULL;
|
||||||
@@ -1694,7 +1694,7 @@ float (*BLI_pbvh_get_vertCos(PBVH * pbvh))[3]
|
|||||||
float *co;
|
float *co;
|
||||||
MVert *mvert = pbvh->verts;
|
MVert *mvert = pbvh->verts;
|
||||||
|
|
||||||
vertCos = MEM_callocN(3 * pbvh->totvert * sizeof(float), "BLI_pbvh_get_vertCoords");
|
vertCos = MEM_callocN(3 * pbvh->totvert * sizeof(float), "BKE_pbvh_get_vertCoords");
|
||||||
co = (float *)vertCos;
|
co = (float *)vertCos;
|
||||||
|
|
||||||
for (a = 0; a < pbvh->totvert; a++, mvert++, co += 3) {
|
for (a = 0; a < pbvh->totvert; a++, mvert++, co += 3) {
|
||||||
@@ -1705,7 +1705,7 @@ float (*BLI_pbvh_get_vertCos(PBVH * pbvh))[3]
|
|||||||
return vertCos;
|
return vertCos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)[3])
|
void BKE_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)[3])
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
@@ -1734,21 +1734,21 @@ void BLI_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)[3])
|
|||||||
BKE_mesh_calc_normals_tessface(pbvh->verts, pbvh->totvert, pbvh->faces, pbvh->totprim, NULL);
|
BKE_mesh_calc_normals_tessface(pbvh->verts, pbvh->totvert, pbvh->faces, pbvh->totprim, NULL);
|
||||||
|
|
||||||
for (a = 0; a < pbvh->totnode; ++a)
|
for (a = 0; a < pbvh->totnode; ++a)
|
||||||
BLI_pbvh_node_mark_update(&pbvh->nodes[a]);
|
BKE_pbvh_node_mark_update(&pbvh->nodes[a]);
|
||||||
|
|
||||||
BLI_pbvh_update(pbvh, PBVH_UpdateBB, NULL);
|
BKE_pbvh_update(pbvh, PBVH_UpdateBB, NULL);
|
||||||
BLI_pbvh_update(pbvh, PBVH_UpdateOriginalBB, NULL);
|
BKE_pbvh_update(pbvh, PBVH_UpdateOriginalBB, NULL);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLI_pbvh_isDeformed(PBVH *pbvh)
|
int BKE_pbvh_isDeformed(PBVH *pbvh)
|
||||||
{
|
{
|
||||||
return pbvh->deformed;
|
return pbvh->deformed;
|
||||||
}
|
}
|
||||||
/* Proxies */
|
/* Proxies */
|
||||||
|
|
||||||
PBVHProxyNode *BLI_pbvh_node_add_proxy(PBVH *bvh, PBVHNode *node)
|
PBVHProxyNode *BKE_pbvh_node_add_proxy(PBVH *bvh, PBVHNode *node)
|
||||||
{
|
{
|
||||||
int index, totverts;
|
int index, totverts;
|
||||||
|
|
||||||
@@ -1764,14 +1764,14 @@ PBVHProxyNode *BLI_pbvh_node_add_proxy(PBVH *bvh, PBVHNode *node)
|
|||||||
else
|
else
|
||||||
node->proxies = MEM_mallocN(sizeof(PBVHProxyNode), "PBVHNodeProxy");
|
node->proxies = MEM_mallocN(sizeof(PBVHProxyNode), "PBVHNodeProxy");
|
||||||
|
|
||||||
BLI_pbvh_node_num_verts(bvh, node, &totverts, NULL);
|
BKE_pbvh_node_num_verts(bvh, node, &totverts, NULL);
|
||||||
node->proxies[index].co = MEM_callocN(sizeof(float[3]) * totverts, "PBVHNodeProxy.co");
|
node->proxies[index].co = MEM_callocN(sizeof(float[3]) * totverts, "PBVHNodeProxy.co");
|
||||||
}
|
}
|
||||||
|
|
||||||
return node->proxies + index;
|
return node->proxies + index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_free_proxies(PBVHNode *node)
|
void BKE_pbvh_node_free_proxies(PBVHNode *node)
|
||||||
{
|
{
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
{
|
{
|
||||||
@@ -1789,7 +1789,7 @@ void BLI_pbvh_node_free_proxies(PBVHNode *node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***r_array, int *r_tot)
|
void BKE_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***r_array, int *r_tot)
|
||||||
{
|
{
|
||||||
PBVHNode **array = NULL, **newarray, *node;
|
PBVHNode **array = NULL, **newarray, *node;
|
||||||
int tot = 0, space = 0;
|
int tot = 0, space = 0;
|
||||||
@@ -1802,7 +1802,7 @@ void BLI_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***r_array, int *r_tot)
|
|||||||
if (tot == space) {
|
if (tot == space) {
|
||||||
/* resize array if needed */
|
/* resize array if needed */
|
||||||
space = (tot == 0) ? 32 : space * 2;
|
space = (tot == 0) ? 32 : space * 2;
|
||||||
newarray = MEM_callocN(sizeof(PBVHNode) * space, "BLI_pbvh_gather_proxies");
|
newarray = MEM_callocN(sizeof(PBVHNode) * space, "BKE_pbvh_gather_proxies");
|
||||||
|
|
||||||
if (array) {
|
if (array) {
|
||||||
memcpy(newarray, array, sizeof(PBVHNode) * tot);
|
memcpy(newarray, array, sizeof(PBVHNode) * tot);
|
||||||
@@ -1839,9 +1839,9 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
|
|||||||
vi->fno = 0;
|
vi->fno = 0;
|
||||||
vi->mvert = 0;
|
vi->mvert = 0;
|
||||||
|
|
||||||
BLI_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids, NULL);
|
BKE_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids, NULL);
|
||||||
BLI_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert);
|
BKE_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert);
|
||||||
BLI_pbvh_node_get_verts(bvh, node, &vert_indices, &verts);
|
BKE_pbvh_node_get_verts(bvh, node, &vert_indices, &verts);
|
||||||
vi->key = &bvh->gridkey;
|
vi->key = &bvh->gridkey;
|
||||||
|
|
||||||
vi->grids = grids;
|
vi->grids = grids;
|
||||||
|
|||||||
@@ -999,7 +999,7 @@ void pbvh_bmesh_normals_update(PBVHNode **nodes, int totnode)
|
|||||||
/***************************** Public API *****************************/
|
/***************************** Public API *****************************/
|
||||||
|
|
||||||
/* Build a PBVH from a BMesh */
|
/* Build a PBVH from a BMesh */
|
||||||
void BLI_pbvh_build_bmesh(PBVH *bvh, BMesh *bm, int smooth_shading,
|
void BKE_pbvh_build_bmesh(PBVH *bvh, BMesh *bm, int smooth_shading,
|
||||||
BMLog *log)
|
BMLog *log)
|
||||||
{
|
{
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
@@ -1009,7 +1009,7 @@ void BLI_pbvh_build_bmesh(PBVH *bvh, BMesh *bm, int smooth_shading,
|
|||||||
|
|
||||||
bvh->bm = bm;
|
bvh->bm = bm;
|
||||||
|
|
||||||
BLI_pbvh_bmesh_detail_size_set(bvh, 0.75);
|
BKE_pbvh_bmesh_detail_size_set(bvh, 0.75);
|
||||||
|
|
||||||
bvh->type = PBVH_BMESH;
|
bvh->type = PBVH_BMESH;
|
||||||
bvh->bm_face_to_node = BLI_ghash_ptr_new("bm_face_to_node");
|
bvh->bm_face_to_node = BLI_ghash_ptr_new("bm_face_to_node");
|
||||||
@@ -1038,7 +1038,7 @@ void BLI_pbvh_build_bmesh(PBVH *bvh, BMesh *bm, int smooth_shading,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Collapse short edges, subdivide long edges */
|
/* Collapse short edges, subdivide long edges */
|
||||||
int BLI_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode,
|
int BKE_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode,
|
||||||
const float center[3], float radius)
|
const float center[3], float radius)
|
||||||
{
|
{
|
||||||
BLI_buffer_declare(BMFace*, edge_faces, 8);
|
BLI_buffer_declare(BMFace*, edge_faces, 8);
|
||||||
@@ -1085,7 +1085,7 @@ int BLI_pbvh_bmesh_update_topology(PBVH *bvh, PBVHTopologyUpdateMode mode,
|
|||||||
|
|
||||||
/* In order to perform operations on the original node coordinates
|
/* In order to perform operations on the original node coordinates
|
||||||
* (such as raycast), store the node's triangles and vertices.*/
|
* (such as raycast), store the node's triangles and vertices.*/
|
||||||
void BLI_pbvh_bmesh_node_save_orig(PBVHNode *node)
|
void BKE_pbvh_bmesh_node_save_orig(PBVHNode *node)
|
||||||
{
|
{
|
||||||
GHashIterator gh_iter;
|
GHashIterator gh_iter;
|
||||||
int i, totvert, tottri;
|
int i, totvert, tottri;
|
||||||
@@ -1134,7 +1134,7 @@ void BLI_pbvh_bmesh_node_save_orig(PBVHNode *node)
|
|||||||
node->bm_tot_ortri = i;
|
node->bm_tot_ortri = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_bmesh_after_stroke(PBVH *bvh)
|
void BKE_pbvh_bmesh_after_stroke(PBVH *bvh)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < bvh->totnode; i++) {
|
for (i = 0; i < bvh->totnode; i++) {
|
||||||
@@ -1150,23 +1150,23 @@ void BLI_pbvh_bmesh_after_stroke(PBVH *bvh)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_bmesh_detail_size_set(PBVH *bvh, float detail_size)
|
void BKE_pbvh_bmesh_detail_size_set(PBVH *bvh, float detail_size)
|
||||||
{
|
{
|
||||||
bvh->bm_max_edge_len = detail_size;
|
bvh->bm_max_edge_len = detail_size;
|
||||||
bvh->bm_min_edge_len = bvh->bm_max_edge_len * 0.4;
|
bvh->bm_min_edge_len = bvh->bm_max_edge_len * 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BLI_pbvh_node_mark_topology_update(PBVHNode *node)
|
void BKE_pbvh_node_mark_topology_update(PBVHNode *node)
|
||||||
{
|
{
|
||||||
node->flag |= PBVH_UpdateTopology;
|
node->flag |= PBVH_UpdateTopology;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHash *BLI_pbvh_bmesh_node_unique_verts(PBVHNode *node)
|
GHash *BKE_pbvh_bmesh_node_unique_verts(PBVHNode *node)
|
||||||
{
|
{
|
||||||
return node->bm_unique_verts;
|
return node->bm_unique_verts;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHash *BLI_pbvh_bmesh_node_other_verts(PBVHNode *node)
|
GHash *BKE_pbvh_bmesh_node_other_verts(PBVHNode *node)
|
||||||
{
|
{
|
||||||
return node->bm_other_verts;
|
return node->bm_other_verts;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1569,7 +1569,7 @@ static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
|
|||||||
CCGFace **faces;
|
CCGFace **faces;
|
||||||
int totface;
|
int totface;
|
||||||
|
|
||||||
BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void ***)&faces, &totface);
|
BKE_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void ***)&faces, &totface);
|
||||||
if (totface) {
|
if (totface) {
|
||||||
ccgSubSurf_updateFromFaces(ccgdm->ss, 0, faces, totface);
|
ccgSubSurf_updateFromFaces(ccgdm->ss, 0, faces, totface);
|
||||||
ccgSubSurf_updateNormals(ccgdm->ss, faces, totface);
|
ccgSubSurf_updateNormals(ccgdm->ss, faces, totface);
|
||||||
@@ -1707,7 +1707,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
|
|||||||
|
|
||||||
if (ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
|
if (ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
|
||||||
if (dm->numTessFaceData) {
|
if (dm->numTessFaceData) {
|
||||||
BLI_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL,
|
BKE_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL,
|
||||||
setMaterial, FALSE);
|
setMaterial, FALSE);
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
}
|
}
|
||||||
@@ -3026,7 +3026,7 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
|
|||||||
* when the ccgdm gets remade, the assumption is that the topology
|
* when the ccgdm gets remade, the assumption is that the topology
|
||||||
* does not change. */
|
* does not change. */
|
||||||
ccgdm_create_grids(dm);
|
ccgdm_create_grids(dm);
|
||||||
BLI_pbvh_grids_update(ob->sculpt->pbvh, ccgdm->gridData, ccgdm->gridAdjacency, (void **)ccgdm->gridFaces,
|
BKE_pbvh_grids_update(ob->sculpt->pbvh, ccgdm->gridData, ccgdm->gridAdjacency, (void **)ccgdm->gridFaces,
|
||||||
ccgdm->gridFlagMats, ccgdm->gridHidden);
|
ccgdm->gridFlagMats, ccgdm->gridHidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3044,15 +3044,15 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
|
|||||||
|
|
||||||
numGrids = ccgDM_getNumGrids(dm);
|
numGrids = ccgDM_getNumGrids(dm);
|
||||||
|
|
||||||
ob->sculpt->pbvh = ccgdm->pbvh = BLI_pbvh_new();
|
ob->sculpt->pbvh = ccgdm->pbvh = BKE_pbvh_new();
|
||||||
BLI_pbvh_build_grids(ccgdm->pbvh, ccgdm->gridData, ccgdm->gridAdjacency,
|
BKE_pbvh_build_grids(ccgdm->pbvh, ccgdm->gridData, ccgdm->gridAdjacency,
|
||||||
numGrids, &key, (void **) ccgdm->gridFaces, ccgdm->gridFlagMats, ccgdm->gridHidden);
|
numGrids, &key, (void **) ccgdm->gridFaces, ccgdm->gridFlagMats, ccgdm->gridHidden);
|
||||||
}
|
}
|
||||||
else if (ob->type == OB_MESH) {
|
else if (ob->type == OB_MESH) {
|
||||||
Mesh *me = ob->data;
|
Mesh *me = ob->data;
|
||||||
ob->sculpt->pbvh = ccgdm->pbvh = BLI_pbvh_new();
|
ob->sculpt->pbvh = ccgdm->pbvh = BKE_pbvh_new();
|
||||||
BLI_assert(!(me->mface == NULL && me->mpoly != NULL)); /* BMESH ONLY complain if mpoly is valid but not mface */
|
BLI_assert(!(me->mface == NULL && me->mpoly != NULL)); /* BMESH ONLY complain if mpoly is valid but not mface */
|
||||||
BLI_pbvh_build_mesh(ccgdm->pbvh, me->mface, me->mvert,
|
BKE_pbvh_build_mesh(ccgdm->pbvh, me->mface, me->mvert,
|
||||||
me->totface, me->totvert, &me->vdata);
|
me->totface, me->totvert, &me->vdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ static void partialvis_update_mesh(Object *ob,
|
|||||||
int *vert_indices;
|
int *vert_indices;
|
||||||
int any_changed = 0, any_visible = 0, totvert, i;
|
int any_changed = 0, any_visible = 0, totvert, i;
|
||||||
|
|
||||||
BLI_pbvh_node_num_verts(pbvh, node, NULL, &totvert);
|
BKE_pbvh_node_num_verts(pbvh, node, NULL, &totvert);
|
||||||
BLI_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
|
BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
|
||||||
paint_mask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
|
paint_mask = CustomData_get_layer(&me->vdata, CD_PAINT_MASK);
|
||||||
|
|
||||||
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
|
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
|
||||||
@@ -136,8 +136,8 @@ static void partialvis_update_mesh(Object *ob,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (any_changed) {
|
if (any_changed) {
|
||||||
BLI_pbvh_node_mark_rebuild_draw(node);
|
BKE_pbvh_node_mark_rebuild_draw(node);
|
||||||
BLI_pbvh_node_fully_hidden_set(node, !any_visible);
|
BKE_pbvh_node_fully_hidden_set(node, !any_visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,11 +157,11 @@ static void partialvis_update_grids(Object *ob,
|
|||||||
int *grid_indices, totgrid, any_changed, i;
|
int *grid_indices, totgrid, any_changed, i;
|
||||||
|
|
||||||
/* get PBVH data */
|
/* get PBVH data */
|
||||||
BLI_pbvh_node_get_grids(pbvh, node,
|
BKE_pbvh_node_get_grids(pbvh, node,
|
||||||
&grid_indices, &totgrid, NULL, NULL,
|
&grid_indices, &totgrid, NULL, NULL,
|
||||||
&grids, NULL);
|
&grids, NULL);
|
||||||
grid_hidden = BLI_pbvh_grid_hidden(pbvh);
|
grid_hidden = BKE_pbvh_grid_hidden(pbvh);
|
||||||
BLI_pbvh_get_grid_key(pbvh, &key);
|
BKE_pbvh_get_grid_key(pbvh, &key);
|
||||||
|
|
||||||
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
|
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
|
||||||
|
|
||||||
@@ -226,8 +226,8 @@ static void partialvis_update_grids(Object *ob,
|
|||||||
|
|
||||||
/* mark updates if anything was hidden/shown */
|
/* mark updates if anything was hidden/shown */
|
||||||
if (any_changed) {
|
if (any_changed) {
|
||||||
BLI_pbvh_node_mark_rebuild_draw(node);
|
BKE_pbvh_node_mark_rebuild_draw(node);
|
||||||
BLI_pbvh_node_fully_hidden_set(node, !any_visible);
|
BKE_pbvh_node_fully_hidden_set(node, !any_visible);
|
||||||
multires_mark_as_modified(ob, MULTIRES_HIDDEN_MODIFIED);
|
multires_mark_as_modified(ob, MULTIRES_HIDDEN_MODIFIED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,9 +273,9 @@ static void partialvis_update_bmesh(Object *ob,
|
|||||||
GHash *unique, *other;
|
GHash *unique, *other;
|
||||||
int any_changed = 0, any_visible = 0;
|
int any_changed = 0, any_visible = 0;
|
||||||
|
|
||||||
bm = BLI_pbvh_get_bmesh(pbvh);
|
bm = BKE_pbvh_get_bmesh(pbvh);
|
||||||
unique = BLI_pbvh_bmesh_node_unique_verts(node);
|
unique = BKE_pbvh_bmesh_node_unique_verts(node);
|
||||||
other = BLI_pbvh_bmesh_node_other_verts(node);
|
other = BKE_pbvh_bmesh_node_other_verts(node);
|
||||||
|
|
||||||
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
|
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
|
||||||
|
|
||||||
@@ -296,8 +296,8 @@ static void partialvis_update_bmesh(Object *ob,
|
|||||||
&any_visible);
|
&any_visible);
|
||||||
|
|
||||||
if (any_changed) {
|
if (any_changed) {
|
||||||
BLI_pbvh_node_mark_rebuild_draw(node);
|
BKE_pbvh_node_mark_rebuild_draw(node);
|
||||||
BLI_pbvh_node_fully_hidden_set(node, !any_visible);
|
BKE_pbvh_node_fully_hidden_set(node, !any_visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,22 +334,22 @@ static void get_pbvh_nodes(PBVH *pbvh,
|
|||||||
float clip_planes[4][4],
|
float clip_planes[4][4],
|
||||||
PartialVisArea mode)
|
PartialVisArea mode)
|
||||||
{
|
{
|
||||||
BLI_pbvh_SearchCallback cb = NULL;
|
BKE_pbvh_SearchCallback cb = NULL;
|
||||||
|
|
||||||
/* select search callback */
|
/* select search callback */
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case PARTIALVIS_INSIDE:
|
case PARTIALVIS_INSIDE:
|
||||||
cb = BLI_pbvh_node_planes_contain_AABB;
|
cb = BKE_pbvh_node_planes_contain_AABB;
|
||||||
break;
|
break;
|
||||||
case PARTIALVIS_OUTSIDE:
|
case PARTIALVIS_OUTSIDE:
|
||||||
cb = BLI_pbvh_node_planes_exclude_AABB;
|
cb = BKE_pbvh_node_planes_exclude_AABB;
|
||||||
break;
|
break;
|
||||||
case PARTIALVIS_ALL:
|
case PARTIALVIS_ALL:
|
||||||
case PARTIALVIS_MASKED:
|
case PARTIALVIS_MASKED:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_pbvh_search_gather(pbvh, cb, clip_planes, nodes, totnode);
|
BKE_pbvh_search_gather(pbvh, cb, clip_planes, nodes, totnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hide_show_exec(bContext *C, wmOperator *op)
|
static int hide_show_exec(bContext *C, wmOperator *op)
|
||||||
@@ -379,7 +379,7 @@ static int hide_show_exec(bContext *C, wmOperator *op)
|
|||||||
ob->sculpt->pbvh = pbvh;
|
ob->sculpt->pbvh = pbvh;
|
||||||
|
|
||||||
get_pbvh_nodes(pbvh, &nodes, &totnode, clip_planes, area);
|
get_pbvh_nodes(pbvh, &nodes, &totnode, clip_planes, area);
|
||||||
pbvh_type = BLI_pbvh_type(pbvh);
|
pbvh_type = BKE_pbvh_type(pbvh);
|
||||||
|
|
||||||
/* start undo */
|
/* start undo */
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
|
|||||||
pbvh = dm->getPBVH(ob, dm);
|
pbvh = dm->getPBVH(ob, dm);
|
||||||
ob->sculpt->pbvh = pbvh;
|
ob->sculpt->pbvh = pbvh;
|
||||||
|
|
||||||
BLI_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);
|
BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);
|
||||||
|
|
||||||
sculpt_undo_push_begin("Mask flood fill");
|
sculpt_undo_push_begin("Mask flood fill");
|
||||||
|
|
||||||
@@ -105,12 +105,12 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);
|
sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(pbvh, nodes[i], vi, PBVH_ITER_UNIQUE) {
|
BKE_pbvh_vertex_iter_begin(pbvh, nodes[i], vi, PBVH_ITER_UNIQUE) {
|
||||||
mask_flood_fill_set_elem(vi.mask, mode, value);
|
mask_flood_fill_set_elem(vi.mask, mode, value);
|
||||||
} BLI_pbvh_vertex_iter_end;
|
} BKE_pbvh_vertex_iter_end;
|
||||||
|
|
||||||
BLI_pbvh_node_mark_update(nodes[i]);
|
BKE_pbvh_node_mark_update(nodes[i]);
|
||||||
if (BLI_pbvh_type(pbvh) == PBVH_GRIDS)
|
if (BKE_pbvh_type(pbvh) == PBVH_GRIDS)
|
||||||
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
|
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ static void sculpt_orig_vert_data_update(SculptOrigVertData *orig_data,
|
|||||||
static int sculpt_stroke_dynamic_topology(const SculptSession *ss,
|
static int sculpt_stroke_dynamic_topology(const SculptSession *ss,
|
||||||
const Brush *brush)
|
const Brush *brush)
|
||||||
{
|
{
|
||||||
return ((BLI_pbvh_type(ss->pbvh) == PBVH_BMESH) &&
|
return ((BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) &&
|
||||||
|
|
||||||
(!ss->cache || (!ss->cache->alt_smooth)) &&
|
(!ss->cache || (!ss->cache->alt_smooth)) &&
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
|
|||||||
(void)sd; /* quied unused warning */
|
(void)sd; /* quied unused warning */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
|
BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
|
||||||
|
|
||||||
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
|
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
|
||||||
for (n = 0; n < totnode; n++) {
|
for (n = 0; n < totnode; n++) {
|
||||||
@@ -438,7 +438,7 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
|
|||||||
|
|
||||||
sculpt_orig_vert_data_unode_init(&orig_data, ob, unode);
|
sculpt_orig_vert_data_unode_init(&orig_data, ob, unode);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
sculpt_orig_vert_data_update(&orig_data, &vd);
|
sculpt_orig_vert_data_update(&orig_data, &vd);
|
||||||
|
|
||||||
@@ -452,9 +452,9 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
|
|||||||
}
|
}
|
||||||
if (vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
if (vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
|
|
||||||
BLI_pbvh_node_mark_update(nodes[n]);
|
BKE_pbvh_node_mark_update(nodes[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,7 +481,7 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
|
|||||||
if (!pbvh)
|
if (!pbvh)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
BLI_pbvh_redraw_BB(pbvh, bb_min, bb_max);
|
BKE_pbvh_redraw_BB(pbvh, bb_min, bb_max);
|
||||||
|
|
||||||
/* convert 3D bounding box to screen space */
|
/* convert 3D bounding box to screen space */
|
||||||
if (!paint_convert_bb_to_rect(rect,
|
if (!paint_convert_bb_to_rect(rect,
|
||||||
@@ -521,7 +521,7 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar,
|
|||||||
|
|
||||||
/* clear redraw flag from nodes */
|
/* clear redraw flag from nodes */
|
||||||
if (pbvh)
|
if (pbvh)
|
||||||
BLI_pbvh_update(pbvh, PBVH_UpdateRedraw, NULL);
|
BKE_pbvh_update(pbvh, PBVH_UpdateRedraw, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ Brush Testing *******************/
|
/************************ Brush Testing *******************/
|
||||||
@@ -1006,9 +1006,9 @@ static int sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (data->original)
|
if (data->original)
|
||||||
BLI_pbvh_node_get_original_BB(node, bb_min, bb_max);
|
BKE_pbvh_node_get_original_BB(node, bb_min, bb_max);
|
||||||
else
|
else
|
||||||
BLI_pbvh_node_get_BB(node, bb_min, bb_max);
|
BKE_pbvh_node_get_BB(node, bb_min, bb_max);
|
||||||
|
|
||||||
for (i = 0; i < 3; ++i) {
|
for (i = 0; i < 3; ++i) {
|
||||||
if (bb_min[i] > center[i])
|
if (bb_min[i] > center[i])
|
||||||
@@ -1082,7 +1082,7 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
|
|||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
if (original) {
|
if (original) {
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
|
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
|
||||||
float fno[3];
|
float fno[3];
|
||||||
@@ -1091,10 +1091,10 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
|
|||||||
add_norm_if(ss->cache->view_normal, private_an, private_out_flip, fno);
|
add_norm_if(ss->cache->view_normal, private_an, private_out_flip, fno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_fast(&test, vd.co)) {
|
if (sculpt_brush_test_fast(&test, vd.co)) {
|
||||||
if (vd.no) {
|
if (vd.no) {
|
||||||
@@ -1108,7 +1108,7 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
@@ -1435,7 +1435,7 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
|
|||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
||||||
@@ -1463,7 +1463,7 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_bmesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node, float bstrength, int smooth_mask)
|
static void do_bmesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node, float bstrength, int smooth_mask)
|
||||||
@@ -1476,7 +1476,7 @@ static void do_bmesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
|
|||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
||||||
@@ -1504,7 +1504,7 @@ static void do_bmesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
|
static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
|
||||||
@@ -1525,9 +1525,9 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
|
|||||||
|
|
||||||
CLAMP(bstrength, 0.0f, 1.0f);
|
CLAMP(bstrength, 0.0f, 1.0f);
|
||||||
|
|
||||||
BLI_pbvh_node_get_grids(ss->pbvh, node, &grid_indices, &totgrid,
|
BKE_pbvh_node_get_grids(ss->pbvh, node, &grid_indices, &totgrid,
|
||||||
NULL, &gridsize, &griddata, &gridadj);
|
NULL, &gridsize, &griddata, &gridadj);
|
||||||
BLI_pbvh_get_grid_key(ss->pbvh, &key);
|
BKE_pbvh_get_grid_key(ss->pbvh, &key);
|
||||||
|
|
||||||
thread_num = 0;
|
thread_num = 0;
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
@@ -1661,7 +1661,7 @@ static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode,
|
|||||||
SculptSession *ss = ob->sculpt;
|
SculptSession *ss = ob->sculpt;
|
||||||
const int max_iterations = 4;
|
const int max_iterations = 4;
|
||||||
const float fract = 1.0f / max_iterations;
|
const float fract = 1.0f / max_iterations;
|
||||||
PBVHType type = BLI_pbvh_type(ss->pbvh);
|
PBVHType type = BKE_pbvh_type(ss->pbvh);
|
||||||
int iteration, n, count;
|
int iteration, n, count;
|
||||||
float last;
|
float last;
|
||||||
|
|
||||||
@@ -1721,7 +1721,7 @@ static void do_mask_brush_draw(Sculpt *sd, Object *ob, PBVHNode **nodes, int tot
|
|||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
float fade = tex_strength(ss, brush, vd.co, test.dist,
|
float fade = tex_strength(ss, brush, vd.co, test.dist,
|
||||||
@@ -1733,7 +1733,7 @@ static void do_mask_brush_draw(Sculpt *sd, Object *ob, PBVHNode **nodes, int tot
|
|||||||
if (vd.mvert)
|
if (vd.mvert)
|
||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1773,11 +1773,11 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
/* offset vertex */
|
/* offset vertex */
|
||||||
@@ -1791,7 +1791,7 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1829,11 +1829,11 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
/* offset vertex */
|
/* offset vertex */
|
||||||
@@ -1856,7 +1856,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1873,11 +1873,11 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
||||||
@@ -1892,7 +1892,7 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1924,11 +1924,11 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
|||||||
|
|
||||||
sculpt_orig_vert_data_init(&orig_data, ob, nodes[n]);
|
sculpt_orig_vert_data_init(&orig_data, ob, nodes[n]);
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
sculpt_orig_vert_data_update(&orig_data, &vd);
|
sculpt_orig_vert_data_update(&orig_data, &vd);
|
||||||
|
|
||||||
@@ -1946,7 +1946,7 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1970,11 +1970,11 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
||||||
@@ -1987,7 +1987,7 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2019,11 +2019,11 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
||||||
@@ -2036,7 +2036,7 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2063,11 +2063,11 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
|
|||||||
|
|
||||||
sculpt_orig_vert_data_init(&orig_data, ob, nodes[n]);
|
sculpt_orig_vert_data_init(&orig_data, ob, nodes[n]);
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
sculpt_orig_vert_data_update(&orig_data, &vd);
|
sculpt_orig_vert_data_update(&orig_data, &vd);
|
||||||
|
|
||||||
@@ -2085,7 +2085,7 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2117,11 +2117,11 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
|
|||||||
|
|
||||||
sculpt_orig_vert_data_init(&orig_data, ob, nodes[n]);
|
sculpt_orig_vert_data_init(&orig_data, ob, nodes[n]);
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
sculpt_orig_vert_data_update(&orig_data, &vd);
|
sculpt_orig_vert_data_update(&orig_data, &vd);
|
||||||
|
|
||||||
@@ -2141,7 +2141,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2166,18 +2166,18 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
|
|||||||
SculptOrigVertData orig_data;
|
SculptOrigVertData orig_data;
|
||||||
float *layer_disp;
|
float *layer_disp;
|
||||||
/* XXX: layer brush needs conversion to proxy but its more complicated */
|
/* XXX: layer brush needs conversion to proxy but its more complicated */
|
||||||
/* proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co; */
|
/* proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co; */
|
||||||
|
|
||||||
sculpt_orig_vert_data_init(&orig_data, ob, nodes[n]);
|
sculpt_orig_vert_data_init(&orig_data, ob, nodes[n]);
|
||||||
|
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
{
|
{
|
||||||
layer_disp = BLI_pbvh_node_layer_disp_get(ss->pbvh, nodes[n]);
|
layer_disp = BKE_pbvh_node_layer_disp_get(ss->pbvh, nodes[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
sculpt_orig_vert_data_update(&orig_data, &vd);
|
sculpt_orig_vert_data_update(&orig_data, &vd);
|
||||||
|
|
||||||
@@ -2212,7 +2212,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2229,11 +2229,11 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test(&test, vd.co)) {
|
if (sculpt_brush_test(&test, vd.co)) {
|
||||||
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
|
||||||
@@ -2251,7 +2251,7 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
|
|||||||
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2278,24 +2278,24 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
|
|||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
if (ss->cache->original) {
|
if (ss->cache->original) {
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
|
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
|
||||||
add_v3_v3(private_fc, unode->co[vd.i]);
|
add_v3_v3(private_fc, unode->co[vd.i]);
|
||||||
private_count++;
|
private_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_fast(&test, vd.co)) {
|
if (sculpt_brush_test_fast(&test, vd.co)) {
|
||||||
add_v3_v3(private_fc, vd.co);
|
add_v3_v3(private_fc, vd.co);
|
||||||
private_count++;
|
private_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
@@ -2345,7 +2345,7 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
|
|||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
if (ss->cache->original && unode->co) {
|
if (ss->cache->original && unode->co) {
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
|
if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
|
||||||
/* for area normal */
|
/* for area normal */
|
||||||
@@ -2359,10 +2359,10 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
|
|||||||
private_count++;
|
private_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_fast(&test, vd.co)) {
|
if (sculpt_brush_test_fast(&test, vd.co)) {
|
||||||
/* for area normal */
|
/* for area normal */
|
||||||
@@ -2381,7 +2381,7 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
|
|||||||
private_count++;
|
private_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma omp critical
|
#pragma omp critical
|
||||||
@@ -2563,11 +2563,11 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_sq(&test, vd.co)) {
|
if (sculpt_brush_test_sq(&test, vd.co)) {
|
||||||
float intr[3];
|
float intr[3];
|
||||||
@@ -2588,7 +2588,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2635,11 +2635,11 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_sq(&test, vd.co)) {
|
if (sculpt_brush_test_sq(&test, vd.co)) {
|
||||||
if (plane_point_side_flip(vd.co, an, fc, flip)) {
|
if (plane_point_side_flip(vd.co, an, fc, flip)) {
|
||||||
@@ -2663,7 +2663,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2737,11 +2737,11 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_cube(&test, vd.co, mat)) {
|
if (sculpt_brush_test_cube(&test, vd.co, mat)) {
|
||||||
if (plane_point_side_flip(vd.co, sn, fc, flip)) {
|
if (plane_point_side_flip(vd.co, sn, fc, flip)) {
|
||||||
@@ -2765,7 +2765,7 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2801,11 +2801,11 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_sq(&test, vd.co)) {
|
if (sculpt_brush_test_sq(&test, vd.co)) {
|
||||||
if (plane_point_side(vd.co, an, fc)) {
|
if (plane_point_side(vd.co, an, fc)) {
|
||||||
@@ -2829,7 +2829,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2865,11 +2865,11 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
|
|||||||
SculptBrushTest test;
|
SculptBrushTest test;
|
||||||
float (*proxy)[3];
|
float (*proxy)[3];
|
||||||
|
|
||||||
proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
|
||||||
|
|
||||||
sculpt_brush_test_init(ss, &test);
|
sculpt_brush_test_init(ss, &test);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
if (sculpt_brush_test_sq(&test, vd.co)) {
|
if (sculpt_brush_test_sq(&test, vd.co)) {
|
||||||
if (!plane_point_side(vd.co, an, fc)) {
|
if (!plane_point_side(vd.co, an, fc)) {
|
||||||
@@ -2893,7 +2893,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2975,7 +2975,7 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush)
|
|||||||
SCULPT_TOOL_THUMB,
|
SCULPT_TOOL_THUMB,
|
||||||
SCULPT_TOOL_LAYER);
|
SCULPT_TOOL_LAYER);
|
||||||
|
|
||||||
BLI_pbvh_search_gather(ss->pbvh, sculpt_search_sphere_cb, &data, &nodes, &totnode);
|
BKE_pbvh_search_gather(ss->pbvh, sculpt_search_sphere_cb, &data, &nodes, &totnode);
|
||||||
|
|
||||||
/* Only act if some verts are inside the brush area */
|
/* Only act if some verts are inside the brush area */
|
||||||
if (totnode) {
|
if (totnode) {
|
||||||
@@ -2991,16 +2991,16 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush)
|
|||||||
sculpt_undo_push_node(ob, nodes[n],
|
sculpt_undo_push_node(ob, nodes[n],
|
||||||
brush->sculpt_tool == SCULPT_TOOL_MASK ?
|
brush->sculpt_tool == SCULPT_TOOL_MASK ?
|
||||||
SCULPT_UNDO_MASK : SCULPT_UNDO_COORDS);
|
SCULPT_UNDO_MASK : SCULPT_UNDO_COORDS);
|
||||||
BLI_pbvh_node_mark_update(nodes[n]);
|
BKE_pbvh_node_mark_update(nodes[n]);
|
||||||
|
|
||||||
if (BLI_pbvh_type(ss->pbvh) == PBVH_BMESH) {
|
if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
|
||||||
BLI_pbvh_node_mark_topology_update(nodes[n]);
|
BKE_pbvh_node_mark_topology_update(nodes[n]);
|
||||||
BLI_pbvh_bmesh_node_save_orig(nodes[n]);
|
BKE_pbvh_bmesh_node_save_orig(nodes[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BLI_pbvh_type(ss->pbvh) == PBVH_BMESH) {
|
if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
|
||||||
BLI_pbvh_bmesh_update_topology(ss->pbvh, mode,
|
BKE_pbvh_bmesh_update_topology(ss->pbvh, mode,
|
||||||
ss->cache->location,
|
ss->cache->location,
|
||||||
ss->cache->radius);
|
ss->cache->radius);
|
||||||
}
|
}
|
||||||
@@ -3025,7 +3025,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
|
|||||||
SCULPT_TOOL_ROTATE,
|
SCULPT_TOOL_ROTATE,
|
||||||
SCULPT_TOOL_THUMB,
|
SCULPT_TOOL_THUMB,
|
||||||
SCULPT_TOOL_LAYER);
|
SCULPT_TOOL_LAYER);
|
||||||
BLI_pbvh_search_gather(ss->pbvh, sculpt_search_sphere_cb, &data, &nodes, &totnode);
|
BKE_pbvh_search_gather(ss->pbvh, sculpt_search_sphere_cb, &data, &nodes, &totnode);
|
||||||
|
|
||||||
/* Only act if some verts are inside the brush area */
|
/* Only act if some verts are inside the brush area */
|
||||||
if (totnode) {
|
if (totnode) {
|
||||||
@@ -3034,7 +3034,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
|
|||||||
sculpt_undo_push_node(ob, nodes[n],
|
sculpt_undo_push_node(ob, nodes[n],
|
||||||
brush->sculpt_tool == SCULPT_TOOL_MASK ?
|
brush->sculpt_tool == SCULPT_TOOL_MASK ?
|
||||||
SCULPT_UNDO_MASK : SCULPT_UNDO_COORDS);
|
SCULPT_UNDO_MASK : SCULPT_UNDO_COORDS);
|
||||||
BLI_pbvh_node_mark_update(nodes[n]);
|
BKE_pbvh_node_mark_update(nodes[n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brush_needs_sculpt_normal(brush))
|
if (brush_needs_sculpt_normal(brush))
|
||||||
@@ -3142,7 +3142,7 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
|
|||||||
PBVHNode **nodes;
|
PBVHNode **nodes;
|
||||||
int totnode, n;
|
int totnode, n;
|
||||||
|
|
||||||
BLI_pbvh_gather_proxies(ss->pbvh, &nodes, &totnode);
|
BKE_pbvh_gather_proxies(ss->pbvh, &nodes, &totnode);
|
||||||
|
|
||||||
if (!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
|
if (!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
|
||||||
/* these brushes start from original coordinates */
|
/* these brushes start from original coordinates */
|
||||||
@@ -3159,9 +3159,9 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
|
|||||||
if (use_orco && !ss->bm)
|
if (use_orco && !ss->bm)
|
||||||
orco = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS)->co;
|
orco = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS)->co;
|
||||||
|
|
||||||
BLI_pbvh_node_get_proxies(nodes[n], &proxies, &proxy_count);
|
BKE_pbvh_node_get_proxies(nodes[n], &proxies, &proxy_count);
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
float val[3];
|
float val[3];
|
||||||
int p;
|
int p;
|
||||||
@@ -3186,9 +3186,9 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
|
|||||||
if (ss->modifiers_active)
|
if (ss->modifiers_active)
|
||||||
sculpt_flush_pbvhvert_deform(ob, &vd);
|
sculpt_flush_pbvhvert_deform(ob, &vd);
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
|
|
||||||
BLI_pbvh_node_free_proxies(nodes[n]);
|
BKE_pbvh_node_free_proxies(nodes[n]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3205,7 +3205,7 @@ static void sculpt_update_keyblock(Object *ob)
|
|||||||
/* Keyblock update happens after handling deformation caused by modifiers,
|
/* Keyblock update happens after handling deformation caused by modifiers,
|
||||||
* so ss->orig_cos would be updated with new stroke */
|
* so ss->orig_cos would be updated with new stroke */
|
||||||
if (ss->orig_cos) vertCos = ss->orig_cos;
|
if (ss->orig_cos) vertCos = ss->orig_cos;
|
||||||
else vertCos = BLI_pbvh_get_vertCos(ss->pbvh);
|
else vertCos = BKE_pbvh_get_vertCos(ss->pbvh);
|
||||||
|
|
||||||
if (vertCos) {
|
if (vertCos) {
|
||||||
sculpt_vertcos_to_key(ob, ss->kb, vertCos);
|
sculpt_vertcos_to_key(ob, ss->kb, vertCos);
|
||||||
@@ -3233,13 +3233,13 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
|
|||||||
if (ss->kb)
|
if (ss->kb)
|
||||||
vertCos = MEM_callocN(sizeof(*vertCos) * me->totvert, "flushStrokeDeofrm keyVerts");
|
vertCos = MEM_callocN(sizeof(*vertCos) * me->totvert, "flushStrokeDeofrm keyVerts");
|
||||||
|
|
||||||
BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
|
BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
|
||||||
|
|
||||||
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
|
#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
|
||||||
for (n = 0; n < totnode; n++) {
|
for (n = 0; n < totnode; n++) {
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
|
||||||
{
|
{
|
||||||
sculpt_flush_pbvhvert_deform(ob, &vd);
|
sculpt_flush_pbvhvert_deform(ob, &vd);
|
||||||
|
|
||||||
@@ -3248,7 +3248,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
|
|||||||
copy_v3_v3(vertCos[index], ss->orig_cos[index]);
|
copy_v3_v3(vertCos[index], ss->orig_cos[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vertCos) {
|
if (vertCos) {
|
||||||
@@ -3463,7 +3463,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
|
|||||||
ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : mesh_getVertexCos(me, NULL);
|
ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : mesh_getVertexCos(me, NULL);
|
||||||
|
|
||||||
crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
|
crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
|
||||||
BLI_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);
|
BKE_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);
|
||||||
|
|
||||||
for (a = 0; a < me->totvert; ++a) {
|
for (a = 0; a < me->totvert; ++a) {
|
||||||
invert_m3(ss->deform_imats[a]);
|
invert_m3(ss->deform_imats[a]);
|
||||||
@@ -3473,12 +3473,12 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
|
|||||||
else free_sculptsession_deformMats(ss);
|
else free_sculptsession_deformMats(ss);
|
||||||
|
|
||||||
/* if pbvh is deformed, key block is already applied to it */
|
/* if pbvh is deformed, key block is already applied to it */
|
||||||
if (ss->kb && !BLI_pbvh_isDeformed(ss->pbvh)) {
|
if (ss->kb && !BKE_pbvh_isDeformed(ss->pbvh)) {
|
||||||
float (*vertCos)[3] = BKE_key_convert_to_vertcos(ob, ss->kb);
|
float (*vertCos)[3] = BKE_key_convert_to_vertcos(ob, ss->kb);
|
||||||
|
|
||||||
if (vertCos) {
|
if (vertCos) {
|
||||||
/* apply shape keys coordinates to PBVH */
|
/* apply shape keys coordinates to PBVH */
|
||||||
BLI_pbvh_apply_vertCos(ss->pbvh, vertCos);
|
BKE_pbvh_apply_vertCos(ss->pbvh, vertCos);
|
||||||
MEM_freeN(vertCos);
|
MEM_freeN(vertCos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3614,7 +3614,7 @@ static void sculpt_omp_start(Sculpt *sd, SculptSession *ss)
|
|||||||
|
|
||||||
if (ss->multires) {
|
if (ss->multires) {
|
||||||
int i, gridsize, array_mem_size;
|
int i, gridsize, array_mem_size;
|
||||||
BLI_pbvh_node_get_grids(ss->pbvh, NULL, NULL, NULL, NULL,
|
BKE_pbvh_node_get_grids(ss->pbvh, NULL, NULL, NULL, NULL,
|
||||||
&gridsize, NULL, NULL);
|
&gridsize, NULL, NULL);
|
||||||
|
|
||||||
array_mem_size = cache->num_threads * sizeof(void *);
|
array_mem_size = cache->num_threads * sizeof(void *);
|
||||||
@@ -4045,13 +4045,13 @@ typedef struct {
|
|||||||
|
|
||||||
static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float *tmin)
|
static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float *tmin)
|
||||||
{
|
{
|
||||||
if (BLI_pbvh_node_get_tmin(node) < *tmin) {
|
if (BKE_pbvh_node_get_tmin(node) < *tmin) {
|
||||||
SculptRaycastData *srd = data_v;
|
SculptRaycastData *srd = data_v;
|
||||||
float (*origco)[3] = NULL;
|
float (*origco)[3] = NULL;
|
||||||
int use_origco = FALSE;
|
int use_origco = FALSE;
|
||||||
|
|
||||||
if (srd->original && srd->ss->cache) {
|
if (srd->original && srd->ss->cache) {
|
||||||
if (BLI_pbvh_type(srd->ss->pbvh) == PBVH_BMESH) {
|
if (BKE_pbvh_type(srd->ss->pbvh) == PBVH_BMESH) {
|
||||||
use_origco = TRUE;
|
use_origco = TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -4062,7 +4062,7 @@ static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float *tmin)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BLI_pbvh_node_raycast(srd->ss->pbvh, node, origco, use_origco,
|
if (BKE_pbvh_node_raycast(srd->ss->pbvh, node, origco, use_origco,
|
||||||
srd->ray_start, srd->ray_normal, &srd->dist))
|
srd->ray_start, srd->ray_normal, &srd->dist))
|
||||||
{
|
{
|
||||||
srd->hit = 1;
|
srd->hit = 1;
|
||||||
@@ -4113,7 +4113,7 @@ int sculpt_stroke_get_location(bContext *C, float out[3], const float mouse[2])
|
|||||||
srd.dist = dist;
|
srd.dist = dist;
|
||||||
srd.hit = 0;
|
srd.hit = 0;
|
||||||
srd.original = (cache) ? cache->original : 0;
|
srd.original = (cache) ? cache->original : 0;
|
||||||
BLI_pbvh_raycast(ss->pbvh, sculpt_raycast_cb, &srd,
|
BKE_pbvh_raycast(ss->pbvh, sculpt_raycast_cb, &srd,
|
||||||
ray_start, ray_normal, srd.original);
|
ray_start, ray_normal, srd.original);
|
||||||
|
|
||||||
copy_v3_v3(out, ray_normal);
|
copy_v3_v3(out, ray_normal);
|
||||||
@@ -4196,7 +4196,7 @@ static void sculpt_flush_update(bContext *C)
|
|||||||
else {
|
else {
|
||||||
rcti r;
|
rcti r;
|
||||||
|
|
||||||
BLI_pbvh_update(ss->pbvh, PBVH_UpdateBB, NULL);
|
BKE_pbvh_update(ss->pbvh, PBVH_UpdateBB, NULL);
|
||||||
if (sculpt_get_redraw_rect(ar, CTX_wm_region_view3d(C), ob, &r)) {
|
if (sculpt_get_redraw_rect(ar, CTX_wm_region_view3d(C), ob, &r)) {
|
||||||
if (ss->cache)
|
if (ss->cache)
|
||||||
ss->cache->previous_r = r;
|
ss->cache->previous_r = r;
|
||||||
@@ -4257,7 +4257,7 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
|
|||||||
sculpt_update_cache_variants(C, sd, ob, stroke, itemptr);
|
sculpt_update_cache_variants(C, sd, ob, stroke, itemptr);
|
||||||
sculpt_restore_mesh(sd, ob);
|
sculpt_restore_mesh(sd, ob);
|
||||||
|
|
||||||
BLI_pbvh_bmesh_detail_size_set(ss->pbvh,
|
BKE_pbvh_bmesh_detail_size_set(ss->pbvh,
|
||||||
(ss->cache->radius /
|
(ss->cache->radius /
|
||||||
(float)ss->cache->pixel_radius) *
|
(float)ss->cache->pixel_radius) *
|
||||||
(float)sd->detail_size);
|
(float)sd->detail_size);
|
||||||
@@ -4336,10 +4336,10 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str
|
|||||||
|
|
||||||
sculpt_undo_push_end();
|
sculpt_undo_push_end();
|
||||||
|
|
||||||
BLI_pbvh_update(ss->pbvh, PBVH_UpdateOriginalBB, NULL);
|
BKE_pbvh_update(ss->pbvh, PBVH_UpdateOriginalBB, NULL);
|
||||||
|
|
||||||
if (BLI_pbvh_type(ss->pbvh) == PBVH_BMESH)
|
if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH)
|
||||||
BLI_pbvh_bmesh_after_stroke(ss->pbvh);
|
BKE_pbvh_bmesh_after_stroke(ss->pbvh);
|
||||||
|
|
||||||
/* optimization: if there is locked key and active modifiers present in */
|
/* optimization: if there is locked key and active modifiers present in */
|
||||||
/* the stack, keyblock is updating at each step. otherwise we could update */
|
/* the stack, keyblock is updating at each step. otherwise we could update */
|
||||||
@@ -4510,7 +4510,7 @@ void sculpt_pbvh_clear(Object *ob)
|
|||||||
|
|
||||||
/* Clear out any existing DM and PBVH */
|
/* Clear out any existing DM and PBVH */
|
||||||
if (ss->pbvh)
|
if (ss->pbvh)
|
||||||
BLI_pbvh_free(ss->pbvh);
|
BKE_pbvh_free(ss->pbvh);
|
||||||
ss->pbvh = NULL;
|
ss->pbvh = NULL;
|
||||||
if (dm)
|
if (dm)
|
||||||
dm->getPBVH(NULL, dm);
|
dm->getPBVH(NULL, dm);
|
||||||
|
|||||||
@@ -73,10 +73,10 @@
|
|||||||
|
|
||||||
static void update_cb(PBVHNode *node, void *rebuild)
|
static void update_cb(PBVHNode *node, void *rebuild)
|
||||||
{
|
{
|
||||||
BLI_pbvh_node_mark_update(node);
|
BKE_pbvh_node_mark_update(node);
|
||||||
if (*((int *)rebuild))
|
if (*((int *)rebuild))
|
||||||
BLI_pbvh_node_mark_rebuild_draw(node);
|
BKE_pbvh_node_mark_rebuild_draw(node);
|
||||||
BLI_pbvh_node_fully_hidden_set(node, 0);
|
BKE_pbvh_node_fully_hidden_set(node, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sculpt_undo_restore_deformed(const SculptSession *ss,
|
static void sculpt_undo_restore_deformed(const SculptSession *ss,
|
||||||
@@ -143,7 +143,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
|
|||||||
|
|
||||||
/* pbvh uses it's own mvert array, so coords should be */
|
/* pbvh uses it's own mvert array, so coords should be */
|
||||||
/* propagated to pbvh here */
|
/* propagated to pbvh here */
|
||||||
BLI_pbvh_apply_vertCos(ss->pbvh, vertCos);
|
BKE_pbvh_apply_vertCos(ss->pbvh, vertCos);
|
||||||
|
|
||||||
MEM_freeN(vertCos);
|
MEM_freeN(vertCos);
|
||||||
}
|
}
|
||||||
@@ -443,8 +443,8 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
|
|||||||
/* we update all nodes still, should be more clever, but also
|
/* we update all nodes still, should be more clever, but also
|
||||||
* needs to work correct when exiting/entering sculpt mode and
|
* needs to work correct when exiting/entering sculpt mode and
|
||||||
* the nodes get recreated, though in that case it could do all */
|
* the nodes get recreated, though in that case it could do all */
|
||||||
BLI_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, &rebuild);
|
BKE_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, &rebuild);
|
||||||
BLI_pbvh_update(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw, NULL);
|
BKE_pbvh_update(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw, NULL);
|
||||||
|
|
||||||
if ((mmd = sculpt_multires_active(scene, ob))) {
|
if ((mmd = sculpt_multires_active(scene, ob))) {
|
||||||
if (rebuild)
|
if (rebuild)
|
||||||
@@ -531,9 +531,9 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh,
|
|||||||
BLI_bitmap *grid_hidden;
|
BLI_bitmap *grid_hidden;
|
||||||
int i, *grid_indices, totgrid;
|
int i, *grid_indices, totgrid;
|
||||||
|
|
||||||
grid_hidden = BLI_pbvh_grid_hidden(pbvh);
|
grid_hidden = BKE_pbvh_grid_hidden(pbvh);
|
||||||
|
|
||||||
BLI_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid,
|
BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid,
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
unode->grid_hidden = MEM_mapallocN(sizeof(BLI_bitmap) * totgrid,
|
unode->grid_hidden = MEM_mapallocN(sizeof(BLI_bitmap) * totgrid,
|
||||||
@@ -561,8 +561,8 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node,
|
|||||||
unode->node = node;
|
unode->node = node;
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert);
|
BKE_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert);
|
||||||
BLI_pbvh_node_get_grids(ss->pbvh, node, &grids, &totgrid,
|
BKE_pbvh_node_get_grids(ss->pbvh, node, &grids, &totgrid,
|
||||||
&maxgrid, &gridsize, NULL, NULL);
|
&maxgrid, &gridsize, NULL, NULL);
|
||||||
|
|
||||||
unode->totvert = totvert;
|
unode->totvert = totvert;
|
||||||
@@ -624,7 +624,7 @@ static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode)
|
|||||||
SculptSession *ss = ob->sculpt;
|
SculptSession *ss = ob->sculpt;
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL)
|
||||||
{
|
{
|
||||||
copy_v3_v3(unode->co[vd.i], vd.co);
|
copy_v3_v3(unode->co[vd.i], vd.co);
|
||||||
if (vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
|
if (vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
|
||||||
@@ -633,7 +633,7 @@ static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode)
|
|||||||
if (ss->modifiers_active)
|
if (ss->modifiers_active)
|
||||||
copy_v3_v3(unode->orig_co[vd.i], ss->orig_cos[unode->index[vd.i]]);
|
copy_v3_v3(unode->orig_co[vd.i], ss->orig_cos[unode->index[vd.i]]);
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
|
static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
|
||||||
@@ -649,8 +649,8 @@ static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
|
|||||||
int *vert_indices, allvert;
|
int *vert_indices, allvert;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
BLI_pbvh_node_num_verts(pbvh, node, NULL, &allvert);
|
BKE_pbvh_node_num_verts(pbvh, node, NULL, &allvert);
|
||||||
BLI_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
|
BKE_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
|
||||||
for (i = 0; i < allvert; i++) {
|
for (i = 0; i < allvert; i++) {
|
||||||
BLI_BITMAP_MODIFY(unode->vert_hidden, i,
|
BLI_BITMAP_MODIFY(unode->vert_hidden, i,
|
||||||
mvert[vert_indices[i]].flag & ME_HIDE);
|
mvert[vert_indices[i]].flag & ME_HIDE);
|
||||||
@@ -663,11 +663,11 @@ static void sculpt_undo_store_mask(Object *ob, SculptUndoNode *unode)
|
|||||||
SculptSession *ss = ob->sculpt;
|
SculptSession *ss = ob->sculpt;
|
||||||
PBVHVertexIter vd;
|
PBVHVertexIter vd;
|
||||||
|
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL)
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL)
|
||||||
{
|
{
|
||||||
unode->mask[vd.i] = *vd.mask;
|
unode->mask[vd.i] = *vd.mask;
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SculptUndoNode *sculpt_undo_bmesh_push(Object *ob,
|
static SculptUndoNode *sculpt_undo_bmesh_push(Object *ob,
|
||||||
@@ -728,10 +728,10 @@ static SculptUndoNode *sculpt_undo_bmesh_push(Object *ob,
|
|||||||
case SCULPT_UNDO_MASK:
|
case SCULPT_UNDO_MASK:
|
||||||
/* Before any vertex values get modified, ensure their
|
/* Before any vertex values get modified, ensure their
|
||||||
* original positions are logged */
|
* original positions are logged */
|
||||||
BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_ALL) {
|
BKE_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_ALL) {
|
||||||
BM_log_vert_before_modified(ss->bm, ss->bm_log, vd.bm_vert);
|
BM_log_vert_before_modified(ss->bm, ss->bm_log, vd.bm_vert);
|
||||||
}
|
}
|
||||||
BLI_pbvh_vertex_iter_end;
|
BKE_pbvh_vertex_iter_end;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCULPT_UNDO_DYNTOPO_BEGIN:
|
case SCULPT_UNDO_DYNTOPO_BEGIN:
|
||||||
@@ -777,14 +777,14 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
|
|||||||
|
|
||||||
if (unode->grids) {
|
if (unode->grids) {
|
||||||
int totgrid, *grids;
|
int totgrid, *grids;
|
||||||
BLI_pbvh_node_get_grids(ss->pbvh, node, &grids, &totgrid,
|
BKE_pbvh_node_get_grids(ss->pbvh, node, &grids, &totgrid,
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
memcpy(unode->grids, grids, sizeof(int) * totgrid);
|
memcpy(unode->grids, grids, sizeof(int) * totgrid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int *vert_indices, allvert;
|
int *vert_indices, allvert;
|
||||||
BLI_pbvh_node_num_verts(ss->pbvh, node, NULL, &allvert);
|
BKE_pbvh_node_num_verts(ss->pbvh, node, NULL, &allvert);
|
||||||
BLI_pbvh_node_get_verts(ss->pbvh, node, &vert_indices, NULL);
|
BKE_pbvh_node_get_verts(ss->pbvh, node, &vert_indices, NULL);
|
||||||
memcpy(unode->index, vert_indices, sizeof(int) * unode->totvert);
|
memcpy(unode->index, vert_indices, sizeof(int) * unode->totvert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -831,7 +831,7 @@ void sculpt_undo_push_end(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unode->node)
|
if (unode->node)
|
||||||
BLI_pbvh_node_layer_disp_free(unode->node);
|
BKE_pbvh_node_layer_disp_free(unode->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
undo_paint_push_end(UNDO_PAINT_MESH);
|
undo_paint_push_end(UNDO_PAINT_MESH);
|
||||||
|
|||||||
Reference in New Issue
Block a user