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 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 jint height, | 87 jint height, |
88 const base::android::JavaParamRef<jobject>& surface); | 88 const base::android::JavaParamRef<jobject>& surface); |
89 | 89 |
90 // Called from non-render thread to queue a callback onto the render thread. | 90 // Called from non-render thread to queue a callback onto the render thread. |
91 // The render thread checks for callbacks and processes them between frames. | 91 // The render thread checks for callbacks and processes them between frames. |
92 void QueueTask(base::Callback<void()>& callback); | 92 void QueueTask(base::Callback<void()>& callback); |
93 | 93 |
94 private: | 94 private: |
95 virtual ~VrShell(); | 95 virtual ~VrShell(); |
96 void LoadUIContent(); | 96 void LoadUIContent(); |
| 97 bool IsUiTextureReady(); |
| 98 Rectf MakeUiGlCopyRect(Recti pixel_rect); |
97 void DrawVrShell(); | 99 void DrawVrShell(); |
98 void DrawEye(const gvr::Mat4f& view_matrix, | 100 void DrawEye(const gvr::Mat4f& view_matrix, |
99 const gvr::BufferViewport& params); | 101 const gvr::BufferViewport& params); |
100 void DrawContentRect(); | |
101 void DrawWebVr(); | |
102 void DrawUI(); | 102 void DrawUI(); |
103 void DrawCursor(); | 103 void DrawCursor(); |
| 104 void DrawWebVr(); |
| 105 void DrawWebVrOverlay(int64_t present_time_nanos); |
| 106 void DrawWebVrEye(const gvr::Mat4f& view_matrix, |
| 107 const gvr::BufferViewport& params, |
| 108 int64_t present_time_nanos); |
104 | 109 |
105 void UpdateController(); | 110 void UpdateController(); |
106 | 111 |
107 void HandleQueuedTasks(); | 112 void HandleQueuedTasks(); |
108 | 113 |
109 // samplerExternalOES texture data for UI content image. | 114 // samplerExternalOES texture data for UI content image. |
110 jint ui_texture_id_ = 0; | 115 jint ui_texture_id_ = 0; |
111 // samplerExternalOES texture data for main content image. | 116 // samplerExternalOES texture data for main content image. |
112 jint content_texture_id_ = 0; | 117 jint content_texture_id_ = 0; |
113 | 118 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; | 150 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; |
146 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; | 151 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; |
147 | 152 |
148 gvr::Quatf controller_quat_; | 153 gvr::Quatf controller_quat_; |
149 bool controller_active_ = false; | 154 bool controller_active_ = false; |
150 gvr::Vec3f look_at_vector_; | 155 gvr::Vec3f look_at_vector_; |
151 int ui_tex_width_ = 0; | 156 int ui_tex_width_ = 0; |
152 int ui_tex_height_ = 0; | 157 int ui_tex_height_ = 0; |
153 | 158 |
154 bool webvr_mode_ = false; | 159 bool webvr_mode_ = false; |
155 bool webvr_secure_origin_; | 160 bool webvr_secure_origin_ = false; |
| 161 int64_t webvr_warning_end_nanos_ = 0; |
156 | 162 |
157 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 163 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
158 | 164 |
159 DISALLOW_COPY_AND_ASSIGN(VrShell); | 165 DISALLOW_COPY_AND_ASSIGN(VrShell); |
160 }; | 166 }; |
161 | 167 |
162 bool RegisterVrShell(JNIEnv* env); | 168 bool RegisterVrShell(JNIEnv* env); |
163 | 169 |
164 } // namespace vr_shell | 170 } // namespace vr_shell |
165 | 171 |
166 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 172 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
OLD | NEW |