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

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 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 textureDataHandle, const gvr::Mat4f& combinedMatrix,
35 const Rectf& copyRect);
34 36
35 private: 37 private:
38 static constexpr float kHalfHeight = 0.5f;
David Trainor- moved to gerrit 2016/09/08 05:49:30 Any reason we pulled these to the h file instead o
mthiesse 2016/09/08 17:44:41 Nope, moved back.
39 static constexpr float kHalfWidth = 0.5f;
40 static constexpr float kTextureQuadPosition[18] = {
41 -kHalfWidth, kHalfHeight, 0.0f, -kHalfWidth, -kHalfHeight, 0.0f,
42 kHalfWidth, kHalfHeight, 0.0f, -kHalfWidth, -kHalfHeight, 0.0f,
43 kHalfWidth, -kHalfHeight, 0.0f, kHalfWidth, kHalfHeight, 0.0f};
44 static constexpr int kPositionDataSize = 3;
45 // Number of vertices passed to glDrawArrays().
46 static constexpr int kVerticesNumber = 6;
47
48 static constexpr float kTexturedQuadTextureCoordinates[12] =
49 makeRectangularTextureBuffer(0.0f, 1.0f, 0.0f, 1.0f);
50
51 static constexpr int kTextureCoordinateDataSize = 2;
52
36 GLuint vertex_shader_handle_; 53 GLuint vertex_shader_handle_;
37 GLuint fragment_shader_handle_; 54 GLuint fragment_shader_handle_;
38 GLuint program_handle_; 55 GLuint program_handle_;
39 GLuint combined_matrix_handle_; 56 GLuint combined_matrix_handle_;
40 GLuint texture_uniform_handle_; 57 GLuint texture_uniform_handle_;
58 GLuint copy_rect_uniform_handle_;
41 GLuint position_handle_; 59 GLuint position_handle_;
42 GLuint texture_coordinate_handle_; 60 GLuint texture_coordinate_handle_;
43 61
44 DISALLOW_COPY_AND_ASSIGN(TexturedQuadRenderer); 62 DISALLOW_COPY_AND_ASSIGN(TexturedQuadRenderer);
45 }; 63 };
46 64
47 class VrShellRenderer { 65 class VrShellRenderer {
48 public: 66 public:
49 VrShellRenderer(); 67 VrShellRenderer();
50 ~VrShellRenderer(); 68 ~VrShellRenderer();
51 69
52 TexturedQuadRenderer* GetTexturedQuadRenderer() { 70 TexturedQuadRenderer* GetTexturedQuadRenderer() {
53 return textured_quad_renderer_.get(); 71 return textured_quad_renderer_.get();
54 } 72 }
55 73
56 private: 74 private:
57 std::unique_ptr<TexturedQuadRenderer> textured_quad_renderer_; 75 std::unique_ptr<TexturedQuadRenderer> textured_quad_renderer_;
76
58 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer); 77 DISALLOW_COPY_AND_ASSIGN(VrShellRenderer);
59 }; 78 };
60 79
61 } // namespace vr_shell 80 } // namespace vr_shell
62 81
63 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_ 82 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698