[Bf-blender-cvs] [fe9e7036b00] master: Fix UV's not aligning with image.
Jeroen Bakker
noreply at git.blender.org
Fri Mar 18 14:17:31 CET 2022
Commit: fe9e7036b00716d8ac986db5b9f832ec80d0a62b
Author: Jeroen Bakker
Date: Fri Mar 18 14:16:39 2022 +0100
Branches: master
https://developer.blender.org/rBfe9e7036b00716d8ac986db5b9f832ec80d0a62b
Fix UV's not aligning with image.
This reverts a part of {rB33409f9f1cd42e899f2706fe7878e5e89b50d617}.
===================================================================
M source/blender/draw/engines/image/image_space_image.hh
===================================================================
diff --git a/source/blender/draw/engines/image/image_space_image.hh b/source/blender/draw/engines/image/image_space_image.hh
index 7c15d780d07..264129e0728 100644
--- a/source/blender/draw/engines/image/image_space_image.hh
+++ b/source/blender/draw/engines/image/image_space_image.hh
@@ -152,25 +152,17 @@ class SpaceImageAccessor : public AbstractSpaceAccessor {
const float image_resolution[2],
float r_uv_to_texture[4][4]) const override
{
- float zoom_x = image_resolution[0] * sima->zoom;
- float zoom_y = image_resolution[1] * sima ->zoom;
- float image_offset_x = (region->winx - zoom_x) / 2 + sima->xof + image_display_offset[0];
- float image_offset_y = (region->winy - zoom_y) / 2 + sima->yof + image_display_offset[1];
-
- unit_m4(r_uv_to_texture);
- float scale_x = 1.0 / BLI_rctf_size_x(®ion->v2d.cur);
- float scale_y = 1.0 / BLI_rctf_size_y(®ion->v2d.cur);
- float offset_x = 1.0 / image_resolution[0] * image_offset_x;
- float offset_y = 1.0 / image_resolution[1] * image_offset_y;
-
- float translate_x = scale_x * (-region->v2d.cur.xmin + offset_x);
- float translate_y = scale_y * (-region->v2d.cur.ymin + offset_y);
-
- r_uv_to_texture[0][0] = scale_x;
- r_uv_to_texture[1][1] = scale_y;
- r_uv_to_texture[3][0] = translate_x;
- r_uv_to_texture[3][1] = translate_y;
- }
+ unit_m4(r_uv_to_texture);
+ float scale_x = 1.0 / BLI_rctf_size_x(®ion->v2d.cur);
+ float scale_y = 1.0 / BLI_rctf_size_y(®ion->v2d.cur);
+ float translate_x = scale_x * -region->v2d.cur.xmin;
+ float translate_y = scale_y * -region->v2d.cur.ymin;
+
+ r_uv_to_texture[0][0] = scale_x;
+ r_uv_to_texture[1][1] = scale_y;
+ r_uv_to_texture[3][0] = translate_x;
+ r_uv_to_texture[3][1] = translate_y;
+ }
};
} // namespace blender::draw::image_engine
More information about the Bf-blender-cvs
mailing list