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 11:02:20 +0300
commit70d7805fa901d9678db3557f6e81877b6b94128a (patch)
tree327bf818ee5ef37ad9aa36da5f1dfcfe48159f16 /source/blender/editors/space_view3d
parentba6ed0105814764f23bb00b98c33a0b76fde31b1 (diff)
Cleanup: pass const matrices
Also order return matrices last.
Diffstat (limited to 'source/blender/editors/space_view3d')
-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
4 files changed, 41 insertions, 34 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index cc5f7deb418..c062a8de361 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;