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

Side by Side Diff: third_party/WebKit/Source/modules/vr/VRPose.cpp

Issue 2494733002: Reland of mojo VR interface simpified. (Closed)
Patch Set: Fix Werror Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "modules/vr/VRPose.h" 5 #include "modules/vr/VRPose.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 namespace { 9 namespace {
10 10
11 DOMFloat32Array* mojoArrayToFloat32Array(const mojo::WTFArray<float>& vec) { 11 DOMFloat32Array* mojoArrayToFloat32Array(const mojo::WTFArray<float>& vec) {
12 if (vec.is_null()) 12 if (vec.is_null())
13 return nullptr; 13 return nullptr;
14 14
15 return DOMFloat32Array::create(&(vec.front()), vec.size()); 15 return DOMFloat32Array::create(&(vec.front()), vec.size());
16 } 16 }
17 17
18 } // namespace 18 } // namespace
19 19
20 VRPose::VRPose() {} 20 VRPose::VRPose() {}
21 21
22 void VRPose::setPose(const device::blink::VRPosePtr& state) { 22 void VRPose::setPose(const device::mojom::blink::VRPosePtr& state) {
23 if (state.is_null()) 23 if (state.is_null())
24 return; 24 return;
25 25
26 m_orientation = mojoArrayToFloat32Array(state->orientation); 26 m_orientation = mojoArrayToFloat32Array(state->orientation);
27 m_position = mojoArrayToFloat32Array(state->position); 27 m_position = mojoArrayToFloat32Array(state->position);
28 m_angularVelocity = mojoArrayToFloat32Array(state->angularVelocity); 28 m_angularVelocity = mojoArrayToFloat32Array(state->angularVelocity);
29 m_linearVelocity = mojoArrayToFloat32Array(state->linearVelocity); 29 m_linearVelocity = mojoArrayToFloat32Array(state->linearVelocity);
30 m_angularAcceleration = mojoArrayToFloat32Array(state->angularAcceleration); 30 m_angularAcceleration = mojoArrayToFloat32Array(state->angularAcceleration);
31 m_linearAcceleration = mojoArrayToFloat32Array(state->linearAcceleration); 31 m_linearAcceleration = mojoArrayToFloat32Array(state->linearAcceleration);
32 } 32 }
33 33
34 DEFINE_TRACE(VRPose) { 34 DEFINE_TRACE(VRPose) {
35 visitor->trace(m_orientation); 35 visitor->trace(m_orientation);
36 visitor->trace(m_position); 36 visitor->trace(m_position);
37 visitor->trace(m_angularVelocity); 37 visitor->trace(m_angularVelocity);
38 visitor->trace(m_linearVelocity); 38 visitor->trace(m_linearVelocity);
39 visitor->trace(m_angularAcceleration); 39 visitor->trace(m_angularAcceleration);
40 visitor->trace(m_linearAcceleration); 40 visitor->trace(m_linearAcceleration);
41 } 41 }
42 42
43 } // namespace blink 43 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRPose.h ('k') | third_party/WebKit/Source/modules/vr/VRStageParameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698