diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-08-25 05:26:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-08-25 05:28:50 +0400 |
commit | 1987548a33a83918b009cd8b04705c45bb4a2f9a (patch) | |
tree | d3d45dc129f36893e7b009823a4fa8c3cd60e154 /source/blender | |
parent | 07c96cc102a55217011e8b92429a82d195068d34 (diff) |
BLI_kdopbvh: ifdef unused 'skip' member
Saves memory and speeds up balance
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 17ab55e58f4..23adbc4b1f5 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -43,6 +43,9 @@ #include <omp.h> #endif +/* used for iterative_raycast */ +// #define USE_SKIP_LINKS + #define MAX_TREETYPE 32 /* Setting zero so we can catch bugs in OpenMP/KDOPBVH. @@ -61,7 +64,9 @@ typedef unsigned char axis_t; typedef struct BVHNode { struct BVHNode **children; struct BVHNode *parent; /* some user defined traversed need that */ +#ifdef USE_SKIP_LINKS struct BVHNode *skip[2]; +#endif float *bv; /* Bounding volume of all nodes, max 13 axis */ int index; /* face, edge, vertex index */ char totnode; /* how many nodes are used, used for speedup */ @@ -385,7 +390,7 @@ static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int a return n; } -/* --- */ +#ifdef USE_SKIP_LINKS static void build_skip_links(BVHTree *tree, BVHNode *node, BVHNode *left, BVHNode *right) { int i; @@ -402,6 +407,7 @@ static void build_skip_links(BVHTree *tree, BVHNode *node, BVHNode *left, BVHNod left = node->children[i]; } } +#endif /* * BVHTree bounding volumes functions @@ -942,7 +948,10 @@ void BLI_bvhtree_balance(BVHTree *tree) for (i = 0; i < tree->totbranch; i++) tree->nodes[tree->totleaf + i] = branches_array + i; +#ifdef USE_SKIP_LINKS build_skip_links(tree, tree->nodes[tree->totleaf], NULL, NULL); +#endif + /* bvhtree_info(tree); */ } |