diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2008-05-12 16:24:52 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2008-05-12 16:24:52 +0400 |
commit | db3712a2d82d5fe67daf3fbc79dde957282ffd6f (patch) | |
tree | 176fcf8247b385791fa26e09e3b52407a1d5c4bf /source/blender/blenlib | |
parent | a68c03e409e01285bee622b12313117012e486a8 (diff) | |
parent | 2c9e8e75939553f03b01f34c185f5875473bad40 (diff) |
svn merge -r 14721:14810 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_arithb.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_edgehash.h | 3 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_kdopbvh.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 22 | ||||
-rw-r--r-- | source/blender/blenlib/intern/arithb.c | 5 | ||||
-rw-r--r-- | source/blender/blenlib/intern/edgehash.c | 5 |
6 files changed, 17 insertions, 22 deletions
diff --git a/source/blender/blenlib/BLI_arithb.h b/source/blender/blenlib/BLI_arithb.h index 5b4e380f88e..9ed23bc32b6 100644 --- a/source/blender/blenlib/BLI_arithb.h +++ b/source/blender/blenlib/BLI_arithb.h @@ -96,7 +96,7 @@ float CalcNormFloat4(float *v1, float *v2, float *v3, float *v4, float *n); void CalcNormLong(int *v1, int *v2, int *v3, float *n); /* CalcNormShort: is ook uitprodukt - (translates as 'is also out/cross product') */ void CalcNormShort(short *v1, short *v2, short *v3, float *n); - +float power_of_2(float val); /** * @section Euler conversion routines diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h index f3aa69d77ff..abbd17c3635 100644 --- a/source/blender/blenlib/BLI_edgehash.h +++ b/source/blender/blenlib/BLI_edgehash.h @@ -86,6 +86,9 @@ void BLI_edgehashIterator_getKey (EdgeHashIterator *ehi, int *v0_r, int *v1 /* Retrieve the value from an iterator. */ void* BLI_edgehashIterator_getValue (EdgeHashIterator *ehi); + /* Set the value for an iterator. */ +void BLI_edgehashIterator_setValue (EdgeHashIterator *ehi, void *val); + /* Steps the iterator to the next index. */ void BLI_edgehashIterator_step (EdgeHashIterator *ehi); diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index 51f87b26aaf..3261984da76 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -21,7 +21,7 @@ * * The Original Code is: all of this file. * - * Contributor(s): Daniel (Genscher) + * Contributor(s): Daniel Genrich, Jose Pinto * * ***** END GPL LICENSE BLOCK ***** */ diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 8be52854a7b..6a1abb5d8ad 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -25,7 +25,7 @@ * * The Original Code is: all of this file. * -* Contributor(s): Daniel Genrich +* Contributor(s): Daniel Genrich, Jose Pinto * * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ @@ -60,7 +60,6 @@ struct BVHTree { BVHNode **nodes; BVHNode *nodearray; /* pre-alloc branch nodes */ - int *orig_index; /* mapping for orig_index to node_index */ float epsilon; /* epslion is used for inflation of the k-dop */ int totleaf; // leafs int totbranch; @@ -253,7 +252,6 @@ void BLI_bvhtree_free(BVHTree *tree) { MEM_freeN(tree->nodes); MEM_freeN(tree->nodearray); - MEM_freeN(tree->orig_index); MEM_freeN(tree); } } @@ -292,16 +290,6 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis) return NULL; } - tree->orig_index = (int *)MEM_callocN(sizeof(int)*(numbranches+maxsize + tree_type), "BVHIndexArray"); - - if(!tree->orig_index) - { - MEM_freeN(tree); - MEM_freeN(tree->nodes); - MEM_freeN(tree->nodearray); - return NULL; - } - tree->epsilon = epsilon; tree->tree_type = tree_type; tree->axis = axis; @@ -559,12 +547,6 @@ void BLI_bvhtree_balance(BVHTree *tree) // create + balance tree bvh_div_nodes(tree, tree->nodes[tree->totleaf], 0, tree->totleaf, 0); - // put indices into array for O(1) access - for(i = 0; i < tree->totleaf; i++) - { - tree->orig_index[tree->nodes[i]->index] = i; - } - verify_tree(tree); } @@ -741,7 +723,7 @@ int BLI_bvhtree_update_node(BVHTree *tree, int index, float *co, float *co_movin if(index > tree->totleaf) return 0; - node = tree->nodes[tree->orig_index[index]]; + node = tree->nodearray + index; create_kdop_hull(tree, node, co, numpoints, 0); diff --git a/source/blender/blenlib/intern/arithb.c b/source/blender/blenlib/intern/arithb.c index 19a8d4f5152..48a149f4b3a 100644 --- a/source/blender/blenlib/intern/arithb.c +++ b/source/blender/blenlib/intern/arithb.c @@ -4345,3 +4345,8 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2, if ((ct[0]*n[0] + ct[1]*n[1] + ct[2]*n[2]) < 0.0f) VecMulf(tang, -1.0f); } + +/* used for zoom values*/ +float power_of_2(float val) { + return pow(2, ceil(log(val) / log(2))); +} diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index 6aa0ded63b9..3e1c8afb7a8 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -200,6 +200,11 @@ void *BLI_edgehashIterator_getValue(EdgeHashIterator *ehi) { return ehi->curEntry?ehi->curEntry->val:NULL; } +void BLI_edgehashIterator_setValue(EdgeHashIterator *ehi, void *val) { + if(ehi->curEntry) + ehi->curEntry->val= val; +} + void BLI_edgehashIterator_step(EdgeHashIterator *ehi) { if (ehi->curEntry) { ehi->curEntry= ehi->curEntry->next; |