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/editors | |
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/editors')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 2 | ||||
-rw-r--r-- | source/blender/editors/include/BIF_glutil.h | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 10 | ||||
-rw-r--r-- | source/blender/editors/screen/glutil.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 6 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_utils.c | 19 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 6 |
12 files changed, 32 insertions, 29 deletions
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); } } |