diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-10-23 23:02:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-10-23 23:02:51 +0300 |
commit | fbca69c69afb370ddc5a0b52e10d9db61c025752 (patch) | |
tree | 8dde2bedbc44a98af31d06bf2fa80a1fb04432e7 /source/blender/editors/space_view3d/view3d_view.c | |
parent | 3a98426ed6d37a204b1d55834e0590dcb7990b47 (diff) |
BLI_math: add mat3_normalized_to_* functions
Many uses of matrices for rotation keep them normalized,
so no need to normalize each time.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_view.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index e3736d90232..5fc7b57739e 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -849,18 +849,10 @@ void view3d_winmatrix_set(ARegion *ar, const View3D *v3d, const rctf *rect) static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob) { - float bmat[4][4]; - float tmat[3][3]; - rv3d->view = RV3D_VIEW_USER; /* don't show the grid */ - - copy_m4_m4(bmat, ob->obmat); - normalize_m4(bmat); - invert_m4_m4(rv3d->viewmat, bmat); - - /* view quat calculation, needed for add object */ - copy_m3_m4(tmat, rv3d->viewmat); - mat3_to_quat(rv3d->viewquat, tmat); + mat4_to_quat(rv3d->viewquat, ob->obmat); + invert_qt_normalized(rv3d->viewquat); + quat_to_mat4(rv3d->viewmat, rv3d->viewquat); } static float view3d_quat_axis[6][4] = { |