| 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_RENDERER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "chrome/browser/android/vr_shell/vr_util.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.h" |
| 14 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr_types.h" | 15 #include "third_party/gvr-android-sdk/src/ndk-beta/include/vr/gvr/capi/include/g
vr_types.h" |
| 15 | 16 |
| 16 namespace vr_shell { | 17 namespace vr_shell { |
| 17 | 18 |
| 18 typedef unsigned int GLuint; | 19 typedef unsigned int GLuint; |
| 19 | 20 |
| 20 enum ShaderID { | 21 enum ShaderID { |
| 21 SHADER_UNRECOGNIZED = 0, | 22 SHADER_UNRECOGNIZED = 0, |
| 22 TEXTURE_QUAD_VERTEX_SHADER, | 23 TEXTURE_QUAD_VERTEX_SHADER, |
| 23 TEXTURE_QUAD_FRAGMENT_SHADER, | 24 TEXTURE_QUAD_FRAGMENT_SHADER, |
| 24 WEBVR_VERTEX_SHADER, | 25 WEBVR_VERTEX_SHADER, |
| 25 WEBVR_FRAGMENT_SHADER, | 26 WEBVR_FRAGMENT_SHADER, |
| 26 SHADER_ID_MAX | 27 SHADER_ID_MAX |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 class TexturedQuadRenderer { | 30 class TexturedQuadRenderer { |
| 30 public: | 31 public: |
| 31 TexturedQuadRenderer(); | 32 TexturedQuadRenderer(); |
| 32 ~TexturedQuadRenderer(); | 33 ~TexturedQuadRenderer(); |
| 33 | 34 |
| 34 // Draw the content rect in the texture quad. | 35 // Draw the content rect in the texture quad. |
| 35 void Draw(int texture_data_handle, const gvr::Mat4f& combined_matrix); | 36 void Draw(int texture_data_handle, const gvr::Mat4f& combined_matrix, |
| 37 const Rectf& copy_rect); |
| 36 | 38 |
| 37 private: | 39 private: |
| 38 GLuint vertex_shader_handle_; | 40 GLuint vertex_shader_handle_; |
| 39 GLuint fragment_shader_handle_; | 41 GLuint fragment_shader_handle_; |
| 40 GLuint program_handle_; | 42 GLuint program_handle_; |
| 41 GLuint combined_matrix_handle_; | 43 GLuint combined_matrix_handle_; |
| 42 GLuint texture_uniform_handle_; | 44 GLuint texture_uniform_handle_; |
| 45 GLuint copy_rect_uniform_handle_; |
| 43 GLuint position_handle_; | 46 GLuint position_handle_; |
| 44 GLuint texture_coordinate_handle_; | 47 GLuint texture_coordinate_handle_; |
| 45 | 48 |
| 46 DISALLOW_COPY_AND_ASSIGN(TexturedQuadRenderer); | 49 DISALLOW_COPY_AND_ASSIGN(TexturedQuadRenderer); |
| 47 }; | 50 }; |
| 48 | 51 |
| 49 // Renders a page-generated stereo VR view. | 52 // Renders a page-generated stereo VR view. |
| 50 class WebVrRenderer { | 53 class WebVrRenderer { |
| 51 public: | 54 public: |
| 52 WebVrRenderer(); | 55 WebVrRenderer(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return textured_quad_renderer_.get(); | 88 return textured_quad_renderer_.get(); |
| 86 } | 89 } |
| 87 | 90 |
| 88 WebVrRenderer* GetWebVrRenderer() { | 91 WebVrRenderer* GetWebVrRenderer() { |
| 89 return webvr_renderer_.get(); | 92 return webvr_renderer_.get(); |
| 90 } | 93 } |
| 91 | 94 |
| 92 private: | 95 private: |
| 93 std::unique_ptr<TexturedQuadRenderer> textured_quad_renderer_; | 96 std::unique_ptr<TexturedQuadRenderer> textured_quad_renderer_; |
| 94 std::unique_ptr<WebVrRenderer> webvr_renderer_; | 97 std::unique_ptr<WebVrRenderer> webvr_renderer_; |
| 98 |
| 95 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); | 99 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); |
| 96 }; | 100 }; |
| 97 | 101 |
| 98 } // namespace vr_shell | 102 } // namespace vr_shell |
| 99 | 103 |
| 100 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ | 104 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ |
| OLD | NEW |