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
parent71e5edeb6a769e2fd861f5fe374e75391415402a (diff)
style cleanup - braces & else / if's
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c45
-rw-r--r--source/blender/blenlib/intern/math_geom.c51
-rw-r--r--source/blender/blenlib/intern/winstuff.c6
3 files changed, 35 insertions, 67 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);
}
}
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 18418f3105c..405db864598 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -808,8 +808,7 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
if (u > 1) du = u - 1;
if (v < 0) dv = v;
if (v > 1) dv = v - 1;
- if (u > 0 && v > 0 && u + v > 1)
- {
+ if (u > 0 && v > 0 && u + v > 1) {
float t = u + v - 1;
du = u - t/2;
dv = v - t/2;
@@ -818,8 +817,7 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
mul_v3_fl(e1, du);
mul_v3_fl(e2, dv);
- if (dot_v3v3(e1, e1) + dot_v3v3(e2, e2) > threshold * threshold)
- {
+ if (dot_v3v3(e1, e1) + dot_v3v3(e2, e2) > threshold * threshold) {
return 0;
}
@@ -895,8 +893,7 @@ static int getLowestRoot(const float a, const float b, const float c, const floa
float determinant = b*b - 4.0f*a*c;
// If determinant is negative it means no solutions.
- if (determinant >= 0.0f)
- {
+ if (determinant >= 0.0f) {
// calculate the two roots: (if determinant == 0 then
// x1==x2 but lets disregard that slight optimization)
float sqrtD = (float)sqrt(determinant);
@@ -908,16 +905,14 @@ static int getLowestRoot(const float a, const float b, const float c, const floa
SWAP(float, r1, r2);
// Get lowest root:
- if (r1 > 0.0f && r1 < maxR)
- {
+ if (r1 > 0.0f && r1 < maxR) {
*root = r1;
return 1;
}
// It is possible that we want x2 - this can happen
// if x1 < 0
- if (r2 > 0.0f && r2 < maxR)
- {
+ if (r2 > 0.0f && r2 < maxR) {
*root = r2;
return 1;
}
@@ -951,8 +946,7 @@ int isect_sweeping_sphere_tri_v3(
a=dot_v3v3(p1,nor)-dot_v3v3(v0,nor);
nordotv=dot_v3v3(nor,vel);
- if (fabsf(nordotv) < 0.000001f)
- {
+ if (fabsf(nordotv) < 0.000001f) {
if(fabsf(a) >= radius) {
return 0;
}
@@ -992,8 +986,7 @@ int isect_sweeping_sphere_tri_v3(
z=x+y-(a*c-b*b);
- if(z <= 0.0f && (x >= 0.0f && y >= 0.0f))
- {
+ if (z <= 0.0f && (x >= 0.0f && y >= 0.0f)) {
//(((unsigned int)z)& ~(((unsigned int)x)|((unsigned int)y))) & 0x80000000) {
*r_lambda=t0;
copy_v3_v3(ipoint,point);
@@ -1012,8 +1005,7 @@ int isect_sweeping_sphere_tri_v3(
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
- if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
- {
+ if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
copy_v3_v3(ipoint,v0);
found_by_sweep=1;
}
@@ -1023,8 +1015,7 @@ int isect_sweeping_sphere_tri_v3(
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
- if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
- {
+ if (getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
copy_v3_v3(ipoint,v1);
found_by_sweep=1;
}
@@ -1034,8 +1025,7 @@ int isect_sweeping_sphere_tri_v3(
b=2.0f*dot_v3v3(vel,temp);
c=dot_v3v3(temp,temp)-radius2;
- if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
- {
+ if(getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
copy_v3_v3(ipoint,v2);
found_by_sweep=1;
}
@@ -1055,12 +1045,10 @@ int isect_sweeping_sphere_tri_v3(
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
- if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
- {
+ if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) {
e=(edotv*newLambda-edotbv)/elen2;
- if(e >= 0.0f && e <= 1.0f)
- {
+ if (e >= 0.0f && e <= 1.0f) {
*r_lambda = newLambda;
copy_v3_v3(ipoint,e1);
mul_v3_fl(ipoint,e);
@@ -1079,12 +1067,10 @@ int isect_sweeping_sphere_tri_v3(
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
- if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
- {
+ if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) {
e=(edotv*newLambda-edotbv)/elen2;
- if(e >= 0.0f && e <= 1.0f)
- {
+ if (e >= 0.0f && e <= 1.0f) {
*r_lambda = newLambda;
copy_v3_v3(ipoint,e2);
mul_v3_fl(ipoint,e);
@@ -1108,12 +1094,10 @@ int isect_sweeping_sphere_tri_v3(
b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
- if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
- {
+ if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) {
e=(edotv*newLambda-edotbv)/elen2;
- if(e >= 0.0f && e <= 1.0f)
- {
+ if (e >= 0.0f && e <= 1.0f) {
*r_lambda = newLambda;
copy_v3_v3(ipoint,e3);
mul_v3_fl(ipoint,e);
@@ -2543,8 +2527,7 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
if (lrot) unit_m3(lrot);
if (lscale) unit_m3(lscale);
/* do com for both clouds */
- if (pos && rpos && (list_size > 0)) /* paranoya check */
- {
+ if (pos && rpos && (list_size > 0)) { /* paranoya check */
/* do com for both clouds */
for(a=0; a<list_size; a++) {
if (weight) {
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index d61f4a8880e..4665b08b202 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -96,8 +96,7 @@ void RegisterBlendExtension(void)
// root is HKLM by default
lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
- if (lresult != ERROR_SUCCESS)
- {
+ if (lresult != ERROR_SUCCESS) {
// try HKCU on failure
usr_mode = TRUE;
lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
@@ -161,8 +160,7 @@ void RegisterBlendExtension(void)
RegCloseKey(root);
printf("success (%s)\n",usr_mode ? "user" : "system");
- if (!G.background)
- {
+ if (!G.background) {
sprintf(MBox,"File extension registered for %s.",usr_mode ? "the current user. To register for all users, run as an administrator" : "all users");
MessageBox(0,MBox,"Blender",MB_OK|MB_ICONINFORMATION);
}