/* * WiVRn VR streaming * Copyright (C) 2025 Patrick Nicolas * * 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 . */ #include "body_tracker.h" #include "xr/fb_body_tracker.h" #include "xr/htc_exts.h" #include "xr/instance.h" #include "xr/system.h" #include xr::body_tracker_type xr::body_tracker_supported(xr::instance & instance, xr::system & system) { if (instance.has_extension(XR_FB_BODY_TRACKING_EXTENSION_NAME)) { if (instance.has_extension(XR_META_BODY_TRACKING_FULL_BODY_EXTENSION_NAME) and system.meta_body_tracking_properties().supportsFullBodyTracking) return body_tracker_type::meta; if (system.fb_body_tracking_properties().supportsBodyTracking) return body_tracker_type::fb; } if (instance.has_extension(XR_HTC_PATH_ENUMERATION_EXTENSION_NAME) and instance.has_extension(XR_HTC_VIVE_XR_TRACKER_INTERACTION_EXTENSION_NAME)) return body_tracker_type::htc; if (instance.has_extension(XR_BD_BODY_TRACKING_EXTENSION_NAME)) { auto bd_body_properties = system.bd_body_tracking_properties(); if (bd_body_properties.supportsBodyTracking) return body_tracker_type::pico; } return xr::body_tracker_type::none; } xr::body_tracker xr::make_body_tracker(xr::instance & instance, xr::system & system, xr::session & session, std::vector> & generic_trackers) { switch (body_tracker_supported(instance, system)) { case body_tracker_type::meta: return xr::body_tracker(std::in_place_type_t(), instance, session, true); case body_tracker_type::fb: return xr::body_tracker(std::in_place_type_t(), instance, session, false); case body_tracker_type::pico: return xr::body_tracker(std::in_place_type_t(), instance, session); case body_tracker_type::htc: if (not generic_trackers.empty()) return xr::body_tracker(std::in_place_type_t(), session, generic_trackers); break; default: break; } return std::monostate(); }