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:
authorCampbell Barton <ideasman42@gmail.com>2018-05-12 09:19:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-12 09:19:20 +0300
commit1813f00b94982727bf545cd4c49ec2d2fee86f7a (patch)
tree924c90d42cdf75530c45aff3e30f36a146436d37
parentbe8add5d505b14fcdc5d2caf6dc4bb345f057a7c (diff)
Fix missing fallback in recent aabb precalc func
Also comment unused vars
-rw-r--r--source/blender/blenlib/intern/math_geom.c15
-rw-r--r--source/blender/editors/transform/transform_snap_object.c14
2 files changed, 22 insertions, 7 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 582ecb92274..7419d65bdee 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -806,10 +806,21 @@ void dist_squared_to_projected_aabb_precalc(
//normalize_v3(neasrest_precalc->ray_direction);
}
#else
- isect_plane_plane_v3(
+ if (!isect_plane_plane_v3(
px, py,
neasrest_precalc->ray_origin,
- neasrest_precalc->ray_direction);
+ neasrest_precalc->ray_direction))
+ {
+ if (projmat[3][3] == 0.0f) {
+ /* Perspective projection. */
+ cross_v3_v3v3(neasrest_precalc->ray_direction, py, px);
+ }
+ else {
+ /* Orthographic projection. */
+ cross_v3_v3v3(neasrest_precalc->ray_direction, py, px);
+ //normalize_v3(neasrest_precalc->ray_direction);
+ }
+ }
#endif
float win_half[2];
mul_v2_v2fl(win_half, winsize, 0.5f);
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 5ef2ce479e7..ed7ada26bd7 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -1432,6 +1432,8 @@ static bool snapMesh(
/* return args */
float r_loc[3], float r_no[3])
{
+// #define USE_RAY_MIN
+
bool retval = false;
if (snapdata->snap_to == SCE_SNAP_MODE_EDGE) {
@@ -1448,7 +1450,7 @@ static bool snapMesh(
float imat[4][4];
float timat[3][3]; /* transpose inverse matrix for normals */
float ray_normal_local[3];
- float local_scale;
+
invert_m4_m4(imat, obmat);
transpose_m3_m4(timat, imat);
@@ -1457,16 +1459,18 @@ static bool snapMesh(
mul_mat3_m4_v3(imat, ray_normal_local);
+#ifdef USE_RAY_MIN
/* local scale in normal direction */
- local_scale = normalize_v3(ray_normal_local);
+ const float local_scale = normalize_v3(ray_normal_local);
+#endif
float lpmat[4][4];
float ray_org_local[3];
- float ray_min_dist;
mul_m4_m4m4(lpmat, snapdata->pmat, obmat);
- ray_min_dist = snapdata->depth_range[0] * local_scale;
-
+#ifdef USE_RAY_MIN
+ const float ray_min_dist = snapdata->depth_range[0] * local_scale;
+#endif
copy_v3_v3(ray_org_local, snapdata->ray_origin);
mul_m4_v3(imat, ray_org_local);