OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "device/vr/android/cardboard/cardboard_vr_device.h" | 5 #include "device/vr/android/cardboard/cardboard_vr_device.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/android/context_utils.h" | 10 #include "base/android/context_utils.h" |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/android/jni_array.h" | 12 #include "base/android/jni_array.h" |
13 #include "base/android/jni_string.h" | 13 #include "base/android/jni_string.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
18 #include "jni/CardboardVRDevice_jni.h" | 18 #include "jni/CardboardVRDevice_jni.h" |
19 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
20 #include "ui/gfx/transform_util.h" | 20 #include "ui/gfx/transform_util.h" |
21 | 21 |
22 using base::android::AttachCurrentThread; | 22 using base::android::AttachCurrentThread; |
| 23 using base::android::ScopedJavaLocalRef; |
23 | 24 |
24 namespace device { | 25 namespace device { |
25 | 26 |
26 CardboardVRDevice::CardboardVRDevice(VRDeviceProvider* provider) | 27 CardboardVRDevice::CardboardVRDevice(VRDeviceProvider* provider) |
27 : VRDevice(provider) { | 28 : VRDevice(provider) { |
28 JNIEnv* env = AttachCurrentThread(); | 29 JNIEnv* env = AttachCurrentThread(); |
29 j_cardboard_device_.Reset(Java_CardboardVRDevice_create( | 30 j_cardboard_device_.Reset(Java_CardboardVRDevice_create( |
30 env, base::android::GetApplicationContext())); | 31 env, base::android::GetApplicationContext())); |
31 j_head_matrix_.Reset(env, env->NewFloatArray(16)); | 32 j_head_matrix_.Reset(env, env->NewFloatArray(16)); |
32 } | 33 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 145 |
145 return pose; | 146 return pose; |
146 } | 147 } |
147 | 148 |
148 void CardboardVRDevice::ResetPose() { | 149 void CardboardVRDevice::ResetPose() { |
149 Java_CardboardVRDevice_resetSensor(AttachCurrentThread(), | 150 Java_CardboardVRDevice_resetSensor(AttachCurrentThread(), |
150 j_cardboard_device_.obj()); | 151 j_cardboard_device_.obj()); |
151 } | 152 } |
152 | 153 |
153 } // namespace device | 154 } // namespace device |
OLD | NEW |