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 /source/blender/blenkernel | |
parent | 150cedac5da7bfce5fdd7c621cb682d6f3e66c8b (diff) |
code cleanup: use float vector size in function definitions, and const's where the values are unchanged.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_armature.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_brush.h | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_mball.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sketch.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 17 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mball.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sketch.c | 14 |
16 files changed, 56 insertions, 52 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]; |