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