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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-02-23 03:57:31 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-02-23 03:57:31 +0400
commitc428bb438934e3172f33ba6897bc2d55c326acd8 (patch)
tree9563fbaea59a47a84cd6fa235492c22e4d7a2af2 /source/blender/blenlib/intern/pbvh.c
parent5e12c7fecac2a8521de92d7e54b7436b70c762a7 (diff)
Move PBVH bitmap to separate header in blenlib.
The implementation was also changed in a couple ways: use unsigned integers as its base type rather than unsigned chars, and uses macros rather than functions. (These could be changed to inline functions.) Currently it is still only used during PBVH building, but now it's accessible elsewhere.
Diffstat (limited to 'source/blender/blenlib/intern/pbvh.c')
-rw-r--r--source/blender/blenlib/intern/pbvh.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 87fa4437ec1..318cd15d2e9 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -28,6 +28,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_bitmap.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
@@ -43,31 +44,6 @@
//#define PERFCNTRS
-/* Bitmap */
-typedef char* BLI_bitmap;
-
-static BLI_bitmap BLI_bitmap_new(int tot)
-{
- return MEM_callocN((tot >> 3) + 1, "BLI bitmap");
-}
-
-static int BLI_bitmap_get(BLI_bitmap b, int index)
-{
- return b[index >> 3] & (1 << (index & 7));
-}
-
-static void BLI_bitmap_set(BLI_bitmap b, int index)
-{
- b[index >> 3] |= (1 << (index & 7));
-}
-
-#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 {
float bmin[3], bmax[3];
@@ -343,12 +319,12 @@ static int map_insert_vert(PBVH *bvh, GHash *map,
void *value, *key = SET_INT_IN_POINTER(vertex);
if(!BLI_ghash_haskey(map, key)) {
- if(BLI_bitmap_get(bvh->vert_bitmap, vertex)) {
+ if(BLI_BITMAP_GET(bvh->vert_bitmap, vertex)) {
value = SET_INT_IN_POINTER(~(*face_verts));
++(*face_verts);
}
else {
- BLI_bitmap_set(bvh->vert_bitmap, vertex);
+ BLI_BITMAP_SET(bvh->vert_bitmap, vertex);
value = SET_INT_IN_POINTER(*uniq_verts);
++(*uniq_verts);
}
@@ -553,7 +529,7 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
bvh->faces = faces;
bvh->verts = verts;
- bvh->vert_bitmap = BLI_bitmap_new(totvert);
+ bvh->vert_bitmap = BLI_BITMAP_NEW(totvert, "bvh->vert_bitmap");
bvh->totvert = totvert;
bvh->leaf_limit = LEAF_LIMIT;