diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-28 18:05:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-28 18:05:00 +0400 |
commit | ed04c213745362fcab99cdda89343aca7cbb65e5 (patch) | |
tree | e1a6819df36bca9a884104882a2d146da1ba4c89 | |
parent | 150cedac5da7bfce5fdd7c621cb682d6f3e66c8b (diff) |
code cleanup: use float vector size in function definitions, and const's where the values are unchanged.
34 files changed, 116 insertions, 103 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index e94ad6ecfac..441d63be764 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -97,16 +97,16 @@ void where_is_pose_bone_tail(struct bPoseChannel *pchan); /* get_objectspace_bone_matrix has to be removed still */ void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed); -void vec_roll_to_mat3(float *vec, float roll, float mat[][3]); +void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]); void mat3_to_vec_roll(float mat[][3], float *vec, float *roll); int get_selected_defgroups(struct Object *ob, char *defbase_sel, int defbase_len); /* Common Conversions Between Co-ordinate Spaces */ void armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]); -void armature_loc_world_to_pose(struct Object *ob, float *inloc, float *outloc); +void armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]); void armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); -void armature_loc_pose_to_bone(struct bPoseChannel *pchan, float *inloc, float *outloc); +void armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc[3], float outloc[3]); void armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]); diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index f5cd2635ff7..0be0d4b40cc 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -60,7 +60,7 @@ int brush_clone_image_delete(struct Brush *brush); /* jitter */ void brush_jitter_pos(const struct Scene *scene, struct Brush *brush, - float *pos, float *jitterpos); + const float pos[2], float jitterpos[2]); /* brush curve */ void brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset); @@ -75,13 +75,13 @@ void brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, /* painting */ struct BrushPainter; typedef struct BrushPainter BrushPainter; -typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, float *lastpos, float *pos); +typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, const float lastpos[2], const float pos[2]); BrushPainter *brush_painter_new(struct Scene *scene, struct Brush *brush); void brush_painter_require_imbuf(BrushPainter *painter, short flt, - short texonly, int size); -int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, - double time, float pressure, void *user, int use_color_correction); + short texonly, int size); +int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2], + double time, float pressure, void *user, int use_color_correction); void brush_painter_break_stroke(BrushPainter *painter); void brush_painter_free(BrushPainter *painter); diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 0bfbec9f1b9..fafd2a3d30e 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -166,7 +166,7 @@ struct Object *find_basis_mball(struct Scene *scene, struct Object *ob); int is_basis_mball(struct Object *ob); int is_mball_basis_for(struct Object *ob1, struct Object *ob2); void metaball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase); -void calc_mballco(struct MetaElem *ml, float *vec); +void calc_mballco(struct MetaElem *ml, float vec[3]); float densfunc(struct MetaElem *ball, float x, float y, float z); float metaball(float x, float y, float z); void accum_mballfaces(int i1, int i2, int i3, int i4); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index dd35103298f..016cef60dcc 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -136,7 +136,7 @@ void mesh_calc_normals_tessface(struct MVert *mverts, int numVerts,struct MFace const char *mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh); struct BoundBox *mesh_get_bb(struct Object *ob); -void mesh_get_texspace(struct Mesh *me, float *loc_r, float *rot_r, float *size_r); +void mesh_get_texspace(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]); /* if old, it converts mface->edcode to edge drawflags */ void make_edges(struct Mesh *me, int old); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index ac703663864..69ce590b3ef 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -104,11 +104,11 @@ void where_is_object_mat(struct Scene *scene, struct Object *ob, float obmat[4][ struct BoundBox *unit_boundbox(void); void boundbox_set_from_min_max(struct BoundBox *bb, float min[3], float max[3]); struct BoundBox *object_get_boundbox(struct Object *ob); -void object_get_dimensions(struct Object *ob, float *value); +void object_get_dimensions(struct Object *ob, float vec[3]); void object_set_dimensions(struct Object *ob, const float *value); void object_boundbox_flag(struct Object *ob, int flag, int set); void minmax_object(struct Object *ob, float min[3], float max[3]); -int minmax_object_duplis(struct Scene *scene, struct Object *ob, float *min, float *max); +int minmax_object_duplis(struct Scene *scene, struct Object *ob, float min[3], float max[3]); /* sometimes min-max isnt enough, we need to loop over each point */ void BKE_object_foreach_display_point( diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index c03ecca17cf..4407be4c8be 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -319,7 +319,7 @@ void psys_free_particles(struct ParticleSystem *psys); void psys_free_children(struct ParticleSystem *psys); void psys_interpolate_particle(short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, int velocity); -void psys_vec_rot_to_face(struct DerivedMesh *dm, struct ParticleData *pa, float *vec); +void psys_vec_rot_to_face(struct DerivedMesh *dm, struct ParticleData *pa, float vec[3]); void psys_mat_hair_to_object(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]); void psys_mat_hair_to_global(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]); void psys_mat_hair_to_orco(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]); diff --git a/source/blender/blenkernel/BKE_sketch.h b/source/blender/blenkernel/BKE_sketch.h index 76b3dbacf7f..9cdf9a8fb62 100644 --- a/source/blender/blenkernel/BKE_sketch.h +++ b/source/blender/blenkernel/BKE_sketch.h @@ -142,7 +142,7 @@ void sk_reverseStroke(SK_Stroke *stk); void sk_filterLastContinuousStroke(SK_Stroke *stk); void sk_filterStroke(SK_Stroke *stk, int start, int end); -void sk_initPoint(SK_Point *pt, SK_DrawData *dd, float *no); +void sk_initPoint(SK_Point *pt, SK_DrawData *dd, const float no[3]); void sk_copyPoint(SK_Point *dst, SK_Point *src); int sk_stroke_filtermval(SK_DrawData *dd); diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index c9eb19c0f32..bc18332844b 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -642,7 +642,7 @@ static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info } } -static void b_bone_deform(bPoseChanDeform *pdef_info, Bone *bone, float *co, DualQuat *dq, float defmat[][3]) +static void b_bone_deform(bPoseChanDeform *pdef_info, Bone *bone, float co[3], DualQuat *dq, float defmat[][3]) { Mat4 *b_bone = pdef_info->b_bone_mats; float (*mat)[4] = b_bone[0].mat; @@ -666,8 +666,9 @@ static void b_bone_deform(bPoseChanDeform *pdef_info, Bone *bone, float *co, Dua else { mul_m4_v3(b_bone[a+1].mat, co); - if (defmat) + if (defmat) { copy_m3_m4(defmat, b_bone[a+1].mat); + } } } @@ -736,7 +737,7 @@ static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonem add_m3_m3m3(mat, mat, wmat); } -static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float *vec, DualQuat *dq, +static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float vec[3], DualQuat *dq, float mat[][3], float *co) { Bone *bone = pchan->bone; @@ -783,7 +784,7 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f return contrib; } -static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float weight, float *vec, DualQuat *dq, +static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float weight, float vec[3], DualQuat *dq, float mat[][3], float *co, float *contrib) { float cop[3], bbonemat[3][3]; @@ -1116,7 +1117,7 @@ void armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4]) /* Convert Wolrd-Space Location to Pose-Space Location * NOTE: this cannot be used to convert to pose-space location of the supplied * pose-channel into its local space (i.e. 'visual'-keyframing) */ -void armature_loc_world_to_pose(Object *ob, float *inloc, float *outloc) +void armature_loc_world_to_pose(Object *ob, const float inloc[3], float outloc[3]) { float xLocMat[4][4] = MAT4_UNITY; float nLocMat[4][4]; @@ -1338,7 +1339,7 @@ void armature_mat_bone_to_pose(bPoseChannel *pchan, float inmat[][4], float outm /* Convert Pose-Space Location to Bone-Space Location * NOTE: this cannot be used to convert to pose-space location of the supplied * pose-channel into its local space (i.e. 'visual'-keyframing) */ -void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc) +void armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], float outloc[3]) { float xLocMat[4][4] = MAT4_UNITY; float nLocMat[4][4]; @@ -1478,7 +1479,7 @@ void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], floa * *************************************************************************** */ /* Computes vector and roll based on a rotation. * "mat" must contain only a rotation, and no scaling. */ -void mat3_to_vec_roll(float mat[][3], float *vec, float *roll) +void mat3_to_vec_roll(float mat[][3], float vec[3], float *roll) { if (vec) copy_v3_v3(vec, mat[1]); @@ -1496,7 +1497,7 @@ void mat3_to_vec_roll(float mat[][3], float *vec, float *roll) /* Calculates the rest matrix of a bone based * On its vector and a roll around that vector */ -void vec_roll_to_mat3(float *vec, float roll, float mat[][3]) +void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]) { float nor[3], axis[3], target[3] = {0, 1, 0}; float theta; diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index f5c39f3e30c..9e706c48430 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -833,7 +833,9 @@ void brush_painter_free(BrushPainter *painter) MEM_freeN(painter); } -static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, int x, int y, int w, int h, int xt, int yt, float *pos) +static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, + int x, int y, int w, int h, int xt, int yt, + const float pos[2]) { Scene *scene= painter->scene; Brush *brush= painter->brush; @@ -923,7 +925,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i } } -static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float *pos) +static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const float pos[2]) { const Scene *scene= painter->scene; Brush *brush= painter->brush; @@ -978,7 +980,7 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float brush_painter_do_partial(painter, NULL, x1, y2, x2, ibuf->y, 0, 0, pos); } -static void brush_painter_refresh_cache(BrushPainter *painter, float *pos, int use_color_correction) +static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2], int use_color_correction) { const Scene *scene= painter->scene; Brush *brush= painter->brush; @@ -1042,7 +1044,7 @@ static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pres brush->spacing = MAX2(1.0f, painter->startspacing*(1.5f-pressure)); } -void brush_jitter_pos(const Scene *scene, Brush *brush, float pos[2], float jitterpos[2]) +void brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2]) { int use_jitter= brush->jitter != 0; @@ -1069,7 +1071,8 @@ void brush_jitter_pos(const Scene *scene, Brush *brush, float pos[2], float jitt } } -int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user, int use_color_correction) +int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2], double time, float pressure, + void *user, int use_color_correction) { Scene *scene= painter->scene; Brush *brush= painter->brush; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 6536dfb529e..931934f8052 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -66,9 +66,9 @@ /* globals */ /* local */ -static int cu_isectLL(float *v1, float *v2, float *v3, float *v4, +static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], const float v4[3], short cox, short coy, - float *labda, float *mu, float *vec); + float *labda, float *mu, float vec[3]); void unlink_curve(Curve *cu) { @@ -1500,7 +1500,9 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender) } } -static int cu_isectLL(float *v1, float *v2, float *v3, float *v4, short cox, short coy, float *labda, float *mu, float *vec) +static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], const float v4[3], + short cox, short coy, + float *labda, float *mu, float vec[3]) { /* return: -1: colliniar diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 5feeb4c300d..fa20db0fe72 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1687,7 +1687,7 @@ static float evaluate_driver (ChannelDriver *driver, const float evaltime) * than the horizontal distance between (v1-v4). * This is to prevent curve loops. */ -void correct_bezpart (float *v1, float *v2, float *v3, float *v4) +void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]) { float h1[2], h2[2], len1, len2, len, fac; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 7c0fded5140..52e9dcaa578 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -522,7 +522,7 @@ Object *find_basis_mball(Scene *scene, Object *basis) /* **************** POLYGONIZATION ************************ */ -void calc_mballco(MetaElem *ml, float *vec) +void calc_mballco(MetaElem *ml, float vec[3]) { if (ml->mat) { mul_m4_v3((float ( * )[4])ml->mat, vec); diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 6f63276f7e4..f32851e4ba4 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -683,15 +683,15 @@ BoundBox *mesh_get_bb(Object *ob) return me->bb; } -void mesh_get_texspace(Mesh *me, float *loc_r, float *rot_r, float *size_r) +void mesh_get_texspace(Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]) { if (!me->bb) { tex_space_mesh(me); } - if (loc_r) copy_v3_v3(loc_r, me->loc); - if (rot_r) copy_v3_v3(rot_r, me->rot); - if (size_r) copy_v3_v3(size_r, me->size); + if (r_loc) copy_v3_v3(r_loc, me->loc); + if (r_rot) copy_v3_v3(r_rot, me->rot); + if (r_size) copy_v3_v3(r_size, me->size); } float *get_mesh_orco_verts(Object *ob) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index cd59b74243b..37fb8b4a550 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1711,7 +1711,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4]) add_v3_v3(mat[3], vec); } -static void give_parvert(Object *par, int nr, float *vec) +static void give_parvert(Object *par, int nr, float vec[3]) { BMEditMesh *em; int a, count; @@ -2171,7 +2171,7 @@ void object_boundbox_flag(Object *ob, int flag, int set) } } -void object_get_dimensions(Object *ob, float *value) +void object_get_dimensions(Object *ob, float vec[3]) { BoundBox *bb = NULL; @@ -2181,11 +2181,11 @@ void object_get_dimensions(Object *ob, float *value) mat4_to_size( scale,ob->obmat); - value[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); - value[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); - value[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); + vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); + vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); + vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); } else { - value[0] = value[1] = value[2] = 0.f; + vec[0] = vec[1] = vec[2] = 0.f; } } @@ -2292,7 +2292,7 @@ void minmax_object(Object *ob, float min[3], float max[3]) } } -int minmax_object_duplis(Scene *scene, Object *ob, float *min, float *max) +int minmax_object_duplis(Scene *scene, Object *ob, float min[3], float max[3]) { int ok= 0; if ((ob->transflag & OB_DUPLI)==0) { diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index fc20ae8d636..2e91d76cf21 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3411,7 +3411,7 @@ void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData copy_v3_v3(hairmat[3],orco); } -void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float *vec) +void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float vec[3]) { float mat[4][4]; diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c index faf382f9ffc..7134f5ac8c1 100644 --- a/source/blender/blenkernel/intern/sketch.c +++ b/source/blender/blenkernel/intern/sketch.c @@ -71,17 +71,15 @@ SK_Sketch* createSketch(void) return sketch; } -void sk_initPoint(SK_Point *pt, SK_DrawData *dd, float *no) +void sk_initPoint(SK_Point *pt, SK_DrawData *dd, const float no[3]) { - if (no) - { + if (no) { normalize_v3_v3(pt->no, no); } - else - { - pt->no[0] = 0; - pt->no[1] = 0; - pt->no[2] = 1; + else { + pt->no[0] = 0.0f; + pt->no[1] = 0.0f; + pt->no[2] = 1.0f; } pt->p2d[0] = dd->mval[0]; pt->p2d[1] = dd->mval[1]; diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 61e34b7cb75..b46f79fb2e6 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -214,8 +214,8 @@ void box_minmax_bounds_m4(float min[3], float max[3], /********************************** Mapping **********************************/ -void map_to_tube(float *u, float *v, const float x, const float y, const float z); -void map_to_sphere(float *u, float *v, const float x, const float y, const float z); +void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z); +void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z); /********************************** Normals **********************************/ diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c index 47c44629d65..6db21ec14a6 100644 --- a/source/blender/blenlib/intern/BLI_kdtree.c +++ b/source/blender/blenlib/intern/BLI_kdtree.c @@ -132,7 +132,7 @@ void BLI_kdtree_balance(KDTree *tree) tree->root= kdtree_balance(tree->nodes, tree->totnode, 0); } -static float squared_distance(float *v2, float *v1, float *UNUSED(n1), float *n2) +static float squared_distance(const float v2[3], const float v1[3], float *UNUSED(n1), float *n2) { float d[3], dist; @@ -143,8 +143,11 @@ static float squared_distance(float *v2, float *v1, float *UNUSED(n1), float *n2 dist = dot_v3v3(d, d); //if(n1 && n2 && (dot_v3v3(n1, n2) < 0.0f)) - if(n2 && (dot_v3v3(d, n2) < 0.0f)) + + /* can someone explain why this is done?*/ + if(n2 && (dot_v3v3(d, n2) < 0.0f)) { dist *= 10.0f; + } return dist; } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index f418b87f37e..f903072afb9 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2311,31 +2311,34 @@ void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], floa /********************************** Mapping **********************************/ -void map_to_tube(float *u, float *v, const float x, const float y, const float z) +void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z) { float len; - *v = (z + 1.0f) / 2.0f; + *r_v = (z + 1.0f) / 2.0f; - len= (float)sqrt(x*x+y*y); - if(len > 0.0f) - *u = (float)((1.0 - (atan2(x/len,y/len) / M_PI)) / 2.0); - else - *v = *u = 0.0f; /* to avoid un-initialized variables */ + len = sqrtf(x * x + y * y); + if(len > 0.0f) { + *r_u = (float)((1.0 - (atan2(x/len,y/len) / M_PI)) / 2.0); + } + else { + *r_v = *r_u = 0.0f; /* to avoid un-initialized variables */ + } } -void map_to_sphere(float *u, float *v, const float x, const float y, const float z) +void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z) { float len; - len= (float)sqrt(x*x+y*y+z*z); + len = sqrtf(x * x + y * y + z * z); if(len > 0.0f) { - if(x==0.0f && y==0.0f) *u= 0.0f; /* othwise domain error */ - else *u = (1.0f - atan2f(x,y) / (float)M_PI) / 2.0f; + if(x==0.0f && y==0.0f) *r_u= 0.0f; /* othwise domain error */ + else *r_u = (1.0f - atan2f(x,y) / (float)M_PI) / 2.0f; - *v = 1.0f - (float)saacos(z/len)/(float)M_PI; - } else { - *v = *u = 0.0f; /* to avoid un-initialized variables */ + *r_v = 1.0f - (float)saacos(z/len)/(float)M_PI; + } + else { + *r_v = *r_u = 0.0f; /* to avoid un-initialized variables */ } } diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 6337e30a54b..38bc4794135 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -80,7 +80,7 @@ void mul_qt_qtqt(float *q, const float *q1, const float *q2) } /* Assumes a unit quaternion */ -void mul_qt_v3(const float *q, float *v) +void mul_qt_v3(const float q[4], float v[3]) { float t0, t1, t2; @@ -98,7 +98,7 @@ void mul_qt_v3(const float *q, float *v) v[1]=t2; } -void conjugate_qt(float *q) +void conjugate_qt(float q[4]) { q[1] = -q[1]; q[2] = -q[2]; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 1e25d74cfb6..b828ae052f8 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -303,7 +303,7 @@ static void mergepolysSimp(PolyFill *pf1, PolyFill *pf2) /* add pf2 to pf1 */ pf1->f= (pf1->f | pf2->f); } -static short testedgeside(float *v1, float *v2, float *v3) +static short testedgeside(const float v1[3], const float v2[3], const float v3[3]) /* is v3 to the right of v1-v2 ? With exception: v3==v1 || v3==v2 */ { float inp; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index cf59e9fcd35..e05f61de9dd 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1505,7 +1505,7 @@ static void rotateflagNurb(ListBase *editnurb, short flag, float *cent, float ro } } -static void translateflagNurb(ListBase *editnurb, short flag, float *vec) +static void translateflagNurb(ListBase *editnurb, short flag, const float vec[3]) { /* all verts with ('flag' & flag) translate */ Nurb *nu; diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 99572345c96..8d2454ffac4 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -187,7 +187,7 @@ static int gpencil_project_check (tGPsdata *p) /* Utilities --------------------------------- */ /* get the reference point for stroke-point conversions */ -static void gp_get_3d_reference (tGPsdata *p, float *vec) +static void gp_get_3d_reference (tGPsdata *p, float vec[3]) { View3D *v3d= p->sa->spacedata.first; float *fp= give_cursor(p->scene, v3d); diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index 0f8c70977be..b5dbf906d84 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -197,9 +197,9 @@ void gla2DSetMap(gla2DDrawInfo *di, struct rctf *rect); void bglBegin(int mode); void bglEnd(void); int bglPointHack(void); -void bglVertex3fv(float *vec); +void bglVertex3fv(const float vec[3]); void bglVertex3f(float x, float y, float z); -void bglVertex2fv(float *vec); +void bglVertex2fv(const float vec[2]); /* intel gfx cards frontbuffer problem */ void bglFlush(void); void set_inverted_drawing(int enable); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 37eda55fc88..d64014a702b 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -221,7 +221,7 @@ int ED_view3d_viewplane_get(struct View3D *v3d, struct RegionView3D *rv3d, int w void ED_view3d_ob_project_mat_get(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void ED_view3d_project_float(const struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]); void ED_view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, struct rctf *viewborder_r, short no_shift); -void ED_view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]); +void ED_view3d_project_float_v3(struct ARegion *a, const float vec[3], float *adr, float mat[4][4]); void ED_view3d_calc_camera_border_size(struct Scene *scene, struct ARegion *ar, struct View3D *v3d, struct RegionView3D *rv3d, float size_r[2]); /* drawobject.c iterators */ diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 3eb8aba7334..4d2a1b69293 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1870,22 +1870,22 @@ void UI_view2d_listview_visible_cells(View2D *v2d, short columnwidth, short rowh * - x,y = coordinates to convert * - viewx,viewy = resultant coordinates */ -void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *viewx, float *viewy) +void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *r_viewx, float *r_viewy) { float div, ofs; - if (viewx) { + if (r_viewx) { div= (float)(v2d->mask.xmax - v2d->mask.xmin); ofs= (float)v2d->mask.xmin; - *viewx= v2d->cur.xmin + (v2d->cur.xmax-v2d->cur.xmin) * ((float)x - ofs) / div; + *r_viewx= v2d->cur.xmin + (v2d->cur.xmax-v2d->cur.xmin) * ((float)x - ofs) / div; } - if (viewy) { + if (r_viewy) { div= (float)(v2d->mask.ymax - v2d->mask.ymin); ofs= (float)v2d->mask.ymin; - *viewy= v2d->cur.ymin + (v2d->cur.ymax - v2d->cur.ymin) * ((float)y - ofs) / div; + *r_viewy= v2d->cur.ymin + (v2d->cur.ymax - v2d->cur.ymin) * ((float)y - ofs) / div; } } diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 0b231ee7b96..235c5da08c3 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -790,7 +790,7 @@ int bglPointHack(void) return 0; } -void bglVertex3fv(float *vec) +void bglVertex3fv(const float vec[3]) { switch(curmode) { case GL_POINTS: @@ -816,7 +816,7 @@ void bglVertex3f(float x, float y, float z) } } -void bglVertex2fv(float *vec) +void bglVertex2fv(const float vec[2]) { switch(curmode) { case GL_POINTS: diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 75e8c5860cd..6f1da1895e9 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4014,7 +4014,7 @@ static void *do_projectpaint_thread(void *ph_v) return NULL; } -static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, float *pos) +static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), const float lastpos[2], const float pos[2]) { /* First unpack args from the struct */ ProjPaintState *ps = (ProjPaintState *)state; @@ -4359,7 +4359,7 @@ static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos) return clonebuf; } -static void imapaint_convert_brushco(ImBuf *ibufb, float *pos, int *ipos) +static void imapaint_convert_brushco(ImBuf *ibufb, const float pos[2], int ipos[2]) { ipos[0]= (int)floorf((pos[0] - ibufb->x/2) + 1.0f); ipos[1]= (int)floorf((pos[1] - ibufb->y/2) + 1.0f); @@ -4367,7 +4367,7 @@ static void imapaint_convert_brushco(ImBuf *ibufb, float *pos, int *ipos) /* dosnt run for projection painting * only the old style painting in the 3d view */ -static int imapaint_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *pos) +static int imapaint_paint_op(void *state, ImBuf *ibufb, const float lastpos[2], const float pos[2]) { ImagePaintState *s= ((ImagePaintState*)state); ImBuf *clonebuf= NULL, *frombuf; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 70293765813..0d9c0f2e38e 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -194,28 +194,30 @@ float paint_get_tex_pixel(Brush* br, float u, float v) /* 3D Paint */ -static void imapaint_project(Object *ob, float *model, float *proj, float *co, float *pco) +static void imapaint_project(Object *ob, float model[][4], float proj[][4], const float co[3], float pco[4]) { copy_v3_v3(pco, co); pco[3]= 1.0f; mul_m4_v3(ob->obmat, pco); - mul_m4_v3((float(*)[4])model, pco); - mul_m4_v4((float(*)[4])proj, pco); + mul_m4_v3(model, pco); + mul_m4_v4(proj, pco); } -static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, float *co, float *w) +static void imapaint_tri_weights(Object *ob, + const float v1[3], const float v2[3], const float v3[3], + const float co[3], float w[3]) { float pv1[4], pv2[4], pv3[4], h[3], divw; - float model[16], proj[16], wmat[3][3], invwmat[3][3]; + float model[4][4], proj[4][4], wmat[3][3], invwmat[3][3]; GLint view[4]; /* compute barycentric coordinates */ /* get the needed opengl matrices */ glGetIntegerv(GL_VIEWPORT, view); - glGetFloatv(GL_MODELVIEW_MATRIX, model); - glGetFloatv(GL_PROJECTION_MATRIX, proj); + glGetFloatv(GL_MODELVIEW_MATRIX, (float *)model); + glGetFloatv(GL_PROJECTION_MATRIX, (float *)proj); view[0] = view[1] = 0; /* project the verts */ @@ -242,8 +244,9 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl /* w is still divided by perspdiv, make it sum to one */ divw= w[0] + w[1] + w[2]; - if(divw != 0.0f) + if(divw != 0.0f) { mul_v3_fl(w, 1.0f/divw); + } } /* compute uv coordinates of mouse in face */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 8b224cea29d..8d91962594f 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -371,7 +371,7 @@ typedef struct ViewOpsData { #define TRACKBALLSIZE (1.1) -static void calctrackballvec(rcti *rect, int mx, int my, float *vec) +static void calctrackballvec(rcti *rect, int mx, int my, float vec[3]) { float x, y, radius, d, z, t; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 9a7da7c177d..847bd2e0b24 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -790,7 +790,7 @@ void ED_view3d_project_float(const ARegion *ar, const float vec[3], float adr[2] } /* use view3d_get_object_project_mat to get projecting mat */ -void ED_view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4]) +void ED_view3d_project_float_v3(ARegion *ar, const float vec[3], float *adr, float mat[4][4]) { float vec4[4]; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index c9cb6c79066..f8782f47ad2 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -124,7 +124,7 @@ void setTransformViewMatrices(TransInfo *t) calculateCenter2D(t); } -static void convertViewVec2D(View2D *v2d, float *vec, int dx, int dy) +static void convertViewVec2D(View2D *v2d, float vec[3], int dx, int dy) { float divx, divy; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index d08c7f65e2d..b36670bafa5 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -656,15 +656,15 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3]) sub_v3_v3v3(vec, point, t->tsnap.snapTarget); } -static void ApplySnapRotation(TransInfo *t, float *vec) +static void ApplySnapRotation(TransInfo *t, float *value) { if (t->tsnap.target == SCE_SNAP_TARGET_CLOSEST) { - *vec = t->tsnap.dist; + *value = t->tsnap.dist; } else { float point[3]; getSnapPoint(t, point); - *vec = RotationBetween(t, t->tsnap.snapTarget, point); + *value = RotationBetween(t, t->tsnap.snapTarget, point); } } diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index cd0aff0a87b..361fe3326f5 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -142,7 +142,7 @@ static void Kx_Crossf(float *c, float *a, float *b) } -static void Kx_VecUpMat3(float *vec, float mat[][3], short axis) +static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis) { // Construct a camera matrix s.t. the specified axis |