gecko-dev/gfx/vr/service/OSVRSession.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

76 строки
2.3 KiB
C
Исходник Обычный вид История

Bug 1466701 - Refactor gfxVROSVR.cpp to use gfxVRExternal interface r=daoshengmu Differential Revision: https://phabricator.services.mozilla.com/D7352 --HG-- rename : gfx/vr/osvr/ClientKit/ClientKitC.h => gfx/vr/service/osvr/ClientKit/ClientKitC.h rename : gfx/vr/osvr/ClientKit/ContextC.h => gfx/vr/service/osvr/ClientKit/ContextC.h rename : gfx/vr/osvr/ClientKit/DisplayC.h => gfx/vr/service/osvr/ClientKit/DisplayC.h rename : gfx/vr/osvr/ClientKit/Export.h => gfx/vr/service/osvr/ClientKit/Export.h rename : gfx/vr/osvr/ClientKit/InterfaceC.h => gfx/vr/service/osvr/ClientKit/InterfaceC.h rename : gfx/vr/osvr/ClientKit/InterfaceCallbackC.h => gfx/vr/service/osvr/ClientKit/InterfaceCallbackC.h rename : gfx/vr/osvr/ClientKit/InterfaceStateC.h => gfx/vr/service/osvr/ClientKit/InterfaceStateC.h rename : gfx/vr/osvr/ClientKit/SystemCallbackC.h => gfx/vr/service/osvr/ClientKit/SystemCallbackC.h rename : gfx/vr/osvr/ClientKit/TransformsC.h => gfx/vr/service/osvr/ClientKit/TransformsC.h rename : gfx/vr/osvr/Util/APIBaseC.h => gfx/vr/service/osvr/Util/APIBaseC.h rename : gfx/vr/osvr/Util/AnnotationMacrosC.h => gfx/vr/service/osvr/Util/AnnotationMacrosC.h rename : gfx/vr/osvr/Util/BoolC.h => gfx/vr/service/osvr/Util/BoolC.h rename : gfx/vr/osvr/Util/ChannelCountC.h => gfx/vr/service/osvr/Util/ChannelCountC.h rename : gfx/vr/osvr/Util/ClientCallbackTypesC.h => gfx/vr/service/osvr/Util/ClientCallbackTypesC.h rename : gfx/vr/osvr/Util/ClientOpaqueTypesC.h => gfx/vr/service/osvr/Util/ClientOpaqueTypesC.h rename : gfx/vr/osvr/Util/ClientReportTypesC.h => gfx/vr/service/osvr/Util/ClientReportTypesC.h rename : gfx/vr/osvr/Util/Export.h => gfx/vr/service/osvr/Util/Export.h rename : gfx/vr/osvr/Util/ImagingReportTypesC.h => gfx/vr/service/osvr/Util/ImagingReportTypesC.h rename : gfx/vr/osvr/Util/MatrixConventionsC.h => gfx/vr/service/osvr/Util/MatrixConventionsC.h rename : gfx/vr/osvr/Util/PlatformConfig.h => gfx/vr/service/osvr/Util/PlatformConfig.h rename : gfx/vr/osvr/Util/Pose3C.h => gfx/vr/service/osvr/Util/Pose3C.h rename : gfx/vr/osvr/Util/QuaternionC.h => gfx/vr/service/osvr/Util/QuaternionC.h rename : gfx/vr/osvr/Util/QuatlibInteropC.h => gfx/vr/service/osvr/Util/QuatlibInteropC.h rename : gfx/vr/osvr/Util/RadialDistortionParametersC.h => gfx/vr/service/osvr/Util/RadialDistortionParametersC.h rename : gfx/vr/osvr/Util/RenderingTypesC.h => gfx/vr/service/osvr/Util/RenderingTypesC.h rename : gfx/vr/osvr/Util/ReturnCodesC.h => gfx/vr/service/osvr/Util/ReturnCodesC.h rename : gfx/vr/osvr/Util/StdInt.h => gfx/vr/service/osvr/Util/StdInt.h rename : gfx/vr/osvr/Util/TimeValueC.h => gfx/vr/service/osvr/Util/TimeValueC.h rename : gfx/vr/osvr/Util/Vec2C.h => gfx/vr/service/osvr/Util/Vec2C.h rename : gfx/vr/osvr/Util/Vec3C.h => gfx/vr/service/osvr/Util/Vec3C.h extra : moz-landing-system : lando
2018-10-02 03:24:40 +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
* 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_SERVICE_OSVRSESSION_H
#define GFX_VR_SERVICE_OSVRSESSION_H
#include "VRSession.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/TimeStamp.h"
#include "moz_external_vr.h"
#include <osvr/ClientKit/ClientKitC.h>
#include <osvr/ClientKit/DisplayC.h>
#if defined(XP_WIN)
# include <d3d11_1.h>
#endif
namespace mozilla {
namespace gfx {
class OSVRSession : public VRSession {
public:
OSVRSession();
virtual ~OSVRSession();
bool Initialize(mozilla::gfx::VRSystemState& aSystemState) override;
void Shutdown() override;
void ProcessEvents(mozilla::gfx::VRSystemState& aSystemState) override;
void StartFrame(mozilla::gfx::VRSystemState& aSystemState) override;
bool StartPresentation() override;
void StopPresentation() override;
void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex,
float aIntensity, float aDuration) override;
void StopVibrateHaptic(uint32_t aControllerIdx) override;
void StopAllHaptics() override;
protected:
#if defined(XP_WIN)
bool SubmitFrame(const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
ID3D11Texture2D* aTexture) override;
#elif defined(XP_MACOSX)
bool SubmitFrame(const mozilla::gfx::VRLayer_Stereo_Immersive& aLayer,
const VRLayerTextureHandle& aTexture) override;
#endif
Bug 1466701 - Refactor gfxVROSVR.cpp to use gfxVRExternal interface r=daoshengmu Differential Revision: https://phabricator.services.mozilla.com/D7352 --HG-- rename : gfx/vr/osvr/ClientKit/ClientKitC.h => gfx/vr/service/osvr/ClientKit/ClientKitC.h rename : gfx/vr/osvr/ClientKit/ContextC.h => gfx/vr/service/osvr/ClientKit/ContextC.h rename : gfx/vr/osvr/ClientKit/DisplayC.h => gfx/vr/service/osvr/ClientKit/DisplayC.h rename : gfx/vr/osvr/ClientKit/Export.h => gfx/vr/service/osvr/ClientKit/Export.h rename : gfx/vr/osvr/ClientKit/InterfaceC.h => gfx/vr/service/osvr/ClientKit/InterfaceC.h rename : gfx/vr/osvr/ClientKit/InterfaceCallbackC.h => gfx/vr/service/osvr/ClientKit/InterfaceCallbackC.h rename : gfx/vr/osvr/ClientKit/InterfaceStateC.h => gfx/vr/service/osvr/ClientKit/InterfaceStateC.h rename : gfx/vr/osvr/ClientKit/SystemCallbackC.h => gfx/vr/service/osvr/ClientKit/SystemCallbackC.h rename : gfx/vr/osvr/ClientKit/TransformsC.h => gfx/vr/service/osvr/ClientKit/TransformsC.h rename : gfx/vr/osvr/Util/APIBaseC.h => gfx/vr/service/osvr/Util/APIBaseC.h rename : gfx/vr/osvr/Util/AnnotationMacrosC.h => gfx/vr/service/osvr/Util/AnnotationMacrosC.h rename : gfx/vr/osvr/Util/BoolC.h => gfx/vr/service/osvr/Util/BoolC.h rename : gfx/vr/osvr/Util/ChannelCountC.h => gfx/vr/service/osvr/Util/ChannelCountC.h rename : gfx/vr/osvr/Util/ClientCallbackTypesC.h => gfx/vr/service/osvr/Util/ClientCallbackTypesC.h rename : gfx/vr/osvr/Util/ClientOpaqueTypesC.h => gfx/vr/service/osvr/Util/ClientOpaqueTypesC.h rename : gfx/vr/osvr/Util/ClientReportTypesC.h => gfx/vr/service/osvr/Util/ClientReportTypesC.h rename : gfx/vr/osvr/Util/Export.h => gfx/vr/service/osvr/Util/Export.h rename : gfx/vr/osvr/Util/ImagingReportTypesC.h => gfx/vr/service/osvr/Util/ImagingReportTypesC.h rename : gfx/vr/osvr/Util/MatrixConventionsC.h => gfx/vr/service/osvr/Util/MatrixConventionsC.h rename : gfx/vr/osvr/Util/PlatformConfig.h => gfx/vr/service/osvr/Util/PlatformConfig.h rename : gfx/vr/osvr/Util/Pose3C.h => gfx/vr/service/osvr/Util/Pose3C.h rename : gfx/vr/osvr/Util/QuaternionC.h => gfx/vr/service/osvr/Util/QuaternionC.h rename : gfx/vr/osvr/Util/QuatlibInteropC.h => gfx/vr/service/osvr/Util/QuatlibInteropC.h rename : gfx/vr/osvr/Util/RadialDistortionParametersC.h => gfx/vr/service/osvr/Util/RadialDistortionParametersC.h rename : gfx/vr/osvr/Util/RenderingTypesC.h => gfx/vr/service/osvr/Util/RenderingTypesC.h rename : gfx/vr/osvr/Util/ReturnCodesC.h => gfx/vr/service/osvr/Util/ReturnCodesC.h rename : gfx/vr/osvr/Util/StdInt.h => gfx/vr/service/osvr/Util/StdInt.h rename : gfx/vr/osvr/Util/TimeValueC.h => gfx/vr/service/osvr/Util/TimeValueC.h rename : gfx/vr/osvr/Util/Vec2C.h => gfx/vr/service/osvr/Util/Vec2C.h rename : gfx/vr/osvr/Util/Vec3C.h => gfx/vr/service/osvr/Util/Vec3C.h extra : moz-landing-system : lando
2018-10-02 03:24:40 +03:00
private:
bool InitState(mozilla::gfx::VRSystemState& aSystemState);
void UpdateHeadsetPose(mozilla::gfx::VRSystemState& aState);
bool mRuntimeLoaded;
bool mOSVRInitialized;
bool mClientContextInitialized;
bool mDisplayConfigInitialized;
bool mInterfaceInitialized;
OSVR_ClientContext m_ctx;
OSVR_ClientInterface m_iface;
OSVR_DisplayConfig m_display;
gfx::Matrix4x4 mHeadToEye[2];
// check if all components are initialized
// and if not, it will try to initialize them
void CheckOSVRStatus();
void InitializeClientContext();
void InitializeDisplay();
void InitializeInterface();
};
} // namespace gfx
} // namespace mozilla
#endif // GFX_VR_SERVICE_OSVRSESSION_H