Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell.h

Issue 2301633002: Refactor Vr activity into ChromeTabbedActivity. (Closed)
Patch Set: Address comments and rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11
11 #include "base/android/jni_weak_ref.h" 12 #include "base/android/jni_weak_ref.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/android/vr_shell/ui_elements.h"
13 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr.h" 15 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr.h"
14 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr_types.h" 16 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g vr_types.h"
15 17
18
16 namespace vr_shell { 19 namespace vr_shell {
17 20
18 class VrShellRenderer; 21 class VrShellRenderer;
19 22
20 class ContentRect {
21 public:
22 ContentRect();
23 ~ContentRect();
24 void SetIdentity();
25 void Translate(float x, float y, float z);
26 gvr::Mat4f transfrom_to_world;
27 int content_texture_handle;
28 };
29
30 class VrShell { 23 class VrShell {
31 public: 24 public:
32 VrShell(JNIEnv* env, jobject obj); 25 VrShell(JNIEnv* env, jobject obj);
33 26
34 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 27 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
35
36 void GvrInit(JNIEnv* env, 28 void GvrInit(JNIEnv* env,
37 const base::android::JavaParamRef<jobject>& obj, 29 const base::android::JavaParamRef<jobject>& obj,
38 jlong native_gvr_api); 30 jlong native_gvr_api);
39 void InitializeGl(JNIEnv* env, 31 void InitializeGl(JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj, 32 const base::android::JavaParamRef<jobject>& obj,
41 jint texture_data_handle); 33 jint texture_data_handle);
42 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 34 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
43 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 35 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
44 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 36 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
45 37
46 private: 38 private:
47 ~VrShell(); 39 ~VrShell();
48
49 void DrawEye(const gvr::Mat4f& view_matrix, 40 void DrawEye(const gvr::Mat4f& view_matrix,
50 const gvr::BufferViewport& params); 41 const gvr::BufferViewport& params);
51 void DrawContentRect(); 42 void DrawUI();
52 43
53 std::unique_ptr<ContentRect> content_rect_; 44 void UpdateTransforms(float screen_width_meters,
45 float screen_height_meters,
46 float scree_tilt);
47
48 // samplerExternalOES texture data for desktop content image.
bshe 2016/09/09 14:42:10 desktop might be misleading. Perhaps remove "deskt
mthiesse 2016/09/09 15:16:38 Done.
49 jint content_texture_id_ = 0;
50
51 float desktop_screen_tilt_;
52 float desktop_height_;
53
54 ContentRectangle* desktop_plane_;
55 gvr::Vec3f desktop_position_;
56
57 std::vector<std::unique_ptr<ContentRectangle>> ui_rects_;
58
54 std::unique_ptr<gvr::GvrApi> gvr_api_; 59 std::unique_ptr<gvr::GvrApi> gvr_api_;
55 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_; 60 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_;
56 std::unique_ptr<gvr::BufferViewport> buffer_viewport_; 61 std::unique_ptr<gvr::BufferViewport> buffer_viewport_;
57 std::unique_ptr<gvr::SwapChain> swap_chain_; 62 std::unique_ptr<gvr::SwapChain> swap_chain_;
58 63
59 gvr::Mat4f view_matrix_; 64 gvr::Mat4f view_matrix_;
60 gvr::Mat4f projection_matrix_; 65 gvr::Mat4f projection_matrix_;
61 66
62 gvr::Mat4f head_pose_; 67 gvr::Mat4f head_pose_;
63 68
64 gvr::Sizei render_size_; 69 gvr::Sizei render_size_;
65 70
66 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; 71 std::unique_ptr<VrShellRenderer> vr_shell_renderer_;
67
68 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; 72 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_;
69 73
70 DISALLOW_COPY_AND_ASSIGN(VrShell); 74 DISALLOW_COPY_AND_ASSIGN(VrShell);
71 }; 75 };
72 76
73 bool RegisterVrShell(JNIEnv* env); 77 bool RegisterVrShell(JNIEnv* env);
74 78
75 } // namespace vr_shell 79 } // namespace vr_shell
76 80
77 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 81 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698