Plasma Engine  2.0
Loading...
Searching...
No Matches
DummyXR.h
1#pragma once
2
3#include <GameEngine/GameEngineDLL.h>
4
5#include <Foundation/Configuration/Singleton.h>
6#include <GameEngine/GameApplication/WindowOutputTarget.h>
7#include <GameEngine/XR/Declarations.h>
8#include <GameEngine/XR/XRInputDevice.h>
9#include <GameEngine/XR/XRInterface.h>
10#include <RendererCore/Pipeline/Declarations.h>
11
12struct plGALDeviceEvent;
15
16class PL_GAMEENGINE_DLL plDummyXRInput : public plXRInputDevice
17{
18
19public:
20 void GetDeviceList(plHybridArray<plXRDeviceID, 64>& out_devices) const override;
21 plXRDeviceID GetDeviceIDByType(plXRDeviceType::Enum type) const override;
22 const plXRDeviceState& GetDeviceState(plXRDeviceID deviceID) const override;
23 plString GetDeviceName(plXRDeviceID deviceID) const override;
24 plBitflags<plXRDeviceFeatures> GetDeviceFeatures(plXRDeviceID deviceID) const override;
25
26protected:
27 void InitializeDevice() override;
28 void UpdateInputSlotValues() override;
29 void RegisterInputSlots() override;
30
31protected:
32 friend class plDummyXR;
33
34 plXRDeviceState m_DeviceState[1];
35};
36
37class PL_GAMEENGINE_DLL plDummyXR : public plXRInterface
38{
39 PL_DECLARE_SINGLETON_OF_INTERFACE(plDummyXR, plXRInterface);
40
41public:
42 plDummyXR();
43 ~plDummyXR() = default;
44
45 bool IsHmdPresent() const override;
46 plResult Initialize() override;
47 void Deinitialize() override;
48 bool IsInitialized() const override;
49 const plHMDInfo& GetHmdInfo() const override;
50 plXRInputDevice& GetXRInput() const override;
51 bool SupportsCompanionView() override;
52 plUniquePtr<plActor> CreateActor(plView* pView, plGALMSAASampleCount::Enum msaaCount = plGALMSAASampleCount::None, plUniquePtr<plWindowBase> pCompanionWindow = nullptr, plUniquePtr<plWindowOutputTargetGAL> pCompanionWindowOutput = nullptr) override;
53 plGALTextureHandle GetCurrentTexture() override;
54 void OnActorDestroyed() override;
55 void GALDeviceEventHandler(const plGALDeviceEvent& e);
56 void GameApplicationEventHandler(const plGameApplicationExecutionEvent& e);
57
58protected:
59 float m_fHeadHeight = 1.7f;
60 float m_fEyeOffset = 0.05f;
61
62
63 plHMDInfo m_Info;
64 mutable plDummyXRInput m_Input;
65 bool m_bInitialized = false;
66
67 plEventSubscriptionID m_GALdeviceEventsId = 0;
68 plEventSubscriptionID m_ExecutionEventsId = 0;
69
70 plWorld* m_pWorld = nullptr;
71 plCamera* m_pCameraToSynchronize = nullptr;
73
74 plViewHandle m_hView;
75 plGALTextureHandle m_hColorRT;
76 plGALTextureHandle m_hDepthRT;
77
78 plWindowOutputTargetXR* m_pCompanion = nullptr;
79};
A camera class that stores the orientation and some basic camera settings.
Definition Camera.h:41
Definition DummyXR.h:38
Definition DummyXR.h:17
Definition RendererFoundationDLL.h:411
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
virtual void UpdateInputSlotValues()=0
Override this, if you need to query the state of the hardware to update the input slots.
virtual void InitializeDevice()=0
Override this if you need to do device specific initialization before the first use.
virtual void RegisterInputSlots()=0
Override this to register all the input slots that this device exposes.
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
Definition Declarations.h:64
Encapsulates a view on the given world through the given camera and rendered with the specified Rende...
Definition View.h:21
XR Window output target base implementation. Optionally wraps a companion window output target.
Definition XRWindow.h:42
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Definition XRInputDevice.h:49
virtual void GetDeviceList(plHybridArray< plXRDeviceID, 64 > &out_devices) const =0
Fills out a list of valid (connected) device IDs.
virtual plString GetDeviceName(plXRDeviceID deviceID) const =0
Returns the device name for a valid device ID.
virtual const plXRDeviceState & GetDeviceState(plXRDeviceID deviceID) const =0
Returns the current device state for a valid device ID.
virtual plBitflags< plXRDeviceFeatures > GetDeviceFeatures(plXRDeviceID deviceID) const =0
Returns the device features for a valid device ID.
virtual plXRDeviceID GetDeviceIDByType(plXRDeviceType::Enum type) const =0
Returns the deviceID for a specific type of device. If the device is not connected,...
XR singleton interface. Needs to be initialized to be used for VR or AR purposes.
Definition XRInterface.h:29
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Type for important GAL events.
Definition Descriptors.h:253
Definition GameApplicationBase.h:32
Definition Declarations.h:9
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
A device's pose state.
Definition Declarations.h:80
@ Seated
Tracking poses will be relative to a seated head position.
Definition Declarations.h:24