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