Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-08-02 10:17:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-08-02 10:17:31 +0300
commita3a6b71a9d29d2936bb14eb95f5073d68601cf36 (patch)
tree5ee481bf2b189e3760caf7e95bb6f9129265482b /source/blender/editors
parent0e308b07a025d98955824267f0b769475d7061db (diff)
Cleanup: pass const matrices
Also order return matrices last.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/armature_utils.c14
-rw-r--r--source/blender/editors/include/ED_armature.h8
-rw-r--r--source/blender/editors/include/ED_view3d.h28
-rw-r--r--source/blender/editors/include/ED_view3d_offscreen.h8
-rw-r--r--source/blender/editors/object/object_add.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c28
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_project.c31
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c10
9 files changed, 77 insertions, 68 deletions
diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c
index b2e329deee7..04c1ec97841 100644
--- a/source/blender/editors/armature/armature_utils.c
+++ b/source/blender/editors/armature/armature_utils.c
@@ -229,7 +229,7 @@ EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const ui
return NULL;
}
-void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3])
+void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3])
{
float delta[3], roll;
@@ -246,20 +246,20 @@ void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3])
}
}
- vec_roll_to_mat3_normalized(delta, roll, mat);
+ vec_roll_to_mat3_normalized(delta, roll, r_mat);
}
-void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4])
+void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4])
{
float m3[3][3];
ED_armature_ebone_to_mat3(ebone, m3);
- copy_m4_m3(mat, m3);
- copy_v3_v3(mat[3], ebone->head);
+ copy_m4_m3(r_mat, m3);
+ copy_v3_v3(r_mat[3], ebone->head);
}
-void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3])
+void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3])
{
float vec[3], roll;
const float len = len_v3v3(ebone->head, ebone->tail);
@@ -270,7 +270,7 @@ void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3])
ebone->roll = roll;
}
-void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4])
+void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4])
{
float mat3[3][3];
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index d82c7126cf2..6749adb2ea0 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -225,10 +225,10 @@ void ED_armature_ebone_remove(struct bArmature *arm, EditBone *exBone);
bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child);
EditBone *ED_armature_ebone_find_shared_parent(EditBone *ebone_child[],
const unsigned int ebone_child_tot);
-void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]);
-void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]);
-void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]);
-void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]);
+void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3]);
+void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4]);
+void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3]);
+void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4]);
EditBone *ED_armature_ebone_find_name(const struct ListBase *edbo, const char *name);
EditBone *ED_armature_ebone_get_mirrored(const struct ListBase *edbo, EditBone *ebo);
void ED_armature_ebone_transform_mirror_update(struct bArmature *arm,
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index f44b099f42e..4060efbda92 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -135,13 +135,13 @@ bool ED_view3d_has_workbench_in_texture_color(const struct Scene *scene,
void ED_view3d_cursor3d_position(struct bContext *C,
const int mval[2],
const bool use_depth,
- float cursor_co[3]);
+ float r_cursor_co[3]);
void ED_view3d_cursor3d_position_rotation(struct bContext *C,
const int mval[2],
const bool use_depth,
enum eV3DCursorOrient orientation,
- float cursor_co[3],
- float cursor_quat[4]);
+ float r_cursor_co[3],
+ float r_cursor_quat[4]);
void ED_view3d_cursor3d_update(struct bContext *C,
const int mval[2],
const bool use_depth,
@@ -403,10 +403,10 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
const bool do_clip);
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d,
struct Object *ob,
- float pmat[4][4]);
+ float r_pmat[4][4]);
void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d,
- float obmat[4][4],
- float pmat[4][4]);
+ const float obmat[4][4],
+ float r_pmat[4][4]);
void ED_view3d_project(const struct ARegion *region, const float world[3], float r_region_co[3]);
bool ED_view3d_unproject(
@@ -460,7 +460,7 @@ void ED_view3d_clipping_calc(struct BoundBox *bb,
const struct ARegion *region,
const struct Object *ob,
const struct rcti *rect);
-void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]);
+void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4]);
bool ED_view3d_clipping_test(const struct RegionView3D *rv3d,
const float co[3],
const bool is_local);
@@ -601,8 +601,8 @@ void ED_view3d_draw_setup_view(const struct wmWindowManager *wm,
struct Scene *scene,
struct ARegion *region,
struct View3D *v3d,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
const struct rcti *rect);
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
@@ -613,11 +613,11 @@ void ED_view3d_update_viewmat(struct Depsgraph *depsgraph,
const struct Scene *scene,
struct View3D *v3d,
struct ARegion *region,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
const struct rcti *rect,
bool offscreen);
-bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float quat[4]);
+bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float r_quat[4]);
bool ED_view3d_quat_to_axis_view(const float viewquat[4],
const float epsilon,
char *r_view,
@@ -676,7 +676,9 @@ void ED_view3d_lock_clear(struct View3D *v3d);
#define VIEW3D_MARGIN 1.4f
#define VIEW3D_DIST_FALLBACK 1.0f
-float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float dist_fallback);
+float ED_view3d_offset_distance(const float mat[4][4],
+ const float ofs[3],
+ const float dist_fallback);
void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist);
bool ED_view3d_distance_set_from_location(struct RegionView3D *rv3d,
const float dist_co[3],
diff --git a/source/blender/editors/include/ED_view3d_offscreen.h b/source/blender/editors/include/ED_view3d_offscreen.h
index 11d1aed1e73..846f4d7eabb 100644
--- a/source/blender/editors/include/ED_view3d_offscreen.h
+++ b/source/blender/editors/include/ED_view3d_offscreen.h
@@ -49,8 +49,8 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
struct ARegion *region,
int winx,
int winy,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
bool is_image_render,
bool do_sky,
bool is_persp,
@@ -65,8 +65,8 @@ void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph,
int winx,
int winy,
unsigned int draw_flags,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
float clip_start,
float clip_end,
bool is_image_render,
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index f9e6c531b39..4270f1cbc72 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -255,13 +255,13 @@ void ED_object_base_init_transform_on_add(Object *object, const float loc[3], co
/* Uses context to figure out transform for primitive.
* Returns standard diameter. */
float ED_object_new_primitive_matrix(
- bContext *C, Object *obedit, const float loc[3], const float rot[3], float primmat[4][4])
+ bContext *C, Object *obedit, const float loc[3], const float rot[3], float r_primmat[4][4])
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3];
- unit_m4(primmat);
+ unit_m4(r_primmat);
eul_to_mat3(rmat, rot);
invert_m3(rmat);
@@ -270,13 +270,13 @@ float ED_object_new_primitive_matrix(
copy_m3_m4(mat, obedit->obmat);
mul_m3_m3m3(cmat, rmat, mat);
invert_m3_m3(imat, cmat);
- copy_m4_m3(primmat, imat);
+ copy_m4_m3(r_primmat, imat);
/* center */
- copy_v3_v3(primmat[3], loc);
- sub_v3_v3v3(primmat[3], primmat[3], obedit->obmat[3]);
+ copy_v3_v3(r_primmat[3], loc);
+ sub_v3_v3v3(r_primmat[3], r_primmat[3], obedit->obmat[3]);
invert_m3_m3(imat, mat);
- mul_m3_v3(imat, primmat[3]);
+ mul_m3_v3(imat, r_primmat[3]);
{
const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) :
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 411b18717bf..cf132a1a0c0 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -115,8 +115,8 @@ void ED_view3d_update_viewmat(Depsgraph *depsgraph,
const Scene *scene,
View3D *v3d,
ARegion *region,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
const rcti *rect,
bool offscreen)
{
@@ -197,8 +197,8 @@ static void view3d_main_region_setup_view(Depsgraph *depsgraph,
Scene *scene,
View3D *v3d,
ARegion *region,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
const rcti *rect)
{
RegionView3D *rv3d = region->regiondata;
@@ -214,8 +214,8 @@ static void view3d_main_region_setup_offscreen(Depsgraph *depsgraph,
const Scene *scene,
View3D *v3d,
ARegion *region,
- float viewmat[4][4],
- float winmat[4][4])
+ const float viewmat[4][4],
+ const float winmat[4][4])
{
RegionView3D *rv3d = region->regiondata;
ED_view3d_update_viewmat(depsgraph, scene, v3d, region, viewmat, winmat, NULL, true);
@@ -353,8 +353,8 @@ void ED_view3d_draw_setup_view(const wmWindowManager *wm,
Scene *scene,
ARegion *region,
View3D *v3d,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
const rcti *rect)
{
RegionView3D *rv3d = region->regiondata;
@@ -1640,7 +1640,7 @@ static void view3d_stereo3d_setup_offscreen(Depsgraph *depsgraph,
const Scene *scene,
View3D *v3d,
ARegion *region,
- float winmat[4][4],
+ const float winmat[4][4],
const char *viewname)
{
/* update the viewport matrices with the new camera */
@@ -1667,8 +1667,8 @@ void ED_view3d_draw_offscreen(Depsgraph *depsgraph,
ARegion *region,
int winx,
int winy,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
bool is_image_render,
bool do_sky,
bool UNUSED(is_persp),
@@ -1759,8 +1759,8 @@ void ED_view3d_draw_offscreen_simple(Depsgraph *depsgraph,
int winx,
int winy,
uint draw_flags,
- float viewmat[4][4],
- float winmat[4][4],
+ const float viewmat[4][4],
+ const float winmat[4][4],
float clip_start,
float clip_end,
bool is_image_render,
@@ -2406,7 +2406,7 @@ struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d)
copy_m4_m4(rv3dmat->viewinv, rv3d->viewinv);
copy_v4_v4(rv3dmat->viewcamtexcofac, rv3d->viewcamtexcofac);
rv3dmat->pixsize = rv3d->pixsize;
- return (void *)rv3dmat;
+ return rv3dmat;
}
void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat_pt)
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index bf02845058e..19aa9cb203b 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -4868,7 +4868,9 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
* Draw border or toggle off.
* \{ */
-static void calc_local_clipping(float clip_local[6][4], BoundBox *clipbb, float mat[4][4])
+static void calc_local_clipping(float clip_local[6][4],
+ const BoundBox *clipbb,
+ const float mat[4][4])
{
BoundBox clipbb_local;
float imat[4][4];
@@ -4883,7 +4885,7 @@ static void calc_local_clipping(float clip_local[6][4], BoundBox *clipbb, float
ED_view3d_clipping_calc_from_boundbox(clip_local, &clipbb_local, is_negative_m4(mat));
}
-void ED_view3d_clipping_local(RegionView3D *rv3d, float mat[4][4])
+void ED_view3d_clipping_local(RegionView3D *rv3d, const float mat[4][4])
{
if (rv3d->rflag & RV3D_CLIPPING) {
calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index f4ec9a22520..c10a88af146 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -303,12 +303,12 @@ eV3DProjStatus ED_view3d_project_float_object(const ARegion *region,
float ED_view3d_pixel_size(const RegionView3D *rv3d, const float co[3])
{
- return mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co) * rv3d->pixsize * U.pixelsize;
+ return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize * U.pixelsize;
}
float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[3])
{
- return mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co) * rv3d->pixsize;
+ return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize;
}
/**
@@ -316,7 +316,7 @@ float ED_view3d_pixel_size_no_ui_scale(const RegionView3D *rv3d, const float co[
*/
float ED_view3d_calc_zfac(const RegionView3D *rv3d, const float co[3], bool *r_flip)
{
- float zfac = mul_project_m4_v3_zfac((float(*)[4])rv3d->persmat, co);
+ float zfac = mul_project_m4_v3_zfac(rv3d->persmat, co);
if (r_flip) {
*r_flip = (zfac < 0.0f);
@@ -483,11 +483,11 @@ void ED_view3d_global_to_vector(const RegionView3D *rv3d, const float coord[3],
p1[3] = 1.0f;
copy_v3_v3(p2, p1);
p2[3] = 1.0f;
- mul_m4_v4((float(*)[4])rv3d->viewmat, p2);
+ mul_m4_v4(rv3d->viewmat, p2);
mul_v3_fl(p2, 2.0f);
- mul_m4_v4((float(*)[4])rv3d->viewinv, p2);
+ mul_m4_v4(rv3d->viewinv, p2);
sub_v3_v3v3(vec, p1, p2);
}
@@ -749,25 +749,26 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
return true;
}
-/* Utility functions for projection
- * ******************************** */
+/* -------------------------------------------------------------------- */
+/** \name Utility functions for projection
+ * \{ */
-void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, Object *ob, float pmat[4][4])
+void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, Object *ob, float r_pmat[4][4])
{
float vmat[4][4];
- mul_m4_m4m4(vmat, (float(*)[4])rv3d->viewmat, ob->obmat);
- mul_m4_m4m4(pmat, (float(*)[4])rv3d->winmat, vmat);
+ mul_m4_m4m4(vmat, rv3d->viewmat, ob->obmat);
+ mul_m4_m4m4(r_pmat, rv3d->winmat, vmat);
}
void ED_view3d_ob_project_mat_get_from_obmat(const RegionView3D *rv3d,
- float obmat[4][4],
- float pmat[4][4])
+ const float obmat[4][4],
+ float r_pmat[4][4])
{
float vmat[4][4];
- mul_m4_m4m4(vmat, (float(*)[4])rv3d->viewmat, obmat);
- mul_m4_m4m4(pmat, (float(*)[4])rv3d->winmat, vmat);
+ mul_m4_m4m4(vmat, rv3d->viewmat, obmat);
+ mul_m4_m4m4(r_pmat, rv3d->winmat, vmat);
}
/**
@@ -791,3 +792,5 @@ bool ED_view3d_unproject(
return GPU_matrix_unproject(region_co, rv3d->viewmat, rv3d->winmat, viewport, world);
}
+
+/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index bd2323f47f4..4e73a2be17e 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -335,7 +335,7 @@ void ED_view3d_clipping_calc(
*
* \{ */
-static bool view3d_boundbox_clip_m4(const BoundBox *bb, float persmatob[4][4])
+static bool view3d_boundbox_clip_m4(const BoundBox *bb, const float persmatob[4][4])
{
int a, flag = -1, fl;
@@ -1243,7 +1243,9 @@ float ED_view3d_radius_to_dist(const View3D *v3d,
* \param fallback_dist: The distance to use if the object is too near or in front of \a ofs.
* \returns A newly calculated distance or the fallback.
*/
-float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float fallback_dist)
+float ED_view3d_offset_distance(const float mat[4][4],
+ const float ofs[3],
+ const float fallback_dist)
{
float pos[4] = {0.0f, 0.0f, 0.0f, 1.0f};
float dir[4] = {0.0f, 0.0f, 1.0f, 0.0f};
@@ -1374,11 +1376,11 @@ static float view3d_quat_axis[6][4][4] = {
};
-bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float quat[4])
+bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float r_quat[4])
{
BLI_assert(view_axis_roll <= RV3D_VIEW_AXIS_ROLL_270);
if (RV3D_VIEW_IS_AXIS(view)) {
- copy_qt_qt(quat, view3d_quat_axis[view - RV3D_VIEW_FRONT][view_axis_roll]);
+ copy_qt_qt(r_quat, view3d_quat_axis[view - RV3D_VIEW_FRONT][view_axis_roll]);
return true;
}
return false;