Files

114 lines
3.5 KiB
C++

/*
* WiVRn VR streaming
* Copyright (C) 2022 Guillaume Meunier <[email protected]>
* Copyright (C) 2022 Patrick Nicolas <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifdef XR_USE_PLATFORM_ANDROID
#include <android_native_app_glue.h>
#endif
#include <vector>
#include <vulkan/vulkan_raii.hpp>
#include <openxr/openxr.h>
#include <openxr/openxr_platform.h>
namespace xr
{
class instance;
enum class passthrough_type
{
none,
bw,
color
};
enum class body_tracker_type
{
none,
fb,
meta,
htc,
pico,
};
enum class face_tracker_type
{
none,
android,
fb,
htc,
pico,
};
class system
{
instance * inst = nullptr;
XrSystemId id = XR_NULL_SYSTEM_ID;
bool hand_tracking_supported_ = false;
bool hand_mesh_fb_supported_ = false;
passthrough_type passthrough;
body_tracker_type body_tracker;
face_tracker_type face_tracker;
public:
system() = default;
system(const system &) = default;
system & operator=(const system &) = default;
system(xr::instance &, XrFormFactor formfactor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY);
operator XrSystemId() const
{
return id;
}
operator bool() const
{
return id != XR_NULL_SYSTEM_ID;
}
XrSystemProperties properties() const;
XrSystemHandTrackingPropertiesEXT hand_tracking_properties() const;
XrSystemEyeGazeInteractionPropertiesEXT eye_gaze_interaction_properties() const;
XrSystemFoveationEyeTrackedPropertiesMETA foveation_eye_tracked_properties() const;
XrSystemUserPresencePropertiesEXT user_presence_properties() const;
XrSystemFaceTrackingPropertiesANDROID android_face_tracking_properties() const;
XrSystemFaceTrackingProperties2FB fb_face_tracking2_properties() const;
XrSystemFacialTrackingPropertiesHTC htc_face_tracking_properties() const;
XrSystemBodyTrackingPropertiesFB fb_body_tracking_properties() const;
XrSystemPropertiesBodyTrackingFullBodyMETA meta_body_tracking_properties() const;
XrSystemBodyTrackingPropertiesBD bd_body_tracking_properties() const;
XrSystemBoundaryVisibilityPropertiesMETA boundary_visibility_properties() const;
bool hand_tracking_supported() const;
bool hand_mesh_fb_supported() const;
passthrough_type passthrough_supported() const;
face_tracker_type face_tracker_supported() const;
body_tracker_type body_tracker_supported() const;
XrGraphicsRequirementsVulkan2KHR graphics_requirements() const;
vk::raii::PhysicalDevice physical_device(vk::raii::Instance & vulkan) const;
vk::raii::Device create_device(vk::raii::PhysicalDevice & pdev, vk::DeviceCreateInfo & create_info) const;
std::vector<XrViewConfigurationType> view_configurations() const;
XrViewConfigurationProperties view_configuration_properties(XrViewConfigurationType) const;
std::vector<XrViewConfigurationView> view_configuration_views(XrViewConfigurationType) const;
std::vector<XrEnvironmentBlendMode> environment_blend_modes(XrViewConfigurationType) const;
};
} // namespace xr