diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-16 23:53:12 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-16 23:53:12 +0400 |
commit | 3311164b24da61f2967f96d0ee27508a7e2e0267 (patch) | |
tree | 0824417cf3d645f59d98b210c02a4c5ef6c05a48 /source/blender/editors/space_view3d | |
parent | 3c8ab559a5bd31fd38e9c5cf9da8505ca28f4887 (diff) |
Math lib: matrix multiplication order fix for two functions that were
inconsistent with similar functions & math notation:
mul_m4_m4m4(R, B, A) => mult_m4_m4m4(R, A, B)
mul_m3_m3m4(R, B, A) => mult_m3_m3m4(R, A, B)
For branch maintainers, it should be relatively simple to fix things manually,
it's also possible run this script after merging to do automatic replacement:
http://www.pasteall.org/27459/python
Diffstat (limited to 'source/blender/editors/space_view3d')
7 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index b3eba8652b0..273336b78f1 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4020,7 +4020,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) { float mat[4][4]; - mul_m4_m4m4(mat, psys->imat, ob->obmat); + mult_m4_m4m4(mat, ob->obmat, psys->imat); glMultMatrixf(mat); } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index c493e4af944..cac5d856652 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -204,8 +204,8 @@ ARegion *ED_view3d_context_region_unlock(bContext *C) void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d) { /* local viewmat and persmat, to calculate projections */ - mul_m4_m4m4(rv3d->viewmatob, ob->obmat, rv3d->viewmat); - mul_m4_m4m4(rv3d->persmatob, ob->obmat, rv3d->persmat); + mult_m4_m4m4(rv3d->viewmatob, rv3d->viewmat, ob->obmat); + mult_m4_m4m4(rv3d->persmatob, rv3d->persmat, ob->obmat); /* initializes object space clipping, speeds up clip tests */ ED_view3d_local_clipping(rv3d, ob->obmat); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 3f979787a1f..80b7522d1a3 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1993,7 +1993,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */ setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */ - mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat); + mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); invert_m4_m4(rv3d->persinv, rv3d->persmat); invert_m4_m4(rv3d->viewinv, rv3d->viewmat); @@ -2028,7 +2028,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *)) setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */ setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */ - mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat); + mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); invert_m4_m4(rv3d->persinv, rv3d->persmat); invert_m4_m4(rv3d->viewinv, rv3d->viewmat); @@ -2219,7 +2219,7 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d) copy_m4_m4(rv3d.winmat, winmat); copy_m4_m4(rv3d.viewmat, viewmat); invert_m4_m4(rv3d.viewinv, rv3d.viewmat); - mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat); + mult_m4_m4m4(rv3d.persmat, rv3d.winmat, rv3d.viewmat); invert_m4_m4(rv3d.persinv, rv3d.viewinv); ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat); @@ -2301,7 +2301,7 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar, setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */ /* update utilitity matrices */ - mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat); + mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); invert_m4_m4(rv3d->persinv, rv3d->persmat); invert_m4_m4(rv3d->viewinv, rv3d->viewmat); @@ -2555,7 +2555,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w v3d.lens= params.lens; } - mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat); + mult_m4_m4m4(rv3d.persmat, rv3d.winmat, rv3d.viewmat); invert_m4_m4(rv3d.persinv, rv3d.viewinv); return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag, err_out); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 6d2a745fd67..fa970f7f9d8 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -116,9 +116,9 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); invert_m4_m4(v3d->camera->imat, v3d->camera->obmat); - mul_m4_m4m4(diff_mat, v3d->camera->imat, view_mat); + mult_m4_m4m4(diff_mat, view_mat, v3d->camera->imat); - mul_m4_m4m4(parent_mat, root_parent->obmat, diff_mat); + mult_m4_m4m4(parent_mat, diff_mat, root_parent->obmat); object_tfm_protected_backup(root_parent, &obtfm); object_apply_mat4(root_parent, parent_mat, TRUE, FALSE); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 0cdb7a19995..981d46774dc 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -663,8 +663,8 @@ static void move_camera(bContext* C, RegionView3D* rv3d, FlyInfo* fly, int orien ED_view3d_to_m4(prev_view_mat, fly->rv3d->ofs, fly->rv3d->viewquat, fly->rv3d->dist); invert_m4_m4(prev_view_imat, prev_view_mat); ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); - mul_m4_m4m4(diff_mat, prev_view_imat, view_mat); - mul_m4_m4m4(parent_mat, fly->root_parent->obmat, diff_mat); + mult_m4_m4m4(diff_mat, view_mat, prev_view_imat); + mult_m4_m4m4(parent_mat, diff_mat, fly->root_parent->obmat); object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE); // where_is_object(scene, fly->root_parent); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 33f7acf2a37..1be19f14618 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -141,7 +141,7 @@ void view3d_get_transformation(ARegion *ar, RegionView3D *rv3d, Object *ob, bglM int i, j; if (ob) { - mul_m4_m4m4(cpy, ob->obmat, rv3d->viewmat); + mult_m4_m4m4(cpy, rv3d->viewmat, ob->obmat); } else { copy_m4_m4(cpy, rv3d->viewmat); } diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 89f859d0976..4d98afc4c10 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -740,8 +740,8 @@ void ED_view3d_ob_project_mat_get(RegionView3D *rv3d, Object *ob, float pmat[4][ { float vmat[4][4]; - mul_m4_m4m4(vmat, ob->obmat, rv3d->viewmat); - mul_m4_m4m4(pmat, vmat, rv3d->winmat); + mult_m4_m4m4(vmat, rv3d->viewmat, ob->obmat); + mult_m4_m4m4(pmat, rv3d->winmat, vmat); } #if 0 @@ -809,7 +809,7 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb) if(bb==NULL) return 1; if(bb->flag & OB_BB_DISABLED) return 1; - mul_m4_m4m4(mat, obmat, rv3d->persmat); + mult_m4_m4m4(mat, rv3d->persmat, obmat); for(a=0; a<8; a++) { copy_v3_v3(vec, bb->vec[a]); @@ -1196,7 +1196,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b } setwinmatrixview3d(ar, v3d, &rect); - mul_m4_m4m4(vc->rv3d->persmat, vc->rv3d->viewmat, vc->rv3d->winmat); + mult_m4_m4m4(vc->rv3d->persmat, vc->rv3d->winmat, vc->rv3d->viewmat); if(v3d->drawtype > OB_WIRE) { v3d->zbuf= TRUE; @@ -1274,7 +1274,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b G.f &= ~G_PICKSEL; setwinmatrixview3d(ar, v3d, NULL); - mul_m4_m4m4(vc->rv3d->persmat, vc->rv3d->viewmat, vc->rv3d->winmat); + mult_m4_m4m4(vc->rv3d->persmat, vc->rv3d->winmat, vc->rv3d->viewmat); if(v3d->drawtype > OB_WIRE) { v3d->zbuf= 0; |