From 0547a7753643f45861306542857d97215ecb2c4f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 14 Sep 2019 08:10:50 +1000 Subject: Cleanup: use const args, variables --- source/blender/blenkernel/intern/armature.c | 6 +++--- source/blender/blenkernel/intern/collision.c | 14 +++++++------- source/blender/blenkernel/intern/constraint.c | 6 +++--- source/blender/blenkernel/intern/gpencil.c | 4 ++-- source/blender/blenkernel/intern/multires.c | 2 +- source/blender/blenkernel/intern/object_dupli.c | 11 +++++++---- source/blender/blenkernel/intern/particle_child.c | 4 ++-- source/blender/blenkernel/intern/particle_system.c | 4 ++-- source/blender/blenkernel/intern/softbody.c | 10 +++++----- source/blender/blenkernel/intern/studiolight.c | 4 ++-- 10 files changed, 34 insertions(+), 31 deletions(-) (limited to 'source/blender/blenkernel/intern') diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index c31d1a77404..d74c8e6d258 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1005,9 +1005,9 @@ void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, } static void make_bbone_spline_matrix(BBoneSplineParameters *param, - float scalemats[2][4][4], - float pos[3], - float axis[3], + const float scalemats[2][4][4], + const float pos[3], + const float axis[3], float roll, float scalex, float scaley, diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 2c3b933af69..91d66e16dde 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -188,11 +188,11 @@ BLI_INLINE int next_ind(int i) } static float compute_collision_point(float a1[3], - float a2[3], - float a3[3], - float b1[3], - float b2[3], - float b3[3], + const float a2[3], + const float a3[3], + const float b1[3], + const float b2[3], + const float b3[3], bool culling, bool use_normal, float r_a[3], @@ -419,7 +419,7 @@ static float compute_collision_point(float a1[3], // w3 is not perfect static void collision_compute_barycentric( - float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3) + const float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3) { /* dot_v3v3 */ #define INPR(v1, v2) ((v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2]) @@ -1499,7 +1499,7 @@ BLI_INLINE bool cloth_point_face_collision_params(const float p1[3], } static CollPair *cloth_point_collpair(float p1[3], - float p2[3], + const float p2[3], const MVert *mverts, int bp1, int bp2, diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 9b32996aa96..d59849695ff 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2410,9 +2410,9 @@ static void armdef_get_tarmat(struct Depsgraph *UNUSED(depsgraph), } static void armdef_accumulate_matrix(float obmat[4][4], - float iobmat[4][4], - float basemat[4][4], - float bonemat[4][4], + const float iobmat[4][4], + const float basemat[4][4], + const float bonemat[4][4], float weight, float r_sum_mat[4][4], DualQuat *r_sum_dq) diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index a50926ae7ab..7a6189bbbc6 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -2645,7 +2645,7 @@ static int gpencil_check_same_material_color(Object *ob_gp, float color[4], Mate /* Helper: Add gpencil material using curve material as base. */ static Material *gpencil_add_from_curve_material(Main *bmain, Object *ob_gp, - float cu_color[4], + const float cu_color[4], const bool gpencil_lines, const bool fill, int *r_idx) @@ -2686,7 +2686,7 @@ static void gpencil_add_new_points(bGPDstroke *gps, float pressure, int init, int totpoints, - float init_co[3], + const float init_co[3], bool last) { for (int i = 0; i < totpoints; i++) { diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 43bc05ffdc0..8cf960a7f14 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -2348,7 +2348,7 @@ static void multires_apply_uniform_scale(Object *object, const float scale) static void multires_apply_smat(struct Depsgraph *UNUSED(depsgraph), Scene *scene, Object *object, - float smat[3][3]) + const float smat[3][3]) { const MultiresModifierData *mmd = get_multires_modifier(scene, object, true); if (mmd == NULL || mmd->totlvl == 0) { diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 8ffb99dd8ab..b9c4adafab2 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -93,8 +93,11 @@ typedef struct DupliGenerator { static const DupliGenerator *get_dupli_generator(const DupliContext *ctx); /* create initial context for root object */ -static void init_context( - DupliContext *r_ctx, Depsgraph *depsgraph, Scene *scene, Object *ob, float space_mat[4][4]) +static void init_context(DupliContext *r_ctx, + Depsgraph *depsgraph, + Scene *scene, + Object *ob, + const float space_mat[4][4]) { r_ctx->depsgraph = depsgraph; r_ctx->scene = scene; @@ -118,7 +121,7 @@ static void init_context( /* create sub-context for recursive duplis */ static void copy_dupli_context( - DupliContext *r_ctx, const DupliContext *ctx, Object *ob, float mat[4][4], int index) + DupliContext *r_ctx, const DupliContext *ctx, Object *ob, const float mat[4][4], int index) { *r_ctx = *ctx; @@ -204,7 +207,7 @@ static DupliObject *make_dupli(const DupliContext *ctx, Object *ob, float mat[4] */ static void make_recursive_duplis(const DupliContext *ctx, Object *ob, - float space_mat[4][4], + const float space_mat[4][4], int index) { /* simple preventing of too deep nested collections with MAX_DUPLI_RECUR */ diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index 888ec753c54..dcd2a0b8fae 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -657,7 +657,7 @@ float do_clump(ParticleKey *state, } static void do_rough(const float loc[3], - float mat[4][4], + const float mat[4][4], float t, float fac, float size, @@ -701,7 +701,7 @@ static void do_rough_end( } static void do_rough_curve(const float loc[3], - float mat[4][4], + const float mat[4][4], float time, float fac, float size, diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 2655382021a..43484a57f1c 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1695,7 +1695,7 @@ typedef struct SPHRangeData { static void sph_evaluate_func(BVHTree *tree, ParticleSystem **psys, - float co[3], + const float co[3], SPHRangeData *pfr, float interaction_radius, BVHTree_RangeQuery callback) @@ -2497,7 +2497,7 @@ static float collision_point_distance_with_normal( return 0; } static void collision_point_on_surface( - float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *co) + const float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *co) { collision_interpolate_element(pce, 0.f, fac, col); diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index d3b72fb295d..b56403dfb6d 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1049,8 +1049,8 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), /* +++ the face external section*/ static int sb_detect_face_pointCached(float face_v1[3], - float face_v2[3], - float face_v3[3], + const float face_v2[3], + const float face_v3[3], float *damp, float force[3], struct Object *vertexowner, @@ -1147,8 +1147,8 @@ static int sb_detect_face_pointCached(float face_v1[3], } static int sb_detect_face_collisionCached(float face_v1[3], - float face_v2[3], - float face_v3[3], + const float face_v2[3], + const float face_v3[3], float *damp, float force[3], struct Object *vertexowner, @@ -1326,7 +1326,7 @@ static void scan_for_ext_face_forces(Object *ob, float timenow) /* +++ the spring external section*/ static int sb_detect_edge_collisionCached(float edge_v1[3], - float edge_v2[3], + const float edge_v2[3], float *damp, float force[3], struct Object *vertexowner, diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index 9f45826d59e..ff92704e2d1 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -946,7 +946,7 @@ BLI_INLINE void studiolight_spherical_harmonics_eval(StudioLight *sl, /* This modify the radiance into irradiance. */ static void studiolight_spherical_harmonics_apply_band_factors(StudioLight *sl, float (*sh)[3]) { - static float sl_sh_band_factors[5] = { + static const float sl_sh_band_factors[5] = { 1.0f, 2.0f / 3.0f, 1.0f / 4.0f, @@ -1074,7 +1074,7 @@ static float wrapped_lighting(float NL, float w) static float blinn_specular(const float L[3], const float I[3], const float N[3], - float R[3], + const float R[3], float NL, float roughness, float wrap) -- cgit v1.2.3