| Index: public/platform/WebVR.h
|
| diff --git a/public/platform/WebVR.h b/public/platform/WebVR.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..817d44e842e96fa9dc1017f0ea6a445471b9f158
|
| --- /dev/null
|
| +++ b/public/platform/WebVR.h
|
| @@ -0,0 +1,109 @@
|
| +// Copyright 2014 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.
|
| +
|
| +#ifndef WebVR_h
|
| +#define WebVR_h
|
| +
|
| +#include "WebCommon.h"
|
| +
|
| +#if BLINK_IMPLEMENTATION
|
| +#include "wtf/Assertions.h"
|
| +#endif
|
| +
|
| +namespace blink {
|
| +
|
| +#pragma pack(push, 1)
|
| +
|
| +struct WebVRVector3 {
|
| + float x, y, z;
|
| +};
|
| +
|
| +struct WebVRVector4 {
|
| + float x, y, z, w;
|
| +};
|
| +
|
| +struct WebVRFieldOfView {
|
| + float upDegrees;
|
| + float downDegrees;
|
| + float leftDegrees;
|
| + float rightDegrees;
|
| +};
|
| +
|
| +enum WebVRSensorState {
|
| + WebVRSensorStateOrientation = 1 << 1,
|
| + WebVRSensorStatePosition = 1 << 2,
|
| + WebVRSensorStateAngularVelocity = 1 << 3,
|
| + WebVRSensorStateLinearVelocity = 1 << 4,
|
| + WebVRSensorStateAngularAcceleration = 1 << 5,
|
| + WebVRSensorStateLinearAcceleration = 1 << 6,
|
| + WebVRSensorStateComplete = (1 << 7) - 1 // All previous states combined
|
| +};
|
| +
|
| +// A bitfield of WebVRSensorState
|
| +typedef int WebVRSensorStateMask;
|
| +
|
| +enum WebVRDeviceType {
|
| + WebVRDeviceTypePosition = 1 << 1,
|
| + WebVRDeviceTypeHMD = 1 << 2
|
| +};
|
| +
|
| +// A bitfield of WebVRDeviceType
|
| +typedef int WebVRDeviceTypeMask;
|
| +
|
| +class WebHMDSensorState {
|
| +public:
|
| + WebHMDSensorState()
|
| + {
|
| + }
|
| +
|
| + double timestamp;
|
| + unsigned frameIndex;
|
| + WebVRSensorStateMask flags;
|
| + WebVRVector4 orientation;
|
| + WebVRVector3 position;
|
| + WebVRVector3 angularVelocity;
|
| + WebVRVector3 linearVelocity;
|
| + WebVRVector3 angularAcceleration;
|
| + WebVRVector3 linearAcceleration;
|
| +};
|
| +
|
| +struct WebVRHMDInfo {
|
| + WebVRFieldOfView recommendedFOVLeft;
|
| + WebVRFieldOfView recommendedFOVRight;
|
| + WebVRFieldOfView maximumFOVLeft;
|
| + WebVRFieldOfView maximumFOVRight;
|
| + WebVRVector3 eyeTranslationLeft;
|
| + WebVRVector3 eyeTranslationRight;
|
| +};
|
| +
|
| +class WebVRDevice {
|
| +public:
|
| + static const size_t deviceIdLengthCap = 128;
|
| + static const size_t deviceNameLengthCap = 128;
|
| +
|
| + WebVRDevice()
|
| + : flags(0)
|
| + {
|
| + deviceId[0] = 0;
|
| + deviceName[0] = 0;
|
| + }
|
| +
|
| + // Index for this hardware unit
|
| + unsigned index;
|
| + // Device identifier (based on manufacturer, model, etc.).
|
| + WebUChar deviceId[deviceIdLengthCap];
|
| + // Friendly device name
|
| + WebUChar deviceName[deviceNameLengthCap];
|
| +
|
| + WebVRDeviceTypeMask flags;
|
| +
|
| + // Will only contain valid data if (flags & HasHMDDevice)
|
| + WebVRHMDInfo hmdInfo;
|
| +};
|
| +
|
| +#pragma pack(pop)
|
| +
|
| +}
|
| +
|
| +#endif // WebVR_h
|
|
|