OLD | NEW |
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 // fou
nd in the LICENSE file. | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
3 | 4 |
4 module device.mojom; | 5 module device.mojom; |
5 | 6 |
6 // A field of view, given by 4 degrees describing the view from a center point. | 7 // A field of view, given by 4 degrees describing the view from a center point. |
7 struct VRFieldOfView { | 8 struct VRFieldOfView { |
8 float upDegrees; | 9 float upDegrees; |
9 float downDegrees; | 10 float downDegrees; |
10 float leftDegrees; | 11 float leftDegrees; |
11 float rightDegrees; | 12 float rightDegrees; |
12 }; | 13 }; |
13 | 14 |
14 // A display's position, orientation, velocity, and acceleration state at the | 15 // A display's position, orientation, velocity, and acceleration state at the |
15 // given timestamp. | 16 // given timestamp. |
16 struct VRPose { | 17 struct VRPose { |
17 double timestamp; | 18 double timestamp; |
18 array<float, 4>? orientation; | 19 array<float, 4>? orientation; |
19 array<float, 3>? position; | 20 array<float, 3>? position; |
20 array<float, 3>? angularVelocity; | 21 array<float, 3>? angularVelocity; |
21 array<float, 3>? linearVelocity; | 22 array<float, 3>? linearVelocity; |
22 array<float, 3>? angularAcceleration; | 23 array<float, 3>? angularAcceleration; |
23 array<float, 3>? linearAcceleration; | 24 array<float, 3>? linearAcceleration; |
24 // The poseIndex is a sequential ID that's incremented on each distinct | 25 // The poseIndex is a nonzero sequential ID that's incremented on each |
25 // getPose result, it may wrap around for long sessions. | 26 // distinct getPose result, it may wrap around for long sessions. |
26 uint32 poseIndex; | 27 uint32 poseIndex; |
27 }; | 28 }; |
28 | 29 |
29 struct VRDisplayCapabilities { | 30 struct VRDisplayCapabilities { |
30 bool hasOrientation; | 31 bool hasOrientation; |
31 bool hasPosition; | 32 bool hasPosition; |
32 bool hasExternalDisplay; | 33 bool hasExternalDisplay; |
33 bool canPresent; | 34 bool canPresent; |
34 }; | 35 }; |
35 | 36 |
(...skipping 27 matching lines...) Expand all Loading... |
63 float height; | 64 float height; |
64 }; | 65 }; |
65 | 66 |
66 enum VRDisplayEventReason { | 67 enum VRDisplayEventReason { |
67 NONE = 0, | 68 NONE = 0, |
68 NAVIGATION = 1, | 69 NAVIGATION = 1, |
69 MOUNTED = 2, | 70 MOUNTED = 2, |
70 UNMOUNTED = 3 | 71 UNMOUNTED = 3 |
71 }; | 72 }; |
72 | 73 |
73 // TODO(shaobo.yan@intel.com) : Add comments to describe these interfaces about
how to use and where they live. | 74 // TODO(shaobo.yan@intel.com) : Add comments to describe these interfaces about |
| 75 // how to use and where they live. |
74 interface VRService { | 76 interface VRService { |
75 // TODO(shaobo.yan@intel.com) : Use a factory function which took a VRServiceC
lient | 77 // TODO(shaobo.yan@intel.com) : Use a factory function which took a |
76 // so we would never have a half-initialized VRService. | 78 // VRServiceClient so we would never have a half-initialized VRService. |
77 SetClient(VRServiceClient client) => (uint32 numberOfConnectedDevices); | 79 SetClient(VRServiceClient client) => (uint32 numberOfConnectedDevices); |
78 // Inform the service that the page is listening for vrdisplayactivate events. | 80 // Inform the service that the page is listening for vrdisplayactivate events. |
79 SetListeningForActivate(bool listening); | 81 SetListeningForActivate(bool listening); |
80 }; | 82 }; |
81 | 83 |
82 interface VRServiceClient { | 84 interface VRServiceClient { |
83 OnDisplayConnected(VRDisplay display, VRDisplayClient& request, VRDisplayInfo
displayInfo); | 85 OnDisplayConnected(VRDisplay display, VRDisplayClient& request, |
| 86 VRDisplayInfo displayInfo); |
84 }; | 87 }; |
85 | 88 |
86 interface VRDisplay { | 89 interface VRDisplay { |
87 [Sync] | 90 [Sync] |
88 GetPose() => (VRPose? pose); | 91 GetPose() => (VRPose? pose); |
89 ResetPose(); | 92 ResetPose(); |
90 | 93 |
91 RequestPresent(bool secureOrigin) => (bool success); | 94 RequestPresent(bool secureOrigin) => (bool success); |
92 ExitPresent(); | 95 ExitPresent(); |
93 SubmitFrame(VRPose? pose); | 96 SubmitFrame(VRPose? pose); |
94 UpdateLayerBounds(VRLayerBounds leftBounds, VRLayerBounds rightBounds); | 97 UpdateLayerBounds(uint32 frameIndex, VRLayerBounds leftBounds, |
| 98 VRLayerBounds rightBounds); |
95 }; | 99 }; |
96 | 100 |
97 interface VRDisplayClient { | 101 interface VRDisplayClient { |
98 OnChanged(VRDisplayInfo display); | 102 OnChanged(VRDisplayInfo display); |
99 OnExitPresent(); | 103 OnExitPresent(); |
100 OnBlur(); | 104 OnBlur(); |
101 OnFocus(); | 105 OnFocus(); |
102 OnActivate(VRDisplayEventReason reason); | 106 OnActivate(VRDisplayEventReason reason); |
103 OnDeactivate(VRDisplayEventReason reason); | 107 OnDeactivate(VRDisplayEventReason reason); |
104 }; | 108 }; |
OLD | NEW |