OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <memory> |
| 10 |
| 11 #include "base/android/jni_weak_ref.h" |
| 12 #include "base/macros.h" |
| 13 #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" |
| 15 |
| 16 namespace vr_shell { |
| 17 |
| 18 class VrShellRenderer; |
| 19 |
| 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 { |
| 31 public: |
| 32 VrShell(JNIEnv* env, jobject obj); |
| 33 |
| 34 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 35 |
| 36 void GvrInit(JNIEnv* env, |
| 37 const base::android::JavaParamRef<jobject>& obj, |
| 38 jlong native_gvr_api); |
| 39 void InitializeGl(JNIEnv* env, |
| 40 const base::android::JavaParamRef<jobject>& obj, |
| 41 jint texture_data_handle); |
| 42 void DrawFrame(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 43 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 44 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 45 |
| 46 private: |
| 47 ~VrShell(); |
| 48 |
| 49 void DrawEye(const gvr::Mat4f& view_matrix, |
| 50 const gvr::BufferViewport& params); |
| 51 void DrawContentRect(); |
| 52 |
| 53 std::unique_ptr<ContentRect> content_rect_; |
| 54 std::unique_ptr<gvr::GvrApi> gvr_api_; |
| 55 std::unique_ptr<gvr::BufferViewportList> buffer_viewport_list_; |
| 56 std::unique_ptr<gvr::BufferViewport> buffer_viewport_; |
| 57 std::unique_ptr<gvr::SwapChain> swap_chain_; |
| 58 |
| 59 gvr::Mat4f view_matrix_; |
| 60 gvr::Mat4f projection_matrix_; |
| 61 |
| 62 gvr::Mat4f head_pose_; |
| 63 |
| 64 gvr::Sizei render_size_; |
| 65 |
| 66 std::unique_ptr<VrShellRenderer> vr_shell_renderer_; |
| 67 |
| 68 base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 71 }; |
| 72 |
| 73 bool RegisterVrShell(JNIEnv* env); |
| 74 |
| 75 } // namespace vr_shell |
| 76 |
| 77 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
OLD | NEW |