[Bf-blender-cvs] [d39ffd7] master: NDOF: remove bias for translation

Campbell Barton noreply at git.blender.org
Mon Feb 17 12:19:57 CET 2014


Commit: d39ffd72174c28a66c3a8d97054d67cc372f088b
Author: Campbell Barton
Date:   Mon Feb 17 22:17:31 2014 +1100
https://developer.blender.org/rBd39ffd72174c28a66c3a8d97054d67cc372f088b

NDOF: remove bias for translation

Was noticeable (and annoying) that different axis had different speed,
if we want to have axis bias better do as a user preference.

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

M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/editors/space_view3d/view3d_fly.c
M	source/blender/editors/space_view3d/view3d_walk.c

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

diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 8a11b33..757784c 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1178,12 +1178,6 @@ static void view3d_ndof_pan_zoom(const struct wmNDOFMotionData *ndof, ScrArea *s
 {
 	RegionView3D *rv3d = ar->regiondata;
 	const float dt = ndof->dt;
-
-	/* tune these until everything feels right */
-	const float forward_sensitivity = 1.f;
-	const float vertical_sensitivity = 0.4f;
-	const float lateral_sensitivity = 0.6f;
-
 	float view_inv[4];
 	float pan_vec[3];
 
@@ -1191,9 +1185,9 @@ static void view3d_ndof_pan_zoom(const struct wmNDOFMotionData *ndof, ScrArea *s
 		return;
 	}
 
-	pan_vec[0] = lateral_sensitivity  * ndof->tvec[0] * ((U.ndof_flag & NDOF_PANX_INVERT_AXIS) ? -1.0f : 1.0f);
-	pan_vec[1] = vertical_sensitivity * ndof->tvec[1] * ((U.ndof_flag & NDOF_PANZ_INVERT_AXIS) ? -1.0f : 1.0f);
-	pan_vec[2] = forward_sensitivity  * ndof->tvec[2] * ((U.ndof_flag & NDOF_PANY_INVERT_AXIS) ? -1.0f : 1.0f);
+	pan_vec[0] = ndof->tvec[0] * ((U.ndof_flag & NDOF_PANX_INVERT_AXIS) ? -1.0f : 1.0f);
+	pan_vec[1] = ndof->tvec[1] * ((U.ndof_flag & NDOF_PANZ_INVERT_AXIS) ? -1.0f : 1.0f);
+	pan_vec[2] = ndof->tvec[2] * ((U.ndof_flag & NDOF_PANY_INVERT_AXIS) ? -1.0f : 1.0f);
 
 	if (has_zoom) {
 		/* zoom with Z */
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 9f8d1e1..813404a 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -958,28 +958,20 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
 	rv3d->rot_angle = 0.0f; /* disable onscreen rotation doo-dad */
 
 	if (do_translate) {
-		const float forward_sensitivity  = 1.0f;
-		const float vertical_sensitivity = 0.4f;
-		const float lateral_sensitivity  = 0.6f;
-
 		float speed = 10.0f; /* blender units per second */
+		float trans[3];
 		/* ^^ this is ok for default cube scene, but should scale with.. something */
-
-		float trans[3] = {lateral_sensitivity  * ndof->tvec[0],
-		                  vertical_sensitivity * ndof->tvec[1],
-		                  forward_sensitivity  * ndof->tvec[2]};
-
 		if (fly->use_precision)
 			speed *= 0.2f;
 
-		mul_v3_fl(trans, speed * dt);
+		mul_v3_v3fl(trans, ndof->tvec, speed * dt);
 
 		/* transform motion from view to world coordinates */
 		mul_qt_v3(view_inv, trans);
 
 		if (flag & NDOF_FLY_HELICOPTER) {
 			/* replace world z component with device y (yes it makes sense) */
-			trans[2] = speed * dt * vertical_sensitivity * ndof->tvec[1];
+			trans[2] = speed * dt * ndof->tvec[1];
 		}
 
 		if (rv3d->persp == RV3D_CAMOB) {
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index e65cd3c..426a9a6 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -1238,28 +1238,20 @@ static int walkApply_ndof(bContext *C, WalkInfo *walk)
 	rv3d->rot_angle = 0.0f; /* disable onscreen rotation doo-dad */
 
 	if (do_translate) {
-		const float forward_sensitivity  = 1.0f;
-		const float vertical_sensitivity = 0.4f;
-		const float lateral_sensitivity  = 0.6f;
-
 		float speed = 10.0f; /* blender units per second */
+		float trans[3];
 		/* ^^ this is ok for default cube scene, but should scale with.. something */
-
-		float trans[3] = {lateral_sensitivity  * ndof->tvec[0],
-		                  vertical_sensitivity * ndof->tvec[1],
-		                  forward_sensitivity  * ndof->tvec[2]};
-
 		if (walk->is_slow)
 			speed *= 0.2f;
 
-		mul_v3_fl(trans, speed * dt);
+		mul_v3_v3fl(trans, ndof->tvec, speed * dt);
 
 		/* transform motion from view to world coordinates */
 		mul_qt_v3(view_inv, trans);
 
 		if (flag & NDOF_FLY_HELICOPTER) {
 			/* replace world z component with device y (yes it makes sense) */
-			trans[2] = speed * dt * vertical_sensitivity * ndof->tvec[1];
+			trans[2] = speed * dt * ndof->tvec[1];
 		}
 
 		if (rv3d->persp == RV3D_CAMOB) {




More information about the Bf-blender-cvs mailing list