/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/GameEngine/XR/Declarations.h
156 строк
5 KB
Sanakan8472
OpenXR plugin fixes (#1800)
30 янв 2026, 18:51
Не верифицирован
30 янв 2026, 18:51
52fc455
Код
Авторство
О чём код?
#pragma once #include <GameEngine/GameEngineDLL.h> #include <Foundation/Math/Size.h> #include <Foundation/Reflection/Reflection.h> struct ezHMDInfo { ezString m_sDeviceName; ezString m_sDeviceDriver; ezSizeU32 m_vEyeRenderTargetSize; }; /// \brief Defines the stage space used for the XR experience. /// /// This value is set by the ezStageSpaceComponent singleton and /// has to be taken into account by the XR implementation. struct ezXRStageSpace { using StorageType = ezUInt8; enum Enum : ezUInt8 { Seated, ///< Tracking poses will be relative to a seated head position Standing, ///< Tracking poses will be relative to the center of the stage space at ground level. Default = Standing, }; }; EZ_DECLARE_REFLECTABLE_TYPE(EZ_GAMEENGINE_DLL, ezXRStageSpace); struct ezXRTransformSpace { using StorageType = ezUInt8; enum Enum : ezUInt8 { Local, ///< Sets the local transform to the pose in stage space. Use if owner is direct child of ezStageSpaceComponent. Global, ///< Uses the global transform of the device in world space. Default = Local, }; }; EZ_DECLARE_REFLECTABLE_TYPE(EZ_GAMEENGINE_DLL, ezXRTransformSpace); struct ezXRDeviceType { using StorageType = ezUInt8; enum Enum : ezUInt8 { HMD, LeftController, RightController, DeviceID0, DeviceID1, DeviceID2, DeviceID3, DeviceID4, DeviceID5, DeviceID6, DeviceID7, DeviceID8, DeviceID9, DeviceID10, DeviceID11, DeviceID12, DeviceID13, DeviceID14, DeviceID15, Default = HMD, }; }; EZ_DECLARE_REFLECTABLE_TYPE(EZ_GAMEENGINE_DLL, ezXRDeviceType); using ezXRDeviceID = ezInt8; /// \brief A device's pose state. /// /// All values are relative to the stage space of the device, /// which is controlled by the ezStageSpaceComponent singleton and /// has to be taken into account by the XR implementation. struct EZ_GAMEENGINE_DLL ezXRDeviceState { ezXRDeviceState(); ezVec3 m_vGripPosition; ezQuat m_qGripRotation; ezVec3 m_vAimPosition; ezQuat m_qAimRotation; ezEnum<ezXRDeviceType> m_Type; bool m_bGripPoseIsValid = false; bool m_bAimPoseIsValid = false; bool m_bDeviceIsConnected = false; }; /// \brief Defines features the given device supports. struct ezXRDeviceFeatures { using StorageType = ezUInt32; enum Enum : ezUInt32 { None = 0, Trigger = EZ_BIT(0), ///< Float input. Analog trigger value 0-1. Select = EZ_BIT(1), ///< Bool input. Trigger fully pressed. Menu = EZ_BIT(2), ///< Bool input. Menu/Start button. Squeeze = EZ_BIT(3), ///< Float input. Analog squeeze/grip value 0-1. PrimaryAnalogStick = EZ_BIT(4), ///< 2D axis input. Thumbstick/joystick. PrimaryAnalogStickClick = EZ_BIT(5), ///< Bool input. Thumbstick pressed. PrimaryAnalogStickTouch = EZ_BIT(6), ///< Bool input. Thumbstick touched. SecondaryAnalogStick = EZ_BIT(7), ///< 2D axis input. Trackpad or secondary joystick. SecondaryAnalogStickClick = EZ_BIT(8), ///< Bool input. Trackpad/secondary joystick pressed. SecondaryAnalogStickTouch = EZ_BIT(9), ///< Bool input. Trackpad/secondary joystick touched. PrimaryButton = EZ_BIT(10), ///< Bool input. Primary face button (X/A). PrimaryButtonTouch = EZ_BIT(11), ///< Bool input. Primary face button touched. SecondaryButton = EZ_BIT(12), ///< Bool input. Secondary face button (Y/B). SecondaryButtonTouch = EZ_BIT(13), ///< Bool input. Secondary face button touched. GripPose = EZ_BIT(14), ///< 3D Pose input. Grip/hand position. AimPose = EZ_BIT(15), ///< 3D Pose input. Aim/pointer direction. Default = None }; struct Bits { StorageType Trigger : 1; StorageType Select : 1; StorageType Menu : 1; StorageType Squeeze : 1; StorageType PrimaryAnalogStick : 1; StorageType PrimaryAnalogStickClick : 1; StorageType PrimaryAnalogStickTouch : 1; StorageType SecondaryAnalogStick : 1; StorageType SecondaryAnalogStickClick : 1; StorageType SecondaryAnalogStickTouch : 1; StorageType PrimaryButton : 1; StorageType PrimaryButtonTouch : 1; StorageType SecondaryButton : 1; StorageType SecondaryButtonTouch : 1; StorageType GripPose : 1; StorageType AimPose : 1; }; }; EZ_DECLARE_FLAGS_OPERATORS(ezXRDeviceFeatures); struct ezXRDeviceEventData { enum class Type : ezUInt8 { DeviceAdded, DeviceRemoved, }; Type m_Type; ezXRDeviceID uiDeviceID = 0; }; using ezXRDeviceEvent = ezEvent<const ezXRDeviceEventData&>;