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:
authormano-wii <germano.costa@ig.com.br>2019-09-11 19:04:54 +0300
committermano-wii <germano.costa@ig.com.br>2019-09-11 19:06:28 +0300
commit6d85280ec3fb0c58b9a49f7da58d589483ad042c (patch)
treeffd352acdb9f297e7e8f3b6b098785cd29ef43ff
parent7e245e482ca6f1c1d9a84c317feb151758316d34 (diff)
Fix T69458: Edit Mesh selection bug from camera view
-rw-r--r--source/blender/blenlib/intern/math_geom.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index f1575ed2b2d..a81dc018ed0 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -4773,29 +4773,24 @@ void projmat_from_subregion(const float projmat[4][4],
float rect_width = (float)(x_max - x_min);
float rect_height = (float)(y_max - y_min);
+ float x_sca = (float)win_size[0] / rect_width;
+ float y_sca = (float)win_size[1] / rect_height;
+
float x_fac = (float)((x_min + x_max) - win_size[0]) / rect_width;
float y_fac = (float)((y_min + y_max) - win_size[1]) / rect_height;
copy_m4_m4(r_projmat, projmat);
- r_projmat[0][0] *= (float)win_size[0] / rect_width;
- r_projmat[1][1] *= (float)win_size[1] / rect_height;
-
-#if 0 /* TODO: check if this is more efficient. */
- r_projmat[2][0] -= x_fac * r_projmat[2][3];
- r_projmat[2][1] -= y_fac * r_projmat[2][3];
+ r_projmat[0][0] *= x_sca;
+ r_projmat[1][1] *= y_sca;
- r_projmat[3][0] -= x_fac * r_projmat[3][3];
- r_projmat[3][1] -= y_fac * r_projmat[3][3];
-#else
if (projmat[3][3] == 0.0f) {
- r_projmat[2][0] += x_fac;
- r_projmat[2][1] += y_fac;
+ r_projmat[2][0] = r_projmat[2][0] * x_sca + x_fac;
+ r_projmat[2][1] = r_projmat[2][1] * y_sca + y_fac;
}
else {
- r_projmat[3][0] -= x_fac;
- r_projmat[3][1] -= y_fac;
+ r_projmat[3][0] = r_projmat[3][0] * x_sca - x_fac;
+ r_projmat[3][1] = r_projmat[3][1] * y_sca - y_fac;
}
-#endif
}
static void i_multmatrix(float icand[4][4], float Vm[4][4])