2017-10-28 02:10:06 +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: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2016-02-25 02:54:50 +03:00
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
#ifndef GFX_VR_DISPLAY_CLIENT_H
|
|
|
|
#define GFX_VR_DISPLAY_CLIENT_H
|
|
|
|
|
|
|
|
#include "nsIScreen.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2019-03-19 19:02:12 +03:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-02-25 02:54:50 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/dom/VRDisplayBinding.h"
|
|
|
|
|
|
|
|
#include "gfxVR.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class VRDisplayPresentation;
|
|
|
|
class VRManagerChild;
|
|
|
|
|
|
|
|
class VRDisplayClient {
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayClient)
|
|
|
|
|
|
|
|
explicit VRDisplayClient(const VRDisplayInfo& aDisplayInfo);
|
|
|
|
|
2019-03-19 19:02:12 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT void UpdateDisplayInfo(const VRDisplayInfo& aDisplayInfo);
|
2017-05-23 11:55:30 +03:00
|
|
|
void UpdateSubmitFrameResult(const VRSubmitFrameResultInfo& aResult);
|
2016-02-25 02:54:50 +03:00
|
|
|
|
|
|
|
const VRDisplayInfo& GetDisplayInfo() const { return mDisplayInfo; }
|
2018-12-18 22:39:44 +03:00
|
|
|
virtual const VRHMDSensorState& GetSensorState() const;
|
2017-05-23 11:55:30 +03:00
|
|
|
void GetSubmitFrameResult(VRSubmitFrameResultInfo& aResult);
|
2016-02-25 02:54:50 +03:00
|
|
|
|
|
|
|
virtual void ZeroSensor();
|
|
|
|
|
2017-05-09 02:01:36 +03:00
|
|
|
already_AddRefed<VRDisplayPresentation> BeginPresentation(
|
|
|
|
const nsTArray<dom::VRLayer>& aLayers, uint32_t aGroup);
|
2016-02-25 02:54:50 +03:00
|
|
|
void PresentationDestroyed();
|
|
|
|
|
|
|
|
bool GetIsConnected() const;
|
|
|
|
|
|
|
|
void NotifyDisconnected();
|
2017-05-09 02:01:36 +03:00
|
|
|
void SetGroupMask(uint32_t aGroupMask);
|
2016-02-25 02:54:50 +03:00
|
|
|
|
2017-11-01 03:25:40 +03:00
|
|
|
bool IsPresentationGenerationCurrent() const;
|
|
|
|
void MakePresentationGenerationCurrent();
|
|
|
|
|
2018-07-31 04:41:25 +03:00
|
|
|
void StartVRNavigation();
|
|
|
|
void StopVRNavigation(const TimeDuration& aTimeout);
|
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
protected:
|
|
|
|
virtual ~VRDisplayClient();
|
|
|
|
|
2019-03-19 19:02:12 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT void FireEvents();
|
2018-07-11 22:20:51 +03:00
|
|
|
void FireGamepadEvents();
|
2017-05-09 02:01:36 +03:00
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
VRDisplayInfo mDisplayInfo;
|
|
|
|
|
2016-10-19 01:18:10 +03:00
|
|
|
bool bLastEventWasMounted;
|
2016-02-25 02:54:50 +03:00
|
|
|
bool bLastEventWasPresenting;
|
|
|
|
|
|
|
|
int mPresentationCount;
|
2017-09-15 23:38:47 +03:00
|
|
|
uint64_t mLastEventFrameId;
|
2017-11-01 03:25:40 +03:00
|
|
|
uint32_t mLastPresentingGeneration;
|
2018-07-11 22:20:51 +03:00
|
|
|
|
|
|
|
// Difference between mDisplayInfo.mControllerState and
|
|
|
|
// mLastEventControllerState determines what gamepad events to fire when
|
|
|
|
// updated.
|
|
|
|
VRControllerState mLastEventControllerState[kVRControllerMaxCount];
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-05-23 11:55:30 +03:00
|
|
|
private:
|
|
|
|
VRSubmitFrameResultInfo mSubmitFrameResult;
|
2016-02-25 02:54:50 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* GFX_VR_DISPLAY_CLIENT_H */
|