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 // getPose result, it may wrap around for long sessions. | |
26 uint32 poseIndex; | |
27 }; | 25 }; |
28 | 26 |
29 struct VRDisplayCapabilities { | 27 struct VRDisplayCapabilities { |
30 bool hasOrientation; | 28 bool hasOrientation; |
31 bool hasPosition; | 29 bool hasPosition; |
32 bool hasExternalDisplay; | 30 bool hasExternalDisplay; |
33 bool canPresent; | 31 bool canPresent; |
34 }; | 32 }; |
35 | 33 |
36 // Information about the optical properties for an eye in a VRDisplay. | 34 // Information about the optical properties for an eye in a VRDisplay. |
(...skipping 26 matching lines...) Expand all Loading... |
63 float height; | 61 float height; |
64 }; | 62 }; |
65 | 63 |
66 enum VRDisplayEventReason { | 64 enum VRDisplayEventReason { |
67 NONE = 0, | 65 NONE = 0, |
68 NAVIGATION = 1, | 66 NAVIGATION = 1, |
69 MOUNTED = 2, | 67 MOUNTED = 2, |
70 UNMOUNTED = 3 | 68 UNMOUNTED = 3 |
71 }; | 69 }; |
72 | 70 |
73 // TODO(shaobo.yan@intel.com) : Add comments to describe these interfaces about
how to use and where they live. | 71 // TODO(shaobo.yan@intel.com) : Add comments to describe these interfaces about |
| 72 // how to use and where they live. |
74 interface VRService { | 73 interface VRService { |
75 // TODO(shaobo.yan@intel.com) : Use a factory function which took a VRServiceC
lient | 74 // TODO(shaobo.yan@intel.com) : Use a factory function which took a |
76 // so we would never have a half-initialized VRService. | 75 // VRServiceClient so we would never have a half-initialized VRService. |
77 SetClient(VRServiceClient client) => (uint32 numberOfConnectedDevices); | 76 SetClient(VRServiceClient client) => (uint32 numberOfConnectedDevices); |
78 // Inform the service that the page is listening for vrdisplayactivate events. | 77 // Inform the service that the page is listening for vrdisplayactivate events. |
79 SetListeningForActivate(bool listening); | 78 SetListeningForActivate(bool listening); |
80 }; | 79 }; |
81 | 80 |
82 interface VRServiceClient { | 81 interface VRServiceClient { |
83 OnDisplayConnected(VRDisplay display, VRDisplayClient& request, VRDisplayInfo
displayInfo); | 82 OnDisplayConnected(VRDisplay display, VRDisplayClient& request, |
| 83 VRDisplayInfo displayInfo); |
84 }; | 84 }; |
85 | 85 |
86 interface VRDisplay { | 86 interface VRDisplay { |
87 ResetPose(); | 87 ResetPose(); |
88 | 88 |
89 RequestPresent(bool secureOrigin) => (bool success); | 89 RequestPresent(bool secureOrigin) => (bool success); |
90 ExitPresent(); | 90 ExitPresent(); |
91 SubmitFrame(VRPose? pose); | 91 SubmitFrame(VRPose? pose); |
92 UpdateLayerBounds(VRLayerBounds leftBounds, VRLayerBounds rightBounds); | 92 UpdateLayerBounds(int16 frameId, VRLayerBounds leftBounds, |
| 93 VRLayerBounds rightBounds); |
93 GetVRVSyncProvider(VRVSyncProvider& request); | 94 GetVRVSyncProvider(VRVSyncProvider& request); |
94 }; | 95 }; |
95 | 96 |
96 interface VRVSyncProvider { | 97 interface VRVSyncProvider { |
97 GetVSync() => (VRPose? pose, double timeSeconds); | 98 // The frameId maps a VSync to a frame arriving from the compositor. IDs will |
| 99 // be reused after the frame arrives from the compositor. Negative IDs imply |
| 100 // no mapping. |
| 101 GetVSync() => (VRPose? pose, double timeSeconds, int16 frameId); |
98 }; | 102 }; |
99 | 103 |
100 interface VRDisplayClient { | 104 interface VRDisplayClient { |
101 OnChanged(VRDisplayInfo display); | 105 OnChanged(VRDisplayInfo display); |
102 OnExitPresent(); | 106 OnExitPresent(); |
103 OnBlur(); | 107 OnBlur(); |
104 OnFocus(); | 108 OnFocus(); |
105 OnActivate(VRDisplayEventReason reason); | 109 OnActivate(VRDisplayEventReason reason); |
106 OnDeactivate(VRDisplayEventReason reason); | 110 OnDeactivate(VRDisplayEventReason reason); |
107 }; | 111 }; |
OLD | NEW |