Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-09 16:37:19 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-09 16:37:19 +0300
commit9ea765e5d316ca6d2b15da2392e9da3643a856bb (patch)
tree7604b9d1dd06064432b9e56af4a7dedd669fec80 /source/blender/blenlib
parentabae1e2ccf2bb16d4a436cdcbb17560252df7e8a (diff)
Sculpt Branch:
* Smooth brush works again for multires. * Optimal Display option for multires modifier, same as subsurf.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_pbvh.h9
-rw-r--r--source/blender/blenlib/intern/pbvh.c20
2 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h
index 5c5277dc091..e1e733c91df 100644
--- a/source/blender/blenlib/BLI_pbvh.h
+++ b/source/blender/blenlib/BLI_pbvh.h
@@ -27,6 +27,7 @@
struct MFace;
struct MVert;
+struct DMGridAdjacency;
struct DMGridData;
struct PBVH;
struct PBVHNode;
@@ -47,7 +48,8 @@ typedef void (*BLI_pbvh_HitCallback)(PBVHNode *node, void *data);
PBVH *BLI_pbvh_new(void);
void BLI_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts,
int totface, int totvert);
-void BLI_pbvh_build_grids(PBVH *bvh, struct DMGridData **grids, int totgrid,
+void BLI_pbvh_build_grids(PBVH *bvh, struct DMGridData **grids,
+ struct DMGridAdjacency *gridadj, int totgrid,
int gridsize, void **gridfaces);
void BLI_pbvh_free(PBVH *bvh);
@@ -94,7 +96,8 @@ typedef enum {
void BLI_pbvh_node_mark_update(PBVHNode *node);
void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node,
- int **grid_indices, int *totgrid, int *maxgrid, int *gridsize);
+ int **grid_indices, int *totgrid, int *maxgrid, int *gridsize,
+ struct DMGridData ***griddata, struct DMGridAdjacency **gridadj);
void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node,
int *uniquevert, int *totvert);
@@ -105,7 +108,7 @@ void BLI_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max
void BLI_pbvh_update(PBVH *bvh, int flags, float (*face_nors)[3]);
void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3]);
-void BLI_pbvh_get_grid_updates(PBVH *bvh, void ***gridfaces, int *totface);
+void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface);
/* Vertex Iterator */
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 3aa0f43553f..960888260ce 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -114,6 +114,7 @@ struct PBVH {
/* Grid Data */
DMGridData **grids;
+ DMGridAdjacency *gridadj;
void **gridfaces;
int totgrid;
int gridsize;
@@ -510,14 +511,15 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
}
/* Do a full rebuild with on Grids data structure */
-void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, int totgrid,
- int gridsize, void **gridfaces)
+void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridadj,
+ int totgrid, int gridsize, void **gridfaces)
{
BBC *prim_bbc = NULL;
BB cb;
int i, j;
bvh->grids= grids;
+ bvh->gridadj= gridadj;
bvh->gridfaces= gridfaces;
bvh->totgrid= totgrid;
bvh->gridsize= gridsize;
@@ -948,7 +950,7 @@ void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3])
copy_v3_v3(bb_max, bb.bmax);
}
-void BLI_pbvh_get_grid_updates(PBVH *bvh, void ***gridfaces, int *totface)
+void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface)
{
PBVHIter iter;
PBVHNode *node;
@@ -965,10 +967,12 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, void ***gridfaces, int *totface)
if(node->flag & PBVH_UpdateNormals) {
for(i = 0; i < node->totprim; ++i) {
face= bvh->gridfaces[node->prim_indices[i]];
- BLI_ghash_insert(map, face, face);
+ if(!BLI_ghash_lookup(map, face))
+ BLI_ghash_insert(map, face, face);
}
- node->flag &= ~PBVH_UpdateNormals;
+ if(clear)
+ node->flag &= ~PBVH_UpdateNormals;
}
}
@@ -1021,19 +1025,23 @@ 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)
+void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, DMGridData ***griddata, DMGridAdjacency **gridadj)
{
if(bvh->grids) {
if(grid_indices) *grid_indices= node->prim_indices;
if(totgrid) *totgrid= node->totprim;
if(maxgrid) *maxgrid= bvh->totgrid;
if(gridsize) *gridsize= bvh->gridsize;
+ if(griddata) *griddata= bvh->grids;
+ if(gridadj) *gridadj= bvh->gridadj;
}
else {
if(grid_indices) *grid_indices= NULL;
if(totgrid) *totgrid= 0;
if(maxgrid) *maxgrid= 0;
if(gridsize) *gridsize= 0;
+ if(griddata) *griddata= NULL;
+ if(gridadj) *gridadj= NULL;
}
}