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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const content::WebContents* web_contents); | 81 const content::WebContents* web_contents); |
82 UiScene* GetScene(); | 82 UiScene* GetScene(); |
83 void OnDomContentsLoaded(); | 83 void OnDomContentsLoaded(); |
84 | 84 |
85 // device::GvrDelegate implementation | 85 // device::GvrDelegate implementation |
86 void SetWebVRSecureOrigin(bool secure_origin) override; | 86 void SetWebVRSecureOrigin(bool secure_origin) override; |
87 void SubmitWebVRFrame() override; | 87 void SubmitWebVRFrame() override; |
88 void UpdateWebVRTextureBounds( | 88 void UpdateWebVRTextureBounds( |
89 int eye, float left, float top, float width, float height) override; | 89 int eye, float left, float top, float width, float height) override; |
90 gvr::GvrApi* gvr_api() override; | 90 gvr::GvrApi* gvr_api() override; |
| 91 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) override; |
91 | 92 |
92 void ContentSurfaceChanged( | 93 void ContentSurfaceChanged( |
93 JNIEnv* env, | 94 JNIEnv* env, |
94 const base::android::JavaParamRef<jobject>& object, | 95 const base::android::JavaParamRef<jobject>& object, |
95 jint width, | 96 jint width, |
96 jint height, | 97 jint height, |
97 const base::android::JavaParamRef<jobject>& surface); | 98 const base::android::JavaParamRef<jobject>& surface); |
98 void UiSurfaceChanged( | 99 void UiSurfaceChanged( |
99 JNIEnv* env, | 100 JNIEnv* env, |
100 const base::android::JavaParamRef<jobject>& object, | 101 const base::android::JavaParamRef<jobject>& object, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 169 |
169 gvr::Vec3f target_point_; | 170 gvr::Vec3f target_point_; |
170 const ContentRectangle* target_element_ = nullptr; | 171 const ContentRectangle* target_element_ = nullptr; |
171 VrInputManager* current_input_target_ = nullptr; | 172 VrInputManager* current_input_target_ = nullptr; |
172 int ui_tex_width_ = 0; | 173 int ui_tex_width_ = 0; |
173 int ui_tex_height_ = 0; | 174 int ui_tex_height_ = 0; |
174 | 175 |
175 bool webvr_mode_ = false; | 176 bool webvr_mode_ = false; |
176 bool webvr_secure_origin_ = false; | 177 bool webvr_secure_origin_ = false; |
177 int64_t webvr_warning_end_nanos_ = 0; | 178 int64_t webvr_warning_end_nanos_ = 0; |
| 179 // The pose ring buffer size must be a power of two to avoid glitches when |
| 180 // the pose index wraps around. It should be large enough to handle the |
| 181 // current backlog of poses which is 2-3 frames. |
| 182 static constexpr int kPoseRingBufferSize = 8; |
| 183 std::vector<gvr::Mat4f> webvr_head_pose_; |
178 | 184 |
179 std::unique_ptr<VrController> controller_; | 185 std::unique_ptr<VrController> controller_; |
180 scoped_refptr<VrInputManager> content_input_manager_; | 186 scoped_refptr<VrInputManager> content_input_manager_; |
181 scoped_refptr<VrInputManager> ui_input_manager_; | 187 scoped_refptr<VrInputManager> ui_input_manager_; |
182 | 188 |
183 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 189 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
184 | 190 |
185 DISALLOW_COPY_AND_ASSIGN(VrShell); | 191 DISALLOW_COPY_AND_ASSIGN(VrShell); |
186 }; | 192 }; |
187 | 193 |
188 bool RegisterVrShell(JNIEnv* env); | 194 bool RegisterVrShell(JNIEnv* env); |
189 | 195 |
190 } // namespace vr_shell | 196 } // namespace vr_shell |
191 | 197 |
192 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 198 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
OLD | NEW |