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

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

Issue 2770353002: WebVR: add angular velocity estimate to pose (Closed)
Patch Set: Review feedback, move constants to vr_shell.h Created 3 years, 9 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_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 void ForceExitVr(); 176 void ForceExitVr();
177 177
178 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event); 178 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event);
179 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); 179 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event);
180 180
181 // device::GvrGamepadDataProvider implementation. 181 // device::GvrGamepadDataProvider implementation.
182 void UpdateGamepadData(device::GvrGamepadData) override; 182 void UpdateGamepadData(device::GvrGamepadData) override;
183 void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override; 183 void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override;
184 184
185 // TODO(mthiesse): Find a better place for these functions to live. 185 // TODO(mthiesse): Find a better place for these functions to live. They are
186 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat); 186 // called from both vr_shell_gl and non_presenting_gvr_delegate.
187
188 // Creates a WebVR pose from a GVR pose, including filling in an angular
189 // velocity estimate based on the change between two predicted poses.
190 static device::mojom::VRPosePtr VRPosePtrFromGvrPose(
191 gvr::Mat4f head_matrix_predicted,
192 gvr::Mat4f head_matrix_for_angular_velocity,
193 int64_t epsilon_nanos);
194
195 // Provides a recommended render resolution for WebVR, this is passed on to
196 // the application as renderWidth/Height
187 static gvr::Sizei GetRecommendedWebVrSize(gvr::GvrApi* gvr_api); 197 static gvr::Sizei GetRecommendedWebVrSize(gvr::GvrApi* gvr_api);
198
199 // Fill in the VRDisplayInfo based on recommended size and other headset
200 // parameters.
188 static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo( 201 static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo(
189 gvr::GvrApi* gvr_api, 202 gvr::GvrApi* gvr_api,
190 gvr::Sizei recommended_size, 203 gvr::Sizei recommended_size,
191 uint32_t device_id); 204 uint32_t device_id);
192 205
206 // TODO(mthiesse): If gvr::PlatformInfo().GetPosePredictionTime() is ever
207 // exposed, use that instead (it defaults to 50ms on most platforms).
208 static constexpr int64_t kPredictionTimeWithoutVsyncNanos = 50000000;
209
210 // Time offset used for calculating angular velocity from a pair of predicted
211 // poses. The precise value shouldn't matter as long as it's nonzero and much
212 // less than a frame.
213 static constexpr int64_t kAngularVelocityEpsilonNanos = 1000000;
214
193 private: 215 private:
194 ~VrShell() override; 216 ~VrShell() override;
195 void PostToGlThreadWhenReady(const base::Closure& task); 217 void PostToGlThreadWhenReady(const base::Closure& task);
196 void SetContentPaused(bool paused); 218 void SetContentPaused(bool paused);
197 void SetUiState(); 219 void SetUiState();
198 220
199 // content::WebContentsObserver implementation. 221 // content::WebContentsObserver implementation.
200 void RenderViewHostChanged(content::RenderViewHost* old_host, 222 void RenderViewHostChanged(content::RenderViewHost* old_host,
201 content::RenderViewHost* new_host) override; 223 content::RenderViewHost* new_host) override;
202 void MainFrameWasResized(bool width_changed) override; 224 void MainFrameWasResized(bool width_changed) override;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 286 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
265 287
266 DISALLOW_COPY_AND_ASSIGN(VrShell); 288 DISALLOW_COPY_AND_ASSIGN(VrShell);
267 }; 289 };
268 290
269 bool RegisterVrShell(JNIEnv* env); 291 bool RegisterVrShell(JNIEnv* env);
270 292
271 } // namespace vr_shell 293 } // namespace vr_shell
272 294
273 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 295 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698