Chromium Code Reviews| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 ~VrShell() override; | 126 ~VrShell() override; |
| 127 void LoadUIContent(); | 127 void LoadUIContent(); |
| 128 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); | 128 void DrawVrShell(const gvr::Mat4f& head_pose, gvr::Frame &frame); |
| 129 void DrawUiView(const gvr::Mat4f* head_pose, | 129 void DrawUiView(const gvr::Mat4f* head_pose, |
| 130 const std::vector<const ContentRectangle*>& elements, | 130 const std::vector<const ContentRectangle*>& elements, |
| 131 const gvr::Sizei& render_size, int viewport_offset); | 131 const gvr::Sizei& render_size, int viewport_offset); |
| 132 void DrawElements(const gvr::Mat4f& render_matrix, | 132 void DrawElements(const gvr::Mat4f& render_matrix, |
| 133 const std::vector<const ContentRectangle*>& elements); | 133 const std::vector<const ContentRectangle*>& elements); |
| 134 void DrawCursor(const gvr::Mat4f& render_matrix); | 134 void DrawCursor(const gvr::Mat4f& render_matrix); |
| 135 void DrawWebVr(); | 135 void DrawWebVr(); |
| 136 bool WebVrPoseByteIsValid(int pose_index_byte); | |
| 136 | 137 |
| 137 void UpdateController(const gvr::Vec3f& forward_vector); | 138 void UpdateController(const gvr::Vec3f& forward_vector); |
| 138 void SendEventsToTarget(VrInputManager* input_target, | 139 void SendEventsToTarget(VrInputManager* input_target, |
| 139 int pixel_x, | 140 int pixel_x, |
| 140 int pixel_y); | 141 int pixel_y); |
| 141 | 142 |
| 142 void HandleQueuedTasks(); | 143 void HandleQueuedTasks(); |
| 143 | 144 |
| 144 // content::WebContentsObserver implementation. | 145 // content::WebContentsObserver implementation. |
| 145 void RenderViewHostChanged(content::RenderViewHost* old_host, | 146 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 int content_tex_height_ = 0; | 199 int content_tex_height_ = 0; |
| 199 gvr::Sizei content_tex_pixels_for_webvr_ = {0, 0}; | 200 gvr::Sizei content_tex_pixels_for_webvr_ = {0, 0}; |
| 200 | 201 |
| 201 bool webvr_mode_ = false; | 202 bool webvr_mode_ = false; |
| 202 | 203 |
| 203 // The pose ring buffer size must be a power of two to avoid glitches when | 204 // The pose ring buffer size must be a power of two to avoid glitches when |
| 204 // the pose index wraps around. It should be large enough to handle the | 205 // the pose index wraps around. It should be large enough to handle the |
| 205 // current backlog of poses which is 2-3 frames. | 206 // current backlog of poses which is 2-3 frames. |
| 206 static constexpr int kPoseRingBufferSize = 8; | 207 static constexpr int kPoseRingBufferSize = 8; |
| 207 std::vector<gvr::Mat4f> webvr_head_pose_; | 208 std::vector<gvr::Mat4f> webvr_head_pose_; |
| 209 std::vector<bool> webvr_head_pose_valid_; | |
| 210 // Wait for a few seconds of valid poses before reprojecting, see | |
| 211 // crbug.com/667327. During this time, content is being drawn, just | |
| 212 // without reprojection. | |
| 213 static constexpr int webvr_min_valid_poses_ = 60; | |
|
mthiesse
2016/12/01 21:53:15
I don't think we should land this min_valid_poses_
klausw
2016/12/01 22:36:04
I've removed it, it's unclear. Got a black screen
| |
| 214 int webvr_valid_poses_seen_ = 0; | |
| 208 jint webvr_texture_id_ = 0; | 215 jint webvr_texture_id_ = 0; |
| 209 | 216 |
| 210 std::unique_ptr<VrController> controller_; | 217 std::unique_ptr<VrController> controller_; |
| 211 scoped_refptr<VrInputManager> content_input_manager_; | 218 scoped_refptr<VrInputManager> content_input_manager_; |
| 212 scoped_refptr<VrInputManager> ui_input_manager_; | 219 scoped_refptr<VrInputManager> ui_input_manager_; |
| 213 scoped_refptr<VrMetricsHelper> metrics_helper_; | 220 scoped_refptr<VrMetricsHelper> metrics_helper_; |
| 214 | 221 |
| 215 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 222 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 216 | 223 |
| 217 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 224 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
| 218 | 225 |
| 219 DISALLOW_COPY_AND_ASSIGN(VrShell); | 226 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 220 }; | 227 }; |
| 221 | 228 |
| 222 bool RegisterVrShell(JNIEnv* env); | 229 bool RegisterVrShell(JNIEnv* env); |
| 223 | 230 |
| 224 } // namespace vr_shell | 231 } // namespace vr_shell |
| 225 | 232 |
| 226 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 233 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |