2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-07-09 23:24:49 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2016-04-13 03:39:28 +03:00
|
|
|
#ifndef mozilla_dom_VRDisplay_h_
|
|
|
|
#define mozilla_dom_VRDisplay_h_
|
2014-07-09 23:24:49 +04:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "mozilla/dom/TypedArray.h"
|
2016-04-13 03:39:28 +03:00
|
|
|
#include "mozilla/dom/VRDisplayBinding.h"
|
2016-02-25 02:54:50 +03:00
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
2014-07-09 23:24:49 +04:00
|
|
|
#include "mozilla/dom/DOMPoint.h"
|
|
|
|
#include "mozilla/dom/DOMRect.h"
|
2016-10-24 13:04:41 +03:00
|
|
|
#include "mozilla/dom/Pose.h"
|
2017-04-04 21:27:14 +03:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2014-07-09 23:24:49 +04:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
|
|
|
#include "gfxVR.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
2016-02-25 02:54:50 +03:00
|
|
|
namespace gfx {
|
|
|
|
class VRDisplayClient;
|
|
|
|
class VRDisplayPresentation;
|
|
|
|
struct VRFieldOfView;
|
|
|
|
enum class VRDisplayCapabilityFlags : uint16_t;
|
|
|
|
struct VRHMDSensorState;
|
|
|
|
}
|
2014-07-09 23:24:49 +04:00
|
|
|
namespace dom {
|
2015-09-18 00:23:13 +03:00
|
|
|
class Navigator;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
class VRFieldOfView final : public nsWrapperCache
|
2014-07-09 23:24:49 +04:00
|
|
|
{
|
|
|
|
public:
|
2016-02-25 02:54:50 +03:00
|
|
|
VRFieldOfView(nsISupports* aParent,
|
|
|
|
double aUpDegrees, double aRightDegrees,
|
|
|
|
double aDownDegrees, double aLeftDegrees);
|
|
|
|
VRFieldOfView(nsISupports* aParent, const gfx::VRFieldOfView& aSrc);
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(VRFieldOfView)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(VRFieldOfView)
|
2015-04-01 23:02:20 +03:00
|
|
|
|
2014-07-09 23:24:49 +04:00
|
|
|
double UpDegrees() const { return mUpDegrees; }
|
|
|
|
double RightDegrees() const { return mRightDegrees; }
|
|
|
|
double DownDegrees() const { return mDownDegrees; }
|
|
|
|
double LeftDegrees() const { return mLeftDegrees; }
|
|
|
|
|
2015-04-01 23:02:20 +03:00
|
|
|
nsISupports* GetParentObject() const { return mParent; }
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2014-07-09 23:24:49 +04:00
|
|
|
protected:
|
2016-02-25 02:54:50 +03:00
|
|
|
virtual ~VRFieldOfView() {}
|
2015-04-01 23:02:20 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mParent;
|
|
|
|
|
2014-07-09 23:24:49 +04:00
|
|
|
double mUpDegrees;
|
|
|
|
double mRightDegrees;
|
|
|
|
double mDownDegrees;
|
|
|
|
double mLeftDegrees;
|
|
|
|
};
|
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
class VRDisplayCapabilities final : public nsWrapperCache
|
2014-07-09 23:24:49 +04:00
|
|
|
{
|
|
|
|
public:
|
2016-02-25 02:54:50 +03:00
|
|
|
VRDisplayCapabilities(nsISupports* aParent, const gfx::VRDisplayCapabilityFlags& aFlags)
|
|
|
|
: mParent(aParent)
|
|
|
|
, mFlags(aFlags)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(VRDisplayCapabilities)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(VRDisplayCapabilities)
|
|
|
|
|
|
|
|
nsISupports* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mParent;
|
|
|
|
}
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2015-04-01 23:02:20 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
bool HasPosition() const;
|
|
|
|
bool HasOrientation() const;
|
|
|
|
bool HasExternalDisplay() const;
|
|
|
|
bool CanPresent() const;
|
|
|
|
uint32_t MaxLayers() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
~VRDisplayCapabilities() {}
|
|
|
|
nsCOMPtr<nsISupports> mParent;
|
|
|
|
gfx::VRDisplayCapabilityFlags mFlags;
|
2014-07-09 23:24:49 +04:00
|
|
|
};
|
|
|
|
|
2016-10-24 13:04:41 +03:00
|
|
|
class VRPose final : public Pose
|
2014-07-09 23:24:49 +04:00
|
|
|
{
|
2016-02-25 02:54:50 +03:00
|
|
|
|
2014-07-09 23:24:49 +04:00
|
|
|
public:
|
2016-02-25 02:54:50 +03:00
|
|
|
VRPose(nsISupports* aParent, const gfx::VRHMDSensorState& aState);
|
2016-10-01 02:43:33 +03:00
|
|
|
explicit VRPose(nsISupports* aParent);
|
2016-02-25 02:54:50 +03:00
|
|
|
|
2017-09-15 23:38:47 +03:00
|
|
|
uint64_t FrameID() const { return mFrameId; }
|
2016-02-25 02:54:50 +03:00
|
|
|
|
2016-10-24 13:04:41 +03:00
|
|
|
virtual void GetPosition(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv) override;
|
|
|
|
virtual void GetLinearVelocity(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv) override;
|
|
|
|
virtual void GetLinearAcceleration(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv) override;
|
|
|
|
virtual void GetOrientation(JSContext* aCx,
|
2016-02-25 02:54:50 +03:00
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
2016-10-24 13:04:41 +03:00
|
|
|
ErrorResult& aRv) override;
|
|
|
|
virtual void GetAngularVelocity(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv) override;
|
|
|
|
virtual void GetAngularAcceleration(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv) override;
|
2016-02-25 02:54:50 +03:00
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
protected:
|
2016-08-17 23:39:54 +03:00
|
|
|
~VRPose();
|
2016-02-25 02:54:50 +03:00
|
|
|
|
2017-09-15 23:38:47 +03:00
|
|
|
uint64_t mFrameId;
|
2016-02-25 02:54:50 +03:00
|
|
|
gfx::VRHMDSensorState mVRState;
|
|
|
|
};
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-10-07 02:32:16 +03:00
|
|
|
struct VRFrameInfo
|
|
|
|
{
|
|
|
|
VRFrameInfo();
|
|
|
|
|
|
|
|
void Update(const gfx::VRDisplayInfo& aInfo,
|
|
|
|
const gfx::VRHMDSensorState& aState,
|
|
|
|
float aDepthNear,
|
|
|
|
float aDepthFar);
|
|
|
|
|
|
|
|
void Clear();
|
|
|
|
bool IsDirty();
|
|
|
|
|
|
|
|
gfx::VRHMDSensorState mVRState;
|
|
|
|
gfx::Matrix4x4 mLeftProjection;
|
|
|
|
gfx::Matrix4x4 mLeftView;
|
|
|
|
gfx::Matrix4x4 mRightProjection;
|
|
|
|
gfx::Matrix4x4 mRightView;
|
|
|
|
|
2017-03-04 02:17:19 +03:00
|
|
|
/**
|
|
|
|
* In order to avoid leaking information related to the duration of
|
|
|
|
* the user's VR session, we re-base timestamps.
|
|
|
|
* mTimeStampOffset is added to the actual timestamp returned by the
|
|
|
|
* underlying VR platform API when returned through WebVR API's.
|
|
|
|
*/
|
|
|
|
double mTimeStampOffset;
|
2016-10-07 02:32:16 +03:00
|
|
|
};
|
|
|
|
|
2016-10-01 02:43:33 +03:00
|
|
|
class VRFrameData final : public nsWrapperCache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(VRFrameData)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(VRFrameData)
|
|
|
|
|
|
|
|
explicit VRFrameData(nsISupports* aParent);
|
|
|
|
static already_AddRefed<VRFrameData> Constructor(const GlobalObject& aGlobal,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2016-10-07 02:32:16 +03:00
|
|
|
void Update(const VRFrameInfo& aFrameInfo);
|
2016-10-01 02:43:33 +03:00
|
|
|
|
|
|
|
// WebIDL Members
|
|
|
|
double Timestamp() const;
|
|
|
|
void GetLeftProjectionMatrix(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
void GetLeftViewMatrix(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
void GetRightProjectionMatrix(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
void GetRightViewMatrix(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
VRPose* Pose();
|
|
|
|
|
|
|
|
// WebIDL Boilerplate
|
|
|
|
nsISupports* GetParentObject() const { return mParent; }
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
~VRFrameData();
|
|
|
|
nsCOMPtr<nsISupports> mParent;
|
|
|
|
|
2016-10-07 02:32:16 +03:00
|
|
|
VRFrameInfo mFrameInfo;
|
2016-10-01 02:43:33 +03:00
|
|
|
RefPtr<VRPose> mPose;
|
|
|
|
JS::Heap<JSObject*> mLeftProjectionMatrix;
|
|
|
|
JS::Heap<JSObject*> mLeftViewMatrix;
|
|
|
|
JS::Heap<JSObject*> mRightProjectionMatrix;
|
|
|
|
JS::Heap<JSObject*> mRightViewMatrix;
|
|
|
|
|
|
|
|
void LazyCreateMatrix(JS::Heap<JSObject*>& aArray, gfx::Matrix4x4& aMat,
|
|
|
|
JSContext* aCx, JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
};
|
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
class VRStageParameters final : public nsWrapperCache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VRStageParameters(nsISupports* aParent,
|
|
|
|
const gfx::Matrix4x4& aSittingToStandingTransform,
|
2016-08-17 23:39:54 +03:00
|
|
|
const gfx::Size& aSize);
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(VRStageParameters)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(VRStageParameters)
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
void GetSittingToStandingTransform(JSContext* aCx,
|
|
|
|
JS::MutableHandle<JSObject*> aRetval,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
float SizeX() const { return mSize.width; }
|
|
|
|
float SizeZ() const { return mSize.height; }
|
2014-07-09 23:24:49 +04:00
|
|
|
|
|
|
|
nsISupports* GetParentObject() const { return mParent; }
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
|
|
|
protected:
|
2016-08-17 23:39:54 +03:00
|
|
|
~VRStageParameters();
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
nsCOMPtr<nsISupports> mParent;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
gfx::Matrix4x4 mSittingToStandingTransform;
|
|
|
|
JS::Heap<JSObject*> mSittingToStandingTransformArray;
|
|
|
|
gfx::Size mSize;
|
2014-07-09 23:24:49 +04:00
|
|
|
};
|
|
|
|
|
2015-04-01 23:02:20 +03:00
|
|
|
class VREyeParameters final : public nsWrapperCache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
VREyeParameters(nsISupports* aParent,
|
|
|
|
const gfx::Point3D& aEyeTranslation,
|
2016-02-25 02:54:50 +03:00
|
|
|
const gfx::VRFieldOfView& aFOV,
|
|
|
|
const gfx::IntSize& aRenderSize);
|
2015-04-01 23:02:20 +03:00
|
|
|
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(VREyeParameters)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(VREyeParameters)
|
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
void GetOffset(JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
VRFieldOfView* FieldOfView();
|
2015-04-01 23:02:20 +03:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
uint32_t RenderWidth() const { return mRenderSize.width; }
|
|
|
|
uint32_t RenderHeight() const { return mRenderSize.height; }
|
2015-04-01 23:02:20 +03:00
|
|
|
|
|
|
|
nsISupports* GetParentObject() const { return mParent; }
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
protected:
|
2016-08-17 23:39:54 +03:00
|
|
|
~VREyeParameters();
|
2015-04-01 23:02:20 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mParent;
|
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
|
|
|
|
gfx::Point3D mEyeTranslation;
|
|
|
|
gfx::IntSize mRenderSize;
|
|
|
|
JS::Heap<JSObject*> mOffset;
|
|
|
|
RefPtr<VRFieldOfView> mFOV;
|
2015-04-01 23:02:20 +03:00
|
|
|
};
|
|
|
|
|
2017-05-23 12:13:15 +03:00
|
|
|
class VRSubmitFrameResult final : public nsWrapperCache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(VRSubmitFrameResult)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(VRSubmitFrameResult)
|
|
|
|
|
|
|
|
explicit VRSubmitFrameResult(nsISupports* aParent);
|
|
|
|
static already_AddRefed<VRSubmitFrameResult> Constructor(const GlobalObject& aGlobal,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2017-09-15 23:38:47 +03:00
|
|
|
void Update(uint64_t aFrameNum, const nsACString& aBase64Image);
|
2017-05-23 12:13:15 +03:00
|
|
|
// WebIDL Members
|
|
|
|
double FrameNum() const;
|
|
|
|
void GetBase64Image(nsAString& aImage) const;
|
|
|
|
|
|
|
|
// WebIDL Boilerplate
|
|
|
|
nsISupports* GetParentObject() const { return mParent; }
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
~VRSubmitFrameResult();
|
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mParent;
|
|
|
|
nsString mBase64Image;
|
2017-09-15 23:38:47 +03:00
|
|
|
uint64_t mFrameNum;
|
2017-05-23 12:13:15 +03:00
|
|
|
};
|
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
class VRDisplay final : public DOMEventTargetHelper
|
|
|
|
, public nsIObserver
|
2014-07-09 23:24:49 +04:00
|
|
|
{
|
|
|
|
public:
|
2016-02-25 02:54:50 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(VRDisplay, DOMEventTargetHelper)
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2017-05-09 02:01:36 +03:00
|
|
|
uint32_t PresentingGroups() const;
|
|
|
|
uint32_t GroupMask() const;
|
|
|
|
void SetGroupMask(const uint32_t& aGroupMask);
|
|
|
|
bool IsAnyPresenting(uint32_t aGroupMask) const;
|
2016-02-25 02:54:50 +03:00
|
|
|
bool IsPresenting() const;
|
|
|
|
bool IsConnected() const;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
VRDisplayCapabilities* Capabilities();
|
|
|
|
VRStageParameters* GetStageParameters();
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
uint32_t DisplayId() const { return mDisplayId; }
|
|
|
|
void GetDisplayName(nsAString& aDisplayName) const { aDisplayName = mDisplayName; }
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-11-24 22:50:43 +03:00
|
|
|
static bool RefreshVRDisplays(uint64_t aWindowId);
|
2016-02-25 02:54:50 +03:00
|
|
|
static void UpdateVRDisplays(nsTArray<RefPtr<VRDisplay> >& aDisplays,
|
|
|
|
nsPIDOMWindowInner* aWindow);
|
2015-09-18 00:23:13 +03:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
gfx::VRDisplayClient *GetClient() {
|
|
|
|
return mClient;
|
2015-09-18 00:23:13 +03:00
|
|
|
}
|
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
virtual already_AddRefed<VREyeParameters> GetEyeParameters(VREye aEye);
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-10-01 02:43:33 +03:00
|
|
|
bool GetFrameData(VRFrameData& aFrameData);
|
2017-05-23 12:13:15 +03:00
|
|
|
bool GetSubmitFrameResult(VRSubmitFrameResult& aResult);
|
2016-02-25 02:54:50 +03:00
|
|
|
already_AddRefed<VRPose> GetPose();
|
|
|
|
void ResetPose();
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
double DepthNear() {
|
|
|
|
return mDepthNear;
|
|
|
|
}
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
double DepthFar() {
|
|
|
|
return mDepthFar;
|
|
|
|
}
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
void SetDepthNear(double aDepthNear) {
|
|
|
|
// XXX When we start sending depth buffers to VRLayer's we will want
|
|
|
|
// to communicate this with the VRDisplayHost
|
|
|
|
mDepthNear = aDepthNear;
|
|
|
|
}
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
void SetDepthFar(double aDepthFar) {
|
|
|
|
// XXX When we start sending depth buffers to VRLayer's we will want
|
|
|
|
// to communicate this with the VRDisplayHost
|
|
|
|
mDepthFar = aDepthFar;
|
|
|
|
}
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2017-03-08 03:04:12 +03:00
|
|
|
already_AddRefed<Promise> RequestPresent(const nsTArray<VRLayer>& aLayers,
|
|
|
|
CallerType aCallerType,
|
|
|
|
ErrorResult& aRv);
|
2016-02-25 02:54:50 +03:00
|
|
|
already_AddRefed<Promise> ExitPresent(ErrorResult& aRv);
|
|
|
|
void GetLayers(nsTArray<VRLayer>& result);
|
2016-10-01 02:43:24 +03:00
|
|
|
void SubmitFrame();
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
int32_t RequestAnimationFrame(mozilla::dom::FrameRequestCallback& aCallback,
|
|
|
|
mozilla::ErrorResult& aError);
|
|
|
|
void CancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError);
|
2017-04-04 21:27:14 +03:00
|
|
|
void StartHandlingVRNavigationEvent();
|
|
|
|
void StopHandlingVRNavigationEvent();
|
|
|
|
bool IsHandlingVRNavigationEvent();
|
2014-07-09 23:24:49 +04:00
|
|
|
|
|
|
|
protected:
|
2016-02-25 02:54:50 +03:00
|
|
|
VRDisplay(nsPIDOMWindowInner* aWindow, gfx::VRDisplayClient* aClient);
|
|
|
|
virtual ~VRDisplay();
|
|
|
|
virtual void LastRelease() override;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
void ExitPresentInternal();
|
2017-04-13 02:22:29 +03:00
|
|
|
void Shutdown();
|
2016-10-07 02:32:16 +03:00
|
|
|
void UpdateFrameInfo();
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
RefPtr<gfx::VRDisplayClient> mClient;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
uint32_t mDisplayId;
|
|
|
|
nsString mDisplayName;
|
2015-09-18 00:23:13 +03:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
RefPtr<VRDisplayCapabilities> mCapabilities;
|
2016-07-22 22:41:00 +03:00
|
|
|
RefPtr<VRStageParameters> mStageParameters;
|
2015-09-18 00:23:13 +03:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
double mDepthNear;
|
|
|
|
double mDepthFar;
|
2014-07-09 23:24:49 +04:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
RefPtr<gfx::VRDisplayPresentation> mPresentation;
|
2016-10-07 02:32:16 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The WebVR 1.1 spec Requires that VRDisplay.getPose and VRDisplay.getFrameData
|
|
|
|
* must return the same values until the next VRDisplay.submitFrame.
|
|
|
|
* mFrameInfo is updated only on the first call to either function within one
|
|
|
|
* frame. Subsequent calls before the next SubmitFrame or ExitPresent call
|
|
|
|
* will use these cached values.
|
|
|
|
*/
|
|
|
|
VRFrameInfo mFrameInfo;
|
2017-04-04 21:27:14 +03:00
|
|
|
|
|
|
|
// Time at which we began expecting VR navigation.
|
|
|
|
TimeStamp mHandlingVRNavigationEventStart;
|
|
|
|
int32_t mVRNavigationEventDepth;
|
2017-04-13 02:22:29 +03:00
|
|
|
bool mShutdown;
|
2014-07-09 23:24:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|