[Bf-blender-cvs] [f54ed9f] master: Fix a nice bug in ED_view3d_win_to_vector() - vector returned for an ortho view was negated compared to vector returned for the same view in perspective...

Bastien Montagne noreply at git.blender.org
Thu Jan 30 17:17:10 CET 2014


Commit: f54ed9f5e0f036503a8817a65d50d38e9abd43d9
Author: Bastien Montagne
Date:   Thu Jan 30 16:48:29 2014 +0100
https://developer.blender.org/rBf54ed9f5e0f036503a8817a65d50d38e9abd43d9

Fix a nice bug in ED_view3d_win_to_vector() - vector returned for an ortho view was negated compared to vector returned for the same view in perspective...

Found while working on snapping issues, confirmed using bisect tool: previous to this commit, inner/outer parts were swapped when switching from otho to persp!

===================================================================

M	source/blender/editors/space_view3d/view3d_project.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 0c35398..dfc04f8 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -312,7 +312,6 @@ static void view3d_win_to_ray_segment(const ARegion *ar, View3D *v3d, const floa
 	if (!r_ray_dir) r_ray_dir = _ray_dir;
 
 	ED_view3d_win_to_vector(ar, mval, r_ray_dir);
-	negate_v3(r_ray_dir);
 
 	if (rv3d->is_persp) {
 		copy_v3_v3(r_ray_co, rv3d->viewinv[3]);
@@ -558,7 +557,7 @@ void ED_view3d_win_to_vector(const ARegion *ar, const float mval[2], float out[3
 		sub_v3_v3(out, rv3d->viewinv[3]);
 	}
 	else {
-		copy_v3_v3(out, rv3d->viewinv[2]);
+		negate_v3_v3(out, rv3d->viewinv[2]);
 	}
 	normalize_v3(out);
 }




More information about the Bf-blender-cvs mailing list