diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-01-04 01:43:51 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-01-04 01:43:51 +0300 |
commit | 56faf73e3c914972effd12be1f26b1b7602a5de0 (patch) | |
tree | bd108c6d6e1796cefb9ef9dd52e068daaabf17dc /source/blender/blenlib/intern/BLI_kdtree.c | |
parent | 86471f8b72d2a6ac8f6078b92f701da1eeab2525 (diff) |
- Bugfix for flickering shadow with strand simplification.
- On non-edited hair, don't generate child particles for
each step, only at the end.
- Small optimization in the kd-tree.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_kdtree.c')
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdtree.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index dbb9e95d379..80e92cb8809 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -166,11 +166,18 @@ int BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest * min_node= root; min_dist= squared_distance(root->co,co,root->nor,nor); - if(root->left) - stack[cur++]=root->left; - - if(root->right) - stack[cur++]=root->right; + if(co[root->d] < root->co[root->d]) { + if(root->right) + stack[cur++]=root->right; + if(root->left) + stack[cur++]=root->left; + } + else { + if(root->left) + stack[cur++]=root->left; + if(root->right) + stack[cur++]=root->right; + } while(cur--){ node=stack[cur]; @@ -266,11 +273,18 @@ int BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree cur_dist= squared_distance(root->co,co,root->nor,nor); add_nearest(nearest,&found,n,root->index,cur_dist,root->co); - if(root->left) - stack[cur++]=root->left; - - if(root->right) - stack[cur++]=root->right; + if(co[root->d] < root->co[root->d]) { + if(root->right) + stack[cur++]=root->right; + if(root->left) + stack[cur++]=root->left; + } + else { + if(root->left) + stack[cur++]=root->left; + if(root->right) + stack[cur++]=root->right; + } while(cur--){ node=stack[cur]; |