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

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

Issue 2775283004: Rendering Daydream controller in a fixed position. (Closed)
Patch Set: Using textures for corresponding button states. Created 3 years, 8 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_GL_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/cancelable_callback.h" 13 #include "base/cancelable_callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "chrome/browser/android/vr_shell/vr_controller_model.h"
18 #include "device/vr/android/gvr/gvr_delegate.h" 19 #include "device/vr/android/gvr/gvr_delegate.h"
19 #include "device/vr/vr_service.mojom.h" 20 #include "device/vr/vr_service.mojom.h"
20 #include "mojo/public/cpp/bindings/binding.h" 21 #include "mojo/public/cpp/bindings/binding.h"
21 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h" 22 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h"
22 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h" 23 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
23 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
24 25
25 namespace base { 26 namespace base {
26 class ListValue; 27 class ListValue;
27 } 28 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 85
85 void SetWebVrMode(bool enabled); 86 void SetWebVrMode(bool enabled);
86 void CreateOrResizeWebVRSurface(const gvr::Sizei& size); 87 void CreateOrResizeWebVRSurface(const gvr::Sizei& size);
87 void CreateContentSurface(); 88 void CreateContentSurface();
88 void ContentBoundsChanged(int width, int height); 89 void ContentBoundsChanged(int width, int height);
89 void ContentPhysicalBoundsChanged(int width, int height); 90 void ContentPhysicalBoundsChanged(int width, int height);
90 void UIBoundsChanged(int width, int height); 91 void UIBoundsChanged(int width, int height);
91 void UIPhysicalBoundsChanged(int width, int height); 92 void UIPhysicalBoundsChanged(int width, int height);
92 base::WeakPtr<VrShellGl> GetWeakPtr(); 93 base::WeakPtr<VrShellGl> GetWeakPtr();
93 94
95 void SetControllerModel(std::unique_ptr<VrControllerModel> model);
96
94 void UpdateWebVRTextureBounds(int16_t frame_index, 97 void UpdateWebVRTextureBounds(int16_t frame_index,
95 const gvr::Rectf& left_bounds, 98 const gvr::Rectf& left_bounds,
96 const gvr::Rectf& right_bounds, 99 const gvr::Rectf& right_bounds,
97 const gvr::Sizei& source_size); 100 const gvr::Sizei& source_size);
98 101
99 void UpdateScene(std::unique_ptr<base::ListValue> commands); 102 void UpdateScene(std::unique_ptr<base::ListValue> commands);
100 103
101 void UpdateVSyncInterval(int64_t timebase_nanos, double interval_seconds); 104 void UpdateVSyncInterval(int64_t timebase_nanos, double interval_seconds);
102 105
103 void OnRequest(device::mojom::VRVSyncProviderRequest request); 106 void OnRequest(device::mojom::VRVSyncProviderRequest request);
(...skipping 15 matching lines...) Expand all
119 const std::vector<const ContentRectangle*>& elements, 122 const std::vector<const ContentRectangle*>& elements,
120 const gvr::Sizei& render_size, 123 const gvr::Sizei& render_size,
121 int viewport_offset, 124 int viewport_offset,
122 bool draw_cursor); 125 bool draw_cursor);
123 void DrawElements(const gvr::Mat4f& view_proj_matrix, 126 void DrawElements(const gvr::Mat4f& view_proj_matrix,
124 const std::vector<const ContentRectangle*>& elements); 127 const std::vector<const ContentRectangle*>& elements);
125 std::vector<const ContentRectangle*> GetElementsInDrawOrder( 128 std::vector<const ContentRectangle*> GetElementsInDrawOrder(
126 const gvr::Mat4f& view_matrix, 129 const gvr::Mat4f& view_matrix,
127 const std::vector<const ContentRectangle*>& elements); 130 const std::vector<const ContentRectangle*>& elements);
128 void DrawCursor(const gvr::Mat4f& render_matrix); 131 void DrawCursor(const gvr::Mat4f& render_matrix);
132 void DrawController(const gvr::Mat4f& view_proj_matrix);
129 bool ShouldDrawWebVr(); 133 bool ShouldDrawWebVr();
130 void DrawWebVr(); 134 void DrawWebVr();
131 bool WebVrPoseByteIsValid(int pose_index_byte); 135 bool WebVrPoseByteIsValid(int pose_index_byte);
132 136
133 void UpdateController(); 137 void UpdateController();
134 void HandleControllerInput(const gvr::Vec3f& forward_vector); 138 void HandleControllerInput(const gvr::Vec3f& forward_vector);
135 void HandleControllerAppButtonActivity( 139 void HandleControllerAppButtonActivity(
136 const gvr::Vec3f& controller_direction); 140 const gvr::Vec3f& controller_direction);
137 void SendEventsToTarget(InputTarget input_target, int pixel_x, int pixel_y); 141 void SendEventsToTarget(InputTarget input_target, int pixel_x, int pixel_y);
138 void SendGesture(InputTarget input_target, 142 void SendGesture(InputTarget input_target,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 gvr::Sizei content_tex_physical_size_ = {0, 0}; 211 gvr::Sizei content_tex_physical_size_ = {0, 0};
208 gvr::Sizei webvr_surface_size_ = {0, 0}; 212 gvr::Sizei webvr_surface_size_ = {0, 0};
209 gvr::Sizei ui_tex_physical_size_ = {0, 0}; 213 gvr::Sizei ui_tex_physical_size_ = {0, 0};
210 214
211 std::vector<gvr::Mat4f> webvr_head_pose_; 215 std::vector<gvr::Mat4f> webvr_head_pose_;
212 bool web_vr_mode_; 216 bool web_vr_mode_;
213 bool ready_to_draw_ = false; 217 bool ready_to_draw_ = false;
214 bool surfaceless_rendering_; 218 bool surfaceless_rendering_;
215 219
216 std::unique_ptr<VrController> controller_; 220 std::unique_ptr<VrController> controller_;
221 std::unique_ptr<VrControllerModel> controller_model_;
217 222
218 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 223 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
219 base::CancelableClosure vsync_task_; 224 base::CancelableClosure vsync_task_;
220 base::TimeTicks vsync_timebase_; 225 base::TimeTicks vsync_timebase_;
221 base::TimeDelta vsync_interval_; 226 base::TimeDelta vsync_interval_;
222 227
223 base::TimeDelta pending_time_; 228 base::TimeDelta pending_time_;
224 bool pending_vsync_ = false; 229 bool pending_vsync_ = false;
225 GetVSyncCallback callback_; 230 GetVSyncCallback callback_;
226 bool received_frame_ = false; 231 bool received_frame_ = false;
(...skipping 11 matching lines...) Expand all
238 gvr::Vec3f controller_start_direction_; 243 gvr::Vec3f controller_start_direction_;
239 244
240 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_; 245 base::WeakPtrFactory<VrShellGl> weak_ptr_factory_;
241 246
242 DISALLOW_COPY_AND_ASSIGN(VrShellGl); 247 DISALLOW_COPY_AND_ASSIGN(VrShellGl);
243 }; 248 };
244 249
245 } // namespace vr_shell 250 } // namespace vr_shell
246 251
247 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_ 252 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_GL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698