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:
authorCampbell Barton <ideasman42@gmail.com>2012-03-07 08:53:43 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-07 08:53:43 +0400
commit46045fbb09684ebc74835168ff4c5924261e3fc0 (patch)
treed233bc2baea422008e5f330ff457291907a387bc /source/blender/blenlib/intern/BLI_kdopbvh.c
parent71e5edeb6a769e2fd861f5fe374e75391415402a (diff)
style cleanup - braces & else / if's
Diffstat (limited to 'source/blender/blenlib/intern/BLI_kdopbvh.c')
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 1876a625bc3..561c7ffb57e 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -766,8 +766,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
//Loop all branches on this level
#pragma omp parallel for private(j) schedule(static)
- for(j = i; j < end_j; j++)
- {
+ for(j = i; j < end_j; j++) {
int k;
const int parent_level_index= j-i;
BVHNode* parent = branches_array + j;
@@ -791,8 +790,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
//Split_leafs takes care of that "sort" problem.
nth_positions[ 0] = parent_leafs_begin;
nth_positions[tree_type] = parent_leafs_end;
- for(k = 1; k < tree_type; k++)
- {
+ for (k = 1; k < tree_type; k++) {
int child_index = j * tree_type + tree_offset + k;
int child_level_index = child_index - first_of_next_level; //child level index
nth_positions[k] = implicit_leafs_index(&data, depth+1, child_level_index);
@@ -803,26 +801,24 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
//Setup children and totnode counters
//Not really needed but currently most of BVH code relies on having an explicit children structure
- for(k = 0; k < tree_type; k++)
- {
+ for (k = 0; k < tree_type; k++) {
int child_index = j * tree_type + tree_offset + k;
int child_level_index = child_index - first_of_next_level; //child level index
int child_leafs_begin = implicit_leafs_index(&data, depth+1, child_level_index);
int child_leafs_end = implicit_leafs_index(&data, depth+1, child_level_index+1);
- if(child_leafs_end - child_leafs_begin > 1)
- {
+ if (child_leafs_end - child_leafs_begin > 1) {
parent->children[k] = branches_array + child_index;
parent->children[k]->parent = parent;
}
- else if(child_leafs_end - child_leafs_begin == 1)
- {
+ else if (child_leafs_end - child_leafs_begin == 1) {
parent->children[k] = leafs_array[ child_leafs_begin ];
parent->children[k]->parent = parent;
}
- else
+ else {
break;
+ }
parent->totnode = k+1;
}
@@ -853,39 +849,32 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
//this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces
epsilon = MAX2(FLT_EPSILON, epsilon);
- if(tree)
- {
+ if(tree) {
tree->epsilon = epsilon;
tree->tree_type = tree_type;
tree->axis = axis;
- if(axis == 26)
- {
+ if (axis == 26) {
tree->start_axis = 0;
tree->stop_axis = 13;
}
- else if(axis == 18)
- {
+ else if (axis == 18) {
tree->start_axis = 7;
tree->stop_axis = 13;
}
- else if(axis == 14)
- {
+ else if (axis == 14) {
tree->start_axis = 0;
tree->stop_axis = 7;
}
- else if(axis == 8) // AABB
- {
+ else if (axis == 8) { /* AABB */
tree->start_axis = 0;
tree->stop_axis = 4;
}
- else if(axis == 6) // OBB
- {
+ else if (axis == 6) { /* OBB */
tree->start_axis = 0;
tree->stop_axis = 3;
}
- else
- {
+ else {
MEM_freeN(tree);
return NULL;
}
@@ -1221,12 +1210,10 @@ static float calc_nearest_point(const float proj[3], BVHNode *node, float *neare
float dl = bv[0] - proj;
float du = bv[1] - proj;
- if(dl > 0)
- {
+ if(dl > 0) {
madd_v3_v3fl(nearest, KDOP_AXES[i], dl);
}
- else if(du < 0)
- {
+ else if(du < 0) {
madd_v3_v3fl(nearest, KDOP_AXES[i], du);
}
}