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:
Diffstat (limited to 'source/blender/blenlib/intern/pbvh.c')
-rw-r--r--source/blender/blenlib/intern/pbvh.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 9bce8bb4e37..3393a2674e9 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -1,4 +1,4 @@
-/**
+/*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
@@ -27,6 +27,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
+#include "BLI_utildefines.h"
#include "BLI_ghash.h"
#include "BLI_pbvh.h"
@@ -43,25 +44,27 @@
/* Bitmap */
typedef char* BLI_bitmap;
-BLI_bitmap BLI_bitmap_new(int tot)
+static BLI_bitmap BLI_bitmap_new(int tot)
{
return MEM_callocN((tot >> 3) + 1, "BLI bitmap");
}
-int BLI_bitmap_get(BLI_bitmap b, int index)
+static int BLI_bitmap_get(BLI_bitmap b, int index)
{
return b[index >> 3] & (1 << (index & 7));
}
-void BLI_bitmap_set(BLI_bitmap b, int index)
+static void BLI_bitmap_set(BLI_bitmap b, int index)
{
b[index >> 3] |= (1 << (index & 7));
}
-void BLI_bitmap_clear(BLI_bitmap b, int index)
+#if 0 /* UNUSED */
+static void BLI_bitmap_clear(BLI_bitmap b, int index)
{
b[index >> 3] &= ~(1 << (index & 7));
}
+#endif
/* Axis-aligned bounding box */
typedef struct {
@@ -263,7 +266,7 @@ static int partition_indices(int *prim_indices, int lo, int hi, int axis,
}
}
-void check_partitioning(int *prim_indices, int lo, int hi, int axis,
+static void check_partitioning(int *prim_indices, int lo, int hi, int axis,
float mid, BBC *prim_bbc, int index_of_2nd_partition)
{
int i;
@@ -404,7 +407,7 @@ static void build_grids_leaf_node(PBVH *bvh, PBVHNode *node)
offset and start indicate a range in the array of primitive indices
*/
-void build_sub(PBVH *bvh, int node_index, BB *cb, BBC *prim_bbc,
+static void build_sub(PBVH *bvh, int node_index, BB *cb, BBC *prim_bbc,
int offset, int count)
{
int i, axis, end;
@@ -840,7 +843,7 @@ float BLI_pbvh_node_get_tmin(PBVHNode* node)
return node->tmin;
}
-void BLI_pbvh_search_callback_occluded(PBVH *bvh,
+static void BLI_pbvh_search_callback_occluded(PBVH *bvh,
BLI_pbvh_SearchCallback scb, void *search_data,
BLI_pbvh_HitOccludedCallback hcb, void *hit_data)
{
@@ -1400,7 +1403,7 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
//#include "BIF_gl.h"
//#include "BIF_glutil.h"
-void BLI_pbvh_node_draw(PBVHNode *node, void *data)
+void BLI_pbvh_node_draw(PBVHNode *node, void *UNUSED(data))
{
#if 0
/* XXX: Just some quick code to show leaf nodes in different colors */
@@ -1520,13 +1523,22 @@ void BLI_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)[3])
}
if (pbvh->verts) {
+ MVert *mvert= pbvh->verts;
/* copy new verts coords */
- for (a= 0; a < pbvh->totvert; ++a) {
- copy_v3_v3(pbvh->verts[a].co, vertCos[a]);
+ for (a= 0; a < pbvh->totvert; ++a, ++mvert) {
+ copy_v3_v3(mvert->co, vertCos[a]);
+ mvert->flag |= ME_VERT_PBVH_UPDATE;
}
/* coordinates are new -- normals should also be updated */
mesh_calc_normals(pbvh->verts, pbvh->totvert, pbvh->faces, pbvh->totprim, NULL);
+
+ for (a= 0; a < pbvh->totnode; ++a)
+ BLI_pbvh_node_mark_update(&pbvh->nodes[a]);
+
+ BLI_pbvh_update(pbvh, PBVH_UpdateBB, NULL);
+ BLI_pbvh_update(pbvh, PBVH_UpdateOriginalBB, NULL);
+
}
}