diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-07-24 15:30:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-07-24 15:32:17 +0300 |
commit | bfe580642f46539ba85341fa8db451c52afd0cb4 (patch) | |
tree | bccbc9b35d9069eccbd8a1d35b7a5c16535e2e35 /source/blender | |
parent | 4fe0fafb875581e4a116db17da6a032fd1749f65 (diff) |
Fix background image rotation and offset
- Offset was halved & not compensating for non-square aspect.
- Rotation was flipped.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index ffa013d2758..8d4083f1723 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1242,7 +1242,7 @@ static void DRW_shgroup_camera_background_images(OBJECT_Shaders *sh_data, unit_m4(win_m4_scale); unit_m4(win_m4_translate); unit_m4(scale_m4); - axis_angle_to_mat4_single(rot_m4, 'Z', bgpic->rotation); + axis_angle_to_mat4_single(rot_m4, 'Z', -bgpic->rotation); unit_m4(translate_m4); const float *size = DRW_viewport_size_get(); @@ -1311,9 +1311,9 @@ static void DRW_shgroup_camera_background_images(OBJECT_Shaders *sh_data, scale_m4[0][0] = scale_x; scale_m4[1][1] = scale_y; - // translate - translate_m4[3][0] = bgpic->offset[0]; - translate_m4[3][1] = bgpic->offset[1]; + /* Translate, using coordinates that aren't squashed by the aspect. */ + translate_m4[3][0] = bgpic->offset[0] * 2.0f * max_ff(1.0f, 1.0f / camera_aspect); + translate_m4[3][1] = bgpic->offset[1] * 2.0f * max_ff(1.0f, camera_aspect); mul_m4_series(bg_data->transform_mat, win_m4_translate, |