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

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell_renderer.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_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 SHADER_ID_MAX 25 SHADER_ID_MAX
25 }; 26 };
26 27
27 class TexturedQuadRenderer { 28 class TexturedQuadRenderer {
28 public: 29 public:
29 TexturedQuadRenderer(); 30 TexturedQuadRenderer();
30 ~TexturedQuadRenderer(); 31 ~TexturedQuadRenderer();
31 32
32 // Draw the content rect in the texture quad. 33 // Draw the content rect in the texture quad.
33 void Draw(int texture_data_handle, const gvr::Mat4f& combined_matrix); 34 void Draw(int texture_data_handle, const gvr::Mat4f& combined_matrix,
35 const Rectf& copy_rect);
34 36
35 private: 37 private:
36 GLuint vertex_shader_handle_; 38 GLuint vertex_shader_handle_;
37 GLuint fragment_shader_handle_; 39 GLuint fragment_shader_handle_;
38 GLuint program_handle_; 40 GLuint program_handle_;
39 GLuint combined_matrix_handle_; 41 GLuint combined_matrix_handle_;
40 GLuint texture_uniform_handle_; 42 GLuint texture_uniform_handle_;
43 GLuint copy_rect_uniform_handle_;
41 GLuint position_handle_; 44 GLuint position_handle_;
42 GLuint texture_coordinate_handle_; 45 GLuint texture_coordinate_handle_;
43 46
44 DISALLOW_COPY_AND_ASSIGN(TexturedQuadRenderer); 47 DISALLOW_COPY_AND_ASSIGN(TexturedQuadRenderer);
45 }; 48 };
46 49
47 class VrShellRenderer { 50 class VrShellRenderer {
48 public: 51 public:
49 VrShellRenderer(); 52 VrShellRenderer();
50 ~VrShellRenderer(); 53 ~VrShellRenderer();
51 54
52 TexturedQuadRenderer* GetTexturedQuadRenderer() { 55 TexturedQuadRenderer* GetTexturedQuadRenderer() {
53 return textured_quad_renderer_.get(); 56 return textured_quad_renderer_.get();
54 } 57 }
55 58
56 private: 59 private:
57 std::unique_ptr<TexturedQuadRenderer> textured_quad_renderer_; 60 std::unique_ptr<TexturedQuadRenderer> textured_quad_renderer_;
61
58 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); 62 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer);
59 }; 63 };
60 64
61 } // namespace vr_shell 65 } // namespace vr_shell
62 66
63 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ 67 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698