blob: d41b1a9ed09da0fe5157c51d9de5af058d4e1a0d [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file.
module device.mojom;
// A field of view, given by 4 degrees describing the view from a center point.
struct VRFieldOfView {
float upDegrees;
float downDegrees;
float leftDegrees;
float rightDegrees;
};
// A display's position, orientation, velocity, and acceleration state at the
// given timestamp.
struct VRPose {
double timestamp;
array<float, 4>? orientation;
array<float, 3>? position;
array<float, 3>? angularVelocity;
array<float, 3>? linearVelocity;
array<float, 3>? angularAcceleration;
array<float, 3>? linearAcceleration;
// The poseIndex is a sequential ID that's incremented on each distinct
// getPose result, it may wrap around for long sessions.
uint32 poseIndex;
};
struct VRDisplayCapabilities {
bool hasOrientation;
bool hasPosition;
bool hasExternalDisplay;
bool canPresent;
};
// Information about the optical properties for an eye in a VRDisplay.
struct VREyeParameters {
VRFieldOfView fieldOfView;
array<float, 3> offset;
uint32 renderWidth;
uint32 renderHeight;
};
struct VRStageParameters {
array<float, 16> standingTransform;
float sizeX;
float sizeZ;
};
struct VRDisplayInfo {
uint32 index;
string displayName;
VRDisplayCapabilities capabilities;
VRStageParameters? stageParameters;
VREyeParameters leftEye;
VREyeParameters rightEye;
};
struct VRLayerBounds {
float left;
float top;
float width;
float height;
};
enum VRDisplayEventReason {
NONE = 0,
NAVIGATION = 1,
MOUNTED = 2,
UNMOUNTED = 3
};
// TODO(shaobo.yan@intel.com) : Add comments to describe these interfaces about how to use and where they live.
interface VRService {
// TODO(shaobo.yan@intel.com) : Use a factory function which took a VRServiceClient
// so we would never have a half-initialized VRService.
SetClient(VRServiceClient client) => (uint32 numberOfConnectedDevices);
// Inform the service that the page is listening for vrdisplayactivate events.
SetListeningForActivate(bool listening);
};
interface VRServiceClient {
OnDisplayConnected(VRDisplay display, VRDisplayClient& request, VRDisplayInfo displayInfo);
};
interface VRDisplay {
[Sync]
GetPose() => (VRPose? pose);
ResetPose();
RequestPresent(bool secureOrigin) => (bool success);
ExitPresent();
SubmitFrame(VRPose? pose);
UpdateLayerBounds(VRLayerBounds leftBounds, VRLayerBounds rightBounds);
};
interface VRDisplayClient {
OnChanged(VRDisplayInfo display);
OnExitPresent();
OnBlur();
OnFocus();
OnActivate(VRDisplayEventReason reason);
OnDeactivate(VRDisplayEventReason reason);
};