| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/vr_controller.h" | 5 #include "chrome/browser/android/vr_shell/vr_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h" | 11 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h" |
| 12 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_co
ntroller.h" | 12 #include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_co
ntroller.h" |
| 13 | 13 |
| 14 namespace vr_shell { | 14 namespace vr_shell { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 constexpr float kDisplacementScaleFactor = 800.0f; | 18 constexpr float kDisplacementScaleFactor = 300.0f; |
| 19 | 19 |
| 20 // A slop represents a small rectangular region around the first touch point of | 20 // A slop represents a small rectangular region around the first touch point of |
| 21 // a gesture. | 21 // a gesture. |
| 22 // If the user does not move outside of the slop, no gesture is detected. | 22 // If the user does not move outside of the slop, no gesture is detected. |
| 23 // Gestures start to be detected when the user moves outside of the slop. | 23 // Gestures start to be detected when the user moves outside of the slop. |
| 24 // Vertical distance from the border to the center of slop. | 24 // Vertical distance from the border to the center of slop. |
| 25 constexpr float kSlopVertical = 0.165f; | 25 constexpr float kSlopVertical = 0.165f; |
| 26 | 26 |
| 27 // Horizontal distance from the border to the center of slop. | 27 // Horizontal distance from the border to the center of slop. |
| 28 constexpr float kSlopHorizontal = 0.125f; | 28 constexpr float kSlopHorizontal = 0.125f; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 gvr::Vec2f velocity = Vector::ScalarMult(displacement, 1 / duration); | 361 gvr::Vec2f velocity = Vector::ScalarMult(displacement, 1 / duration); |
| 362 | 362 |
| 363 float weight = duration / (kRC + duration); | 363 float weight = duration / (kRC + duration); |
| 364 | 364 |
| 365 overall_velocity_ = | 365 overall_velocity_ = |
| 366 Vector::Add(Vector::ScalarMult(overall_velocity_, 1 - weight), | 366 Vector::Add(Vector::ScalarMult(overall_velocity_, 1 - weight), |
| 367 Vector::ScalarMult(velocity, weight)); | 367 Vector::ScalarMult(velocity, weight)); |
| 368 } | 368 } |
| 369 | 369 |
| 370 } // namespace vr_shell | 370 } // namespace vr_shell |
| OLD | NEW |