diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-06-13 08:25:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-06-13 08:56:36 +0300 |
commit | ca10903299e7cff40674eac3943d03fd36d33a18 (patch) | |
tree | da9e6cc62cefd6880b4fdc6ad11d70cbdb34ee29 /source/blender/blenkernel | |
parent | 75aac463e795d7b8b5b19d55b5620618b176c211 (diff) |
Cleanup: use 'r_' prefix for return arguments
Also improve alignment.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_anim_path.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_path.c | 50 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve_deform.c | 30 |
3 files changed, 47 insertions, 43 deletions
diff --git a/source/blender/blenkernel/BKE_anim_path.h b/source/blender/blenkernel/BKE_anim_path.h index 15af144986f..b56e4a4a262 100644 --- a/source/blender/blenkernel/BKE_anim_path.h +++ b/source/blender/blenkernel/BKE_anim_path.h @@ -38,11 +38,11 @@ void free_path(struct Path *path); void calc_curvepath(struct Object *ob, struct ListBase *nurbs); bool where_on_path(struct Object *ob, float ctime, - float vec[4], - float dir[3], - float quat[4], - float *radius, - float *weight); + float r_vec[4], + float r_dir[3], + float r_quat[4], + float *r_radius, + float *r_weight); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/anim_path.c b/source/blender/blenkernel/intern/anim_path.c index 92b5bd345cf..56ff7d07809 100644 --- a/source/blender/blenkernel/intern/anim_path.c +++ b/source/blender/blenkernel/intern/anim_path.c @@ -205,11 +205,11 @@ static int interval_test(const int min, const int max, int p1, const int cycl) */ bool where_on_path(Object *ob, float ctime, - float vec[4], - float dir[3], - float quat[4], - float *radius, - float *weight) + float r_vec[4], + float r_dir[3], + float r_quat[4], + float *r_radius, + float *r_weight) { Curve *cu; Nurb *nu; @@ -274,10 +274,10 @@ bool where_on_path(Object *ob, key_curve_tangent_weights(1.0f - fac, data, KEY_BSPLINE); - interp_v3_v3v3v3v3(dir, p0->vec, p1->vec, p2->vec, p3->vec, data); + interp_v3_v3v3v3v3(r_dir, p0->vec, p1->vec, p2->vec, p3->vec, data); - /* make compatible with vectoquat */ - negate_v3(dir); + /* Make compatible with #vec_to_quat. */ + negate_v3(r_dir); //} nurbs = BKE_curve_editNurbs_get(cu); @@ -300,16 +300,16 @@ bool where_on_path(Object *ob, key_curve_position_weights(1.0f - fac, data, KEY_BSPLINE); } - vec[0] = data[0] * p0->vec[0] + data[1] * p1->vec[0] + data[2] * p2->vec[0] + - data[3] * p3->vec[0]; /* X */ - vec[1] = data[0] * p0->vec[1] + data[1] * p1->vec[1] + data[2] * p2->vec[1] + - data[3] * p3->vec[1]; /* Y */ - vec[2] = data[0] * p0->vec[2] + data[1] * p1->vec[2] + data[2] * p2->vec[2] + - data[3] * p3->vec[2]; /* Z */ - vec[3] = data[0] * p0->vec[3] + data[1] * p1->vec[3] + data[2] * p2->vec[3] + - data[3] * p3->vec[3]; /* Tilt, should not be needed since we have quat still used */ + r_vec[0] = /* X */ + data[0] * p0->vec[0] + data[1] * p1->vec[0] + data[2] * p2->vec[0] + data[3] * p3->vec[0]; + r_vec[1] = /* Y */ + data[0] * p0->vec[1] + data[1] * p1->vec[1] + data[2] * p2->vec[1] + data[3] * p3->vec[1]; + r_vec[2] = /* Z */ + data[0] * p0->vec[2] + data[1] * p1->vec[2] + data[2] * p2->vec[2] + data[3] * p3->vec[2]; + r_vec[3] = /* Tilt, should not be needed since we have quat still used */ + data[0] * p0->vec[3] + data[1] * p1->vec[3] + data[2] * p2->vec[3] + data[3] * p3->vec[3]; - if (quat) { + if (r_quat) { float totfac, q1[4], q2[4]; totfac = data[0] + data[3]; @@ -330,21 +330,21 @@ bool where_on_path(Object *ob, totfac = data[0] + data[1] + data[2] + data[3]; if (totfac > FLT_EPSILON) { - interp_qt_qtqt(quat, q1, q2, (data[1] + data[2]) / totfac); + interp_qt_qtqt(r_quat, q1, q2, (data[1] + data[2]) / totfac); } else { - copy_qt_qt(quat, q2); + copy_qt_qt(r_quat, q2); } } - if (radius) { - *radius = data[0] * p0->radius + data[1] * p1->radius + data[2] * p2->radius + - data[3] * p3->radius; + if (r_radius) { + *r_radius = data[0] * p0->radius + data[1] * p1->radius + data[2] * p2->radius + + data[3] * p3->radius; } - if (weight) { - *weight = data[0] * p0->weight + data[1] * p1->weight + data[2] * p2->weight + - data[3] * p3->weight; + if (r_weight) { + *r_weight = data[0] * p0->weight + data[1] * p1->weight + data[2] * p2->weight + + data[3] * p3->weight; } return true; diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c index d2653ff477b..2c3b99308d0 100644 --- a/source/blender/blenkernel/intern/curve_deform.c +++ b/source/blender/blenkernel/intern/curve_deform.c @@ -71,8 +71,12 @@ static void init_curve_deform(Object *ob_curve, Object *ob_target, CurveDeform * * * \return Success. */ -static bool where_on_path_deform( - Object *ob_curve, float ctime, float vec[4], float dir[3], float quat[4], float *radius) +static bool where_on_path_deform(Object *ob_curve, + float ctime, + float r_vec[4], + float r_dir[3], + float r_quat[4], + float *r_radius) { BevList *bl; float ctime1; @@ -95,7 +99,7 @@ static bool where_on_path_deform( } /* vec needs 4 items */ - if (where_on_path(ob_curve, ctime1, vec, dir, quat, radius, NULL)) { + if (where_on_path(ob_curve, ctime1, r_vec, r_dir, r_quat, r_radius, NULL)) { if (cycl == 0) { Path *path = ob_curve->runtime.curve_cache->path; @@ -104,23 +108,23 @@ static bool where_on_path_deform( if (ctime < 0.0f) { sub_v3_v3v3(dvec, path->data[1].vec, path->data[0].vec); mul_v3_fl(dvec, ctime * (float)path->len); - add_v3_v3(vec, dvec); - if (quat) { - copy_qt_qt(quat, path->data[0].quat); + add_v3_v3(r_vec, dvec); + if (r_quat) { + copy_qt_qt(r_quat, path->data[0].quat); } - if (radius) { - *radius = path->data[0].radius; + if (r_radius) { + *r_radius = path->data[0].radius; } } else if (ctime > 1.0f) { sub_v3_v3v3(dvec, path->data[path->len - 1].vec, path->data[path->len - 2].vec); mul_v3_fl(dvec, (ctime - 1.0f) * (float)path->len); - add_v3_v3(vec, dvec); - if (quat) { - copy_qt_qt(quat, path->data[path->len - 1].quat); + add_v3_v3(r_vec, dvec); + if (r_quat) { + copy_qt_qt(r_quat, path->data[path->len - 1].quat); } - if (radius) { - *radius = path->data[path->len - 1].radius; + if (r_radius) { + *r_radius = path->data[path->len - 1].radius; } /* weight - not used but could be added */ } |