refactor hmd_traits into separate file, make class in application, and remove hardware.h/cpp
This commit is contained in:
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
|
||||||
#include "hardware.h"
|
|
||||||
#include "openxr/openxr.h"
|
#include "openxr/openxr.h"
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
#include "spdlog/common.h"
|
#include "spdlog/common.h"
|
||||||
@@ -749,7 +748,7 @@ void application::initialize_vulkan()
|
|||||||
instance_extensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
instance_extensions.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(i.extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME) and hmd_traits().vk_debug_ext_allowed)
|
if (!strcmp(i.extensionName, VK_EXT_DEBUG_UTILS_EXTENSION_NAME) and get_hmd_traits().vk_debug_ext_allowed)
|
||||||
{
|
{
|
||||||
debug_utils_found = true;
|
debug_utils_found = true;
|
||||||
instance_extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
instance_extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
|
||||||
@@ -1005,7 +1004,7 @@ void application::initialize_actions()
|
|||||||
profile.available = std::ranges::all_of(profile.required_extensions, [&](auto & ext) { return xr_instance.has_extension(ext); }) and
|
profile.available = std::ranges::all_of(profile.required_extensions, [&](auto & ext) { return xr_instance.has_extension(ext); }) and
|
||||||
profile.min_version <= api_version;
|
profile.min_version <= api_version;
|
||||||
|
|
||||||
if (profile.profile_name.ends_with("khr/simple_controller") and not hmd_traits().bind_simple_controller)
|
if (profile.profile_name.ends_with("khr/simple_controller") and not get_hmd_traits().bind_simple_controller)
|
||||||
profile.available = false;
|
profile.available = false;
|
||||||
|
|
||||||
if (!profile.available)
|
if (!profile.available)
|
||||||
@@ -1014,7 +1013,7 @@ void application::initialize_actions()
|
|||||||
// Patch profile to add grip_surface or palm_ext
|
// Patch profile to add grip_surface or palm_ext
|
||||||
bool add_palms = true;
|
bool add_palms = true;
|
||||||
if (profile.profile_name.ends_with("ext/hand_interaction_ext"))
|
if (profile.profile_name.ends_with("ext/hand_interaction_ext"))
|
||||||
add_palms = hmd_traits().hand_interaction_grip_surface;
|
add_palms = get_hmd_traits().hand_interaction_grip_surface;
|
||||||
|
|
||||||
if (add_palms)
|
if (add_palms)
|
||||||
{
|
{
|
||||||
@@ -1185,7 +1184,7 @@ void application::initialize_actions()
|
|||||||
|
|
||||||
void application::initialize()
|
void application::initialize()
|
||||||
{
|
{
|
||||||
hmd_traits_init();
|
runtime_hmd_traits.init();
|
||||||
// LogLayersAndExtensions
|
// LogLayersAndExtensions
|
||||||
assert(!xr_instance);
|
assert(!xr_instance);
|
||||||
std::vector<const char *> xr_extensions{
|
std::vector<const char *> xr_extensions{
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#include "hmd_traits.h"
|
||||||
#include "utils/singleton.h"
|
#include "utils/singleton.h"
|
||||||
#include "utils/thread_safe.h"
|
#include "utils/thread_safe.h"
|
||||||
#include "vk/vk_allocator.h"
|
#include "vk/vk_allocator.h"
|
||||||
@@ -74,6 +75,7 @@ class application : public singleton<application>
|
|||||||
{
|
{
|
||||||
friend class scene;
|
friend class scene;
|
||||||
|
|
||||||
|
private:
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
friend __attribute__((visibility("default"))) void Java_org_meumeu_wivrn_MainActivity_onNewIntent(JNIEnv * env, jobject instance, jobject intent_obj);
|
friend __attribute__((visibility("default"))) void Java_org_meumeu_wivrn_MainActivity_onNewIntent(JNIEnv * env, jobject instance, jobject intent_obj);
|
||||||
#endif
|
#endif
|
||||||
@@ -157,6 +159,7 @@ class application : public singleton<application>
|
|||||||
|
|
||||||
boost::locale::generator gen;
|
boost::locale::generator gen;
|
||||||
boost::locale::gnu_gettext::messages_info messages_info;
|
boost::locale::gnu_gettext::messages_info messages_info;
|
||||||
|
hmd_traits runtime_hmd_traits;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
@@ -402,6 +405,12 @@ public:
|
|||||||
return instance().openxr_post_processing_supported;
|
return instance().openxr_post_processing_supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const hmd_traits & get_hmd_traits()
|
||||||
|
{
|
||||||
|
assert(instance().runtime_hmd_traits.is_initialized());
|
||||||
|
return instance().runtime_hmd_traits;
|
||||||
|
}
|
||||||
|
|
||||||
static auto & get_generic_trackers()
|
static auto & get_generic_trackers()
|
||||||
{
|
{
|
||||||
return instance().generic_trackers;
|
return instance().generic_trackers;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ bool configuration::check_feature(feature f) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
return check_permission(hmd_traits().permissions[f]);
|
return check_permission(application::get_hmd_traits().permission_name(f));
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
@@ -81,7 +81,7 @@ void configuration::set_feature(feature f, bool state)
|
|||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
request_permission(hmd_traits().permissions[f], [this, f](bool granted) {
|
request_permission(application::get_hmd_traits().permission_name(f), [this, f](bool granted) {
|
||||||
{
|
{
|
||||||
std::lock_guard lock(mutex);
|
std::lock_guard lock(mutex);
|
||||||
features[f] = granted;
|
features[f] = granted;
|
||||||
|
|||||||
+10
-1
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "hardware.h"
|
|
||||||
#include "wivrn_discover.h"
|
#include "wivrn_discover.h"
|
||||||
#include "wivrn_packets.h"
|
#include "wivrn_packets.h"
|
||||||
|
|
||||||
@@ -28,6 +27,7 @@
|
|||||||
#include <optional>
|
#include <optional>
|
||||||
#include <simdjson.h>
|
#include <simdjson.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <openxr/openxr.h>
|
||||||
|
|
||||||
namespace xr
|
namespace xr
|
||||||
{
|
{
|
||||||
@@ -35,6 +35,15 @@ class session;
|
|||||||
class system;
|
class system;
|
||||||
} // namespace xr
|
} // namespace xr
|
||||||
|
|
||||||
|
enum class feature
|
||||||
|
{
|
||||||
|
microphone,
|
||||||
|
hand_tracking,
|
||||||
|
eye_gaze,
|
||||||
|
face_tracking,
|
||||||
|
body_tracking,
|
||||||
|
};
|
||||||
|
|
||||||
class configuration
|
class configuration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -17,17 +17,18 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hardware.h"
|
#include "hmd_traits.h"
|
||||||
|
|
||||||
#include "utils/overloaded.h"
|
|
||||||
#include "xr/to_string.h"
|
#include "xr/to_string.h"
|
||||||
|
|
||||||
#include <boost/pfr.hpp>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cctype>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <format>
|
||||||
#include <glm/ext/quaternion_trigonometric.hpp>
|
#include <glm/ext/quaternion_trigonometric.hpp>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
@@ -101,24 +102,13 @@ static std::optional<bool> env_bool(std::string_view name)
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hmd_traits_t traits;
|
hmd_traits::hmd_traits() = default;
|
||||||
#ifndef NDEBUG
|
|
||||||
static bool initialized = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const hmd_traits_t & hmd_traits()
|
void hmd_traits::init()
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
assert(initialized);
|
assert(not initialized_);
|
||||||
#endif
|
initialized_ = true;
|
||||||
return traits;
|
|
||||||
}
|
|
||||||
|
|
||||||
void hmd_traits_init()
|
|
||||||
{
|
|
||||||
#ifndef NDEBUG
|
|
||||||
assert(not initialized);
|
|
||||||
initialized = true;
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
const auto device = get_property("ro.product.device");
|
const auto device = get_property("ro.product.device");
|
||||||
@@ -130,183 +120,175 @@ void hmd_traits_init()
|
|||||||
spdlog::info(" ro.product.manufacturer = \"{}\":", manufacturer.value_or("<unset>"));
|
spdlog::info(" ro.product.manufacturer = \"{}\":", manufacturer.value_or("<unset>"));
|
||||||
spdlog::info(" ro.product.model = \"{}\":", model.value_or("<unset>"));
|
spdlog::info(" ro.product.model = \"{}\":", model.value_or("<unset>"));
|
||||||
|
|
||||||
traits.permissions[feature::microphone] = "android.permission.RECORD_AUDIO";
|
permissions[feature::microphone] = "android.permission.RECORD_AUDIO";
|
||||||
|
|
||||||
if (manufacturer == "Oculus")
|
if (manufacturer == "Oculus")
|
||||||
{
|
{
|
||||||
traits.permissions[feature::eye_gaze] = "com.oculus.permission.EYE_TRACKING";
|
permissions[feature::eye_gaze] = "com.oculus.permission.EYE_TRACKING";
|
||||||
traits.permissions[feature::face_tracking] = "com.oculus.permission.FACE_TRACKING";
|
permissions[feature::face_tracking] = "com.oculus.permission.FACE_TRACKING";
|
||||||
|
|
||||||
// Quest hand tracking creates a fake khr/simple_controller when hand tracking
|
// Quest hand tracking creates a fake khr/simple_controller when hand tracking
|
||||||
// is enabled, this messes with native hand tracking
|
// is enabled, this messes with native hand tracking
|
||||||
traits.bind_simple_controller = false;
|
bind_simple_controller = false;
|
||||||
|
|
||||||
// Quest breaks spec and does not support grip_surface for ext/hand_interaction_ext
|
// Quest breaks spec and does not support grip_surface for ext/hand_interaction_ext
|
||||||
traits.hand_interaction_grip_surface = false;
|
hand_interaction_grip_surface = false;
|
||||||
|
|
||||||
if (device == "monterey") // Quest 1
|
if (device == "monterey") // Quest 1
|
||||||
{
|
{
|
||||||
traits.panel_width_override = 1440;
|
panel_width_override = 1440;
|
||||||
traits.controller_profile = "oculus-touch-v2";
|
controller_profile = "oculus-touch-v2";
|
||||||
traits.vk_debug_ext_allowed = false; // Quest 1 lies, the extension won't load
|
vk_debug_ext_allowed = false; // Quest 1 lies, the extension won't load
|
||||||
}
|
}
|
||||||
else if (device == "hollywood") // Quest 2
|
else if (device == "hollywood") // Quest 2
|
||||||
{
|
{
|
||||||
traits.panel_width_override = 1832;
|
panel_width_override = 1832;
|
||||||
traits.controller_profile = "oculus-touch-v3";
|
controller_profile = "oculus-touch-v3";
|
||||||
}
|
}
|
||||||
else if (device == "seacliff")
|
else if (device == "seacliff")
|
||||||
{
|
{
|
||||||
traits.panel_width_override = 1800; // Quest pro
|
panel_width_override = 1800; // Quest pro
|
||||||
traits.controller_profile = "meta-quest-touch-pro";
|
controller_profile = "meta-quest-touch-pro";
|
||||||
}
|
}
|
||||||
else if (device == "eureka")
|
else if (device == "eureka")
|
||||||
{
|
{
|
||||||
traits.panel_width_override = 2064; // Quest 3
|
panel_width_override = 2064; // Quest 3
|
||||||
traits.controller_profile = "meta-quest-touch-plus";
|
controller_profile = "meta-quest-touch-plus";
|
||||||
}
|
}
|
||||||
else if (device == "panther") // Quest 3S
|
else if (device == "panther") // Quest 3S
|
||||||
{
|
{
|
||||||
traits.panel_width_override = 1832;
|
panel_width_override = 1832;
|
||||||
traits.controller_profile = "meta-quest-touch-plus";
|
controller_profile = "meta-quest-touch-plus";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (model == "Lynx-R1")
|
else if (model == "Lynx-R1")
|
||||||
{
|
{
|
||||||
traits.needs_srgb_conversion = false;
|
needs_srgb_conversion = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (manufacturer == "Pico")
|
else if (manufacturer == "Pico")
|
||||||
{
|
{
|
||||||
traits.permissions[feature::eye_gaze] = "com.picovr.permission.EYE_TRACKING";
|
permissions[feature::eye_gaze] = "com.picovr.permission.EYE_TRACKING";
|
||||||
traits.permissions[feature::face_tracking] = "com.picovr.permission.FACE_TRACKING";
|
permissions[feature::face_tracking] = "com.picovr.permission.FACE_TRACKING";
|
||||||
traits.view_locate = false;
|
view_locate = false;
|
||||||
traits.discard_frame = false;
|
discard_frame = false;
|
||||||
const auto pico_model = get_property("pxr.vendorhw.product.model");
|
const auto pico_model = get_property("pxr.vendorhw.product.model");
|
||||||
spdlog::info(" pxr.vendorhw.product.model = \"{}\":", pico_model.value_or("<unset>"));
|
spdlog::info(" pxr.vendorhw.product.model = \"{}\":", pico_model.value_or("<unset>"));
|
||||||
|
|
||||||
if (pico_model == "Pico Neo 3")
|
if (pico_model == "Pico Neo 3")
|
||||||
{
|
{
|
||||||
traits.panel_width_override = 1832;
|
panel_width_override = 1832;
|
||||||
traits.controller_profile = "pico-neo3";
|
controller_profile = "pico-neo3";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (pico_model and pico_model->starts_with("PICO 4"))
|
else if (pico_model and pico_model->starts_with("PICO 4"))
|
||||||
{
|
{
|
||||||
traits.panel_width_override = 2160;
|
panel_width_override = 2160;
|
||||||
if (pico_model == "PICO 4 Ultra")
|
if (pico_model == "PICO 4 Ultra")
|
||||||
traits.controller_profile = "pico-4u";
|
controller_profile = "pico-4u";
|
||||||
else
|
else
|
||||||
traits.controller_profile = "pico-4";
|
controller_profile = "pico-4";
|
||||||
|
|
||||||
if (pico_model == "PICO 4 Pro" or pico_model == "PICO 4 Enterprise")
|
if (pico_model == "PICO 4 Pro" or pico_model == "PICO 4 Enterprise")
|
||||||
traits.pico_face_tracker = true;
|
pico_face_tracker = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (manufacturer == "HTC")
|
if (manufacturer == "HTC")
|
||||||
{
|
{
|
||||||
// Accepts OpenXR 1.1 but doesn't actually implement it
|
// Accepts OpenXR 1.1 but doesn't actually implement it
|
||||||
traits.max_openxr_api_version = XR_API_VERSION_1_0;
|
max_openxr_api_version = XR_API_VERSION_1_0;
|
||||||
// Doesn't handle additive blend, so needs specific ray model
|
// Doesn't handle additive blend, so needs specific ray model
|
||||||
traits.controller_ray_model = "assets://ray-htc.glb";
|
controller_ray_model = "assets://ray-htc.glb";
|
||||||
|
|
||||||
traits.controller_profile = "htc-vive-focus-3";
|
controller_profile = "htc-vive-focus-3";
|
||||||
|
|
||||||
if (model == "VIVE Focus 3")
|
if (model == "VIVE Focus 3")
|
||||||
traits.panel_width_override = 2448;
|
panel_width_override = 2448;
|
||||||
|
|
||||||
if (model == "VIVE Focus Vision")
|
if (model == "VIVE Focus Vision")
|
||||||
traits.panel_width_override = 2448;
|
panel_width_override = 2448;
|
||||||
|
|
||||||
if (model == "VIVE XR Series")
|
if (model == "VIVE XR Series")
|
||||||
traits.panel_width_override = 1920;
|
panel_width_override = 1920;
|
||||||
}
|
}
|
||||||
if (manufacturer == "samsung")
|
if (manufacturer == "samsung")
|
||||||
{
|
{
|
||||||
if (model == "SM-I610") // Galaxy XR
|
if (model == "SM-I610") // Galaxy XR
|
||||||
{
|
{
|
||||||
traits.panel_width_override = 3552;
|
panel_width_override = 3552;
|
||||||
traits.controller_profile = "samsung-galaxyxr";
|
controller_profile = "samsung-galaxyxr";
|
||||||
traits.permissions[feature::hand_tracking] = "android.permission.HAND_TRACKING";
|
permissions[feature::hand_tracking] = "android.permission.HAND_TRACKING";
|
||||||
traits.permissions[feature::eye_gaze] = "android.permission.EYE_TRACKING_FINE";
|
permissions[feature::eye_gaze] = "android.permission.EYE_TRACKING_FINE";
|
||||||
traits.permissions[feature::face_tracking] = "android.permission.FACE_TRACKING";
|
permissions[feature::face_tracking] = "android.permission.FACE_TRACKING";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spdlog::info("HMD traits initialized");
|
spdlog::info("HMD traits initialized");
|
||||||
boost::pfr::for_each_field_with_name(
|
auto log_string = [](std::string_view name, std::string & field) {
|
||||||
traits,
|
if (auto val = env_string(name))
|
||||||
utils::overloaded{
|
{
|
||||||
[](std::string_view name, std::string & field) {
|
spdlog::info("\t{} override: {} -> {}", name, field, *val);
|
||||||
if (auto val = env_string(name))
|
field = *val;
|
||||||
{
|
}
|
||||||
spdlog::info("\t{} override: {} -> {}", name, field, *val);
|
else
|
||||||
field = *val;
|
{
|
||||||
}
|
spdlog::info("\t{}: {}", name, field);
|
||||||
else
|
}
|
||||||
{
|
};
|
||||||
spdlog::info("\t{}: {}", name, field);
|
auto log_u32 = [](std::string_view name, uint32_t & field) {
|
||||||
}
|
if (auto val = env_u32(name))
|
||||||
},
|
{
|
||||||
[](std::string_view name, uint32_t & field) {
|
spdlog::info("\t{} override: {} -> {}", name, field, *val);
|
||||||
if (auto val = env_u32(name))
|
field = *val;
|
||||||
{
|
}
|
||||||
spdlog::info("\t{} override: {} -> {}", name, field, *val);
|
else
|
||||||
field = *val;
|
{
|
||||||
}
|
spdlog::info("\t{}: {}", name, field);
|
||||||
else
|
}
|
||||||
{
|
};
|
||||||
spdlog::info("\t{}: {}", name, field);
|
auto log_bool = [](std::string_view name, bool & field) {
|
||||||
}
|
if (auto val = env_bool(name))
|
||||||
},
|
{
|
||||||
[](std::string_view name, bool & field) {
|
spdlog::info("\t{} override: {} -> {}", name, field, *val);
|
||||||
if (auto val = env_bool(name))
|
field = *val;
|
||||||
{
|
}
|
||||||
spdlog::info("\t{} override: {} -> {}", name, field, *val);
|
else
|
||||||
field = *val;
|
{
|
||||||
}
|
spdlog::info("\t{}: {}", name, field);
|
||||||
else
|
}
|
||||||
{
|
};
|
||||||
spdlog::info("\t{}: {}", name, field);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[](std::string_view name, XrVersion & field) {
|
|
||||||
if (auto val = env_string(name))
|
|
||||||
{
|
|
||||||
XrVersion v;
|
|
||||||
if (val == "1.1")
|
|
||||||
v = XR_API_VERSION_1_1;
|
|
||||||
else if (val == "1.0")
|
|
||||||
v = XR_API_VERSION_1_0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
spdlog::warn("XrVersion {} not recognized", *val);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spdlog::info("\t{} override: {} -> {}", name, xr::to_string(field), xr::to_string(v));
|
|
||||||
field = v;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
spdlog::info("\t{}: {}", name, xr::to_string(field));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[](std::string_view name, hmd_permissions &) {
|
|
||||||
}});
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string model_name()
|
log_string("controller_profile", controller_profile);
|
||||||
{
|
log_string("controller_ray_model", controller_ray_model);
|
||||||
#ifdef __ANDROID__
|
if (auto val = env_string("max_openxr_api_version"))
|
||||||
const auto manufacturer = get_property("ro.product.manufacturer").value_or("");
|
{
|
||||||
const auto model = get_property("ro.product.model").value_or("");
|
XrVersion v;
|
||||||
|
if (val == "1.1")
|
||||||
return manufacturer + " " + model;
|
v = XR_API_VERSION_1_1;
|
||||||
#else
|
else if (val == "1.0")
|
||||||
return "Unknown headset";
|
v = XR_API_VERSION_1_0;
|
||||||
#endif
|
else
|
||||||
|
{
|
||||||
|
spdlog::warn("XrVersion {} not recognized", *val);
|
||||||
|
v = max_openxr_api_version;
|
||||||
|
}
|
||||||
|
spdlog::info("\t{} override: {} -> {}", "max_openxr_api_version", xr::to_string(max_openxr_api_version), xr::to_string(v));
|
||||||
|
max_openxr_api_version = v;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spdlog::info("\t{}: {}", "max_openxr_api_version", xr::to_string(max_openxr_api_version));
|
||||||
|
}
|
||||||
|
log_u32("panel_width_override", panel_width_override);
|
||||||
|
log_bool("needs_srgb_conversion", needs_srgb_conversion);
|
||||||
|
log_bool("view_locate", view_locate);
|
||||||
|
log_bool("vk_debug_ext_allowed", vk_debug_ext_allowed);
|
||||||
|
log_bool("bind_simple_controller", bind_simple_controller);
|
||||||
|
log_bool("hand_interaction_grip_surface", hand_interaction_grip_surface);
|
||||||
|
log_bool("pico_face_tracker", pico_face_tracker);
|
||||||
|
log_bool("discard_frame", discard_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
static XrViewConfigurationView scale_view(XrViewConfigurationView view, uint32_t width)
|
static XrViewConfigurationView scale_view(XrViewConfigurationView view, uint32_t width)
|
||||||
@@ -318,7 +300,19 @@ static XrViewConfigurationView scale_view(XrViewConfigurationView view, uint32_t
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
XrViewConfigurationView hmd_traits_t::override_view(XrViewConfigurationView view) const
|
std::string hmd_traits::model_name() const
|
||||||
|
{
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
const auto manufacturer = get_property("ro.product.manufacturer").value_or("");
|
||||||
|
const auto model = get_property("ro.product.model").value_or("");
|
||||||
|
|
||||||
|
return manufacturer + " " + model;
|
||||||
|
#else
|
||||||
|
return "Unknown headset";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
XrViewConfigurationView hmd_traits::override_view(XrViewConfigurationView view) const
|
||||||
{
|
{
|
||||||
// Standalone headsets tend to report a lower resolution
|
// Standalone headsets tend to report a lower resolution
|
||||||
// as the GPU can't handle full res.
|
// as the GPU can't handle full res.
|
||||||
@@ -329,7 +323,7 @@ XrViewConfigurationView hmd_traits_t::override_view(XrViewConfigurationView view
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::spaces space)
|
std::pair<glm::vec3, glm::quat> hmd_traits::controller_offset(xr::spaces space) const
|
||||||
{
|
{
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
if (const char * offset = [space]() -> const char * {
|
if (const char * offset = [space]() -> const char * {
|
||||||
@@ -359,6 +353,8 @@ std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
std::string_view profile = controller_profile;
|
||||||
|
|
||||||
if (profile == "oculus-touch-v2")
|
if (profile == "oculus-touch-v2")
|
||||||
switch (space)
|
switch (space)
|
||||||
{
|
{
|
||||||
@@ -381,62 +377,122 @@ std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::
|
|||||||
{
|
{
|
||||||
case xr::spaces::grip_left:
|
case xr::spaces::grip_left:
|
||||||
case xr::spaces::grip_right:
|
case xr::spaces::grip_right:
|
||||||
return {{0, -0.010, -0.025}, glm::angleAxis(glm::radians(-12.f), glm::vec3{1, 0, 0})};
|
return {{0, -0.006, -0.025}, glm::angleAxis(glm::radians(-14.f), glm::vec3{1, 0, 0})};
|
||||||
|
|
||||||
|
case xr::spaces::aim_left:
|
||||||
|
return {{-0.010, 0, 0.02}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
case xr::spaces::aim_right:
|
||||||
|
return {{0.010, 0, 0.02}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (profile == "meta-quest-touch-pro")
|
||||||
|
{
|
||||||
|
switch (space)
|
||||||
|
{
|
||||||
|
case xr::spaces::grip_left:
|
||||||
|
case xr::spaces::grip_right:
|
||||||
|
return {{0, 0, 0}, glm::angleAxis(glm::radians(-20.f), glm::vec3{1, 0, 0})};
|
||||||
|
|
||||||
|
case xr::spaces::aim_left:
|
||||||
|
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
case xr::spaces::aim_right:
|
||||||
|
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (profile == "oculus-touch-v3")
|
||||||
|
{
|
||||||
|
switch (space)
|
||||||
|
{
|
||||||
|
case xr::spaces::grip_left:
|
||||||
|
case xr::spaces::grip_right:
|
||||||
|
return {{0, -0.003, -0.047}, glm::angleAxis(glm::radians(-20.f), glm::vec3{1, 0, 0})};
|
||||||
|
|
||||||
|
case xr::spaces::aim_left:
|
||||||
|
return {{-0.006, 0, 0.015}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
case xr::spaces::aim_right:
|
||||||
|
return {{0.006, 0, 0.015}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (profile == "pico-neo3")
|
||||||
|
{
|
||||||
|
switch (space)
|
||||||
|
{
|
||||||
|
case xr::spaces::grip_left:
|
||||||
|
case xr::spaces::grip_right:
|
||||||
|
return {{0, -0.016, -0.05}, glm::angleAxis(glm::radians(-15.f), glm::vec3{1, 0, 0})};
|
||||||
|
|
||||||
case xr::spaces::aim_left:
|
case xr::spaces::aim_left:
|
||||||
case xr::spaces::aim_right:
|
case xr::spaces::aim_right:
|
||||||
return {{0, 0, -0.03}, {1, 0, 0, 0}};
|
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (profile == "pico-4" or profile == "pico-4u")
|
||||||
|
{
|
||||||
|
switch (space)
|
||||||
|
{
|
||||||
|
case xr::spaces::grip_left:
|
||||||
|
case xr::spaces::grip_right:
|
||||||
|
return {{0, -0.01, -0.04}, glm::angleAxis(glm::radians(-20.f), glm::vec3{1, 0, 0})};
|
||||||
|
|
||||||
|
case xr::spaces::aim_left:
|
||||||
|
return {{-0.005, 0, 0.02}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
case xr::spaces::aim_right:
|
||||||
|
return {{0.005, 0, 0.02}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (profile == "htc-vive-focus-3")
|
else if (profile == "htc-vive-focus-3")
|
||||||
|
{
|
||||||
switch (space)
|
switch (space)
|
||||||
{
|
{
|
||||||
case xr::spaces::grip_left:
|
case xr::spaces::grip_left:
|
||||||
case xr::spaces::grip_right:
|
case xr::spaces::grip_right:
|
||||||
return {{0, 0.007, -0.030}, {1, 0, 0, 0}};
|
return {{0, 0, -0.03}, glm::angleAxis(glm::radians(-35.f), glm::vec3{1, 0, 0})};
|
||||||
|
|
||||||
case xr::spaces::aim_left:
|
case xr::spaces::aim_left:
|
||||||
case xr::spaces::aim_right:
|
case xr::spaces::aim_right:
|
||||||
return {{0, -0.025, 0.005}, {1, 0, 0, 0}};
|
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (profile == "pico-4" || profile == "pico-4s")
|
}
|
||||||
switch (space)
|
|
||||||
{
|
|
||||||
case xr::spaces::grip_left:
|
|
||||||
case xr::spaces::grip_right:
|
|
||||||
return {{0, -0.014, -0.048}, glm::angleAxis(glm::radians(-35.060f), glm::vec3{1, 0, 0})};
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (profile == "pico-neo3")
|
|
||||||
switch (space)
|
|
||||||
{
|
|
||||||
case xr::spaces::grip_left:
|
|
||||||
case xr::spaces::grip_right:
|
|
||||||
return {{0, 0.005, -0.051}, glm::angleAxis(glm::radians(-29.400f), glm::vec3{1, 0, 0})};
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (profile == "samsung-galaxyxr")
|
else if (profile == "samsung-galaxyxr")
|
||||||
|
{
|
||||||
switch (space)
|
switch (space)
|
||||||
{
|
{
|
||||||
case xr::spaces::grip_left:
|
case xr::spaces::grip_left:
|
||||||
return {{-0.005, 0.000, 0.035}, {1, 0, 0, 0}};
|
|
||||||
case xr::spaces::grip_right:
|
case xr::spaces::grip_right:
|
||||||
return {{0.005, 0.000, 0.035}, {1, 0, 0, 0}};
|
return {{0, -0.01, -0.02}, glm::angleAxis(glm::radians(-20.f), glm::vec3{1, 0, 0})};
|
||||||
|
|
||||||
|
case xr::spaces::aim_left:
|
||||||
|
return {{-0.003, 0, 0.028}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
|
case xr::spaces::aim_right:
|
||||||
|
return {{0.003, 0, 0.028}, {1, 0, 0, 0}};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {{0, 0, 0}, {1, 0, 0, 0}};
|
return {{0, 0, 0}, {1, 0, 0, 0}};
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* WiVRn VR streaming
|
* WiVRn VR streaming
|
||||||
* Copyright (C) 2023 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
* Copyright (C) 2026 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
* Copyright (C) 2023 Patrick Nicolas <patricknicolas@laposte.net>
|
* Copyright (C) 2026 Patrick Nicolas <patricknicolas@laposte.net>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,30 +16,23 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
#include "xr/space.h"
|
#include "xr/space.h"
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
#include <magic_enum_containers.hpp>
|
#include <magic_enum_containers.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <openxr/openxr.h>
|
#include <openxr/openxr.h>
|
||||||
|
|
||||||
enum class feature
|
|
||||||
{
|
|
||||||
microphone,
|
|
||||||
hand_tracking,
|
|
||||||
eye_gaze,
|
|
||||||
face_tracking,
|
|
||||||
body_tracking,
|
|
||||||
};
|
|
||||||
|
|
||||||
using hmd_permissions = magic_enum::containers::array<feature, const char *>;
|
using hmd_permissions = magic_enum::containers::array<feature, const char *>;
|
||||||
|
|
||||||
struct hmd_traits_t
|
class hmd_traits
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
std::string controller_profile = "generic-trigger-squeeze";
|
std::string controller_profile = "generic-trigger-squeeze";
|
||||||
std::string controller_ray_model = "assets://ray.glb";
|
std::string controller_ray_model = "assets://ray.glb";
|
||||||
hmd_permissions permissions{};
|
hmd_permissions permissions{};
|
||||||
@@ -52,14 +45,31 @@ struct hmd_traits_t
|
|||||||
bool hand_interaction_grip_surface = true;
|
bool hand_interaction_grip_surface = true;
|
||||||
bool pico_face_tracker = false;
|
bool pico_face_tracker = false;
|
||||||
bool discard_frame = true; // can do xrBeginFrame twice to discard the first one
|
bool discard_frame = true; // can do xrBeginFrame twice to discard the first one
|
||||||
|
#ifndef NDEBUG
|
||||||
|
private:
|
||||||
|
bool initialized_ = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public:
|
||||||
|
hmd_traits();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
const char * permission_name(feature f) const
|
||||||
|
{
|
||||||
|
return permissions[f];
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string model_name() const;
|
||||||
|
std::pair<glm::vec3, glm::quat> controller_offset(xr::spaces space) const;
|
||||||
XrViewConfigurationView override_view(XrViewConfigurationView) const;
|
XrViewConfigurationView override_view(XrViewConfigurationView) const;
|
||||||
|
|
||||||
|
bool is_initialized() const
|
||||||
|
{
|
||||||
|
#ifndef NDEBUG
|
||||||
|
return initialized_;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const hmd_traits_t & hmd_traits();
|
|
||||||
// must be called exactly once
|
|
||||||
void hmd_traits_init();
|
|
||||||
|
|
||||||
std::string model_name();
|
|
||||||
|
|
||||||
std::pair<glm::vec3, glm::quat> controller_offset(std::string_view profile, xr::spaces space);
|
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
#include "input_profile.h"
|
#include "input_profile.h"
|
||||||
|
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "hardware.h"
|
|
||||||
#include "render/scene_components.h"
|
#include "render/scene_components.h"
|
||||||
#include "utils/mapped_file.h"
|
#include "utils/mapped_file.h"
|
||||||
#include "xr/space.h"
|
#include "xr/space.h"
|
||||||
@@ -306,7 +305,7 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
|
|||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto && [ray_entity, ray_node] = scene.add_gltf(hmd_traits().controller_ray_model, layer_mask_ray);
|
auto && [ray_entity, ray_node] = scene.add_gltf(application::get_hmd_traits().controller_ray_model, layer_mask_ray);
|
||||||
|
|
||||||
ray_node.name = (std::string)layout.key + "_ray";
|
ray_node.name = (std::string)layout.key + "_ray";
|
||||||
spdlog::debug("Created entity {}", ray_node.name);
|
spdlog::debug("Created entity {}", ray_node.name);
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "glm/geometric.hpp"
|
#include "glm/geometric.hpp"
|
||||||
#include "hand_model.h"
|
#include "hand_model.h"
|
||||||
#include "hardware.h"
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "openxr/openxr.h"
|
#include "openxr/openxr.h"
|
||||||
#include "protocol_version.h"
|
#include "protocol_version.h"
|
||||||
@@ -1114,7 +1113,7 @@ void scenes::lobby::on_focused()
|
|||||||
|
|
||||||
auto views = system.view_configuration_views(viewconfig);
|
auto views = system.view_configuration_views(viewconfig);
|
||||||
assert(views.size() == 2); // FIXME
|
assert(views.size() == 2); // FIXME
|
||||||
stream_view = hmd_traits().override_view(views[0]);
|
stream_view = application::get_hmd_traits().override_view(views[0]);
|
||||||
width = views[0].recommendedImageRectWidth;
|
width = views[0].recommendedImageRectWidth;
|
||||||
height = views[0].recommendedImageRectHeight;
|
height = views[0].recommendedImageRectHeight;
|
||||||
|
|
||||||
@@ -1135,7 +1134,7 @@ void scenes::lobby::on_focused()
|
|||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto & profile = hmd_traits().controller_profile;
|
const auto & profile = application::get_hmd_traits().controller_profile;
|
||||||
input.emplace(
|
input.emplace(
|
||||||
*this,
|
*this,
|
||||||
"assets://controllers/" + profile + "/profile.json",
|
"assets://controllers/" + profile + "/profile.json",
|
||||||
@@ -1148,7 +1147,7 @@ void scenes::lobby::on_focused()
|
|||||||
|
|
||||||
for (auto i: {xr::spaces::aim_left, xr::spaces::aim_right, xr::spaces::grip_left, xr::spaces::grip_right})
|
for (auto i: {xr::spaces::aim_left, xr::spaces::aim_right, xr::spaces::grip_left, xr::spaces::grip_right})
|
||||||
{
|
{
|
||||||
auto [p, q] = input->offset[i] = controller_offset(profile, i);
|
auto [p, q] = input->offset[i] = application::get_hmd_traits().controller_offset(i);
|
||||||
|
|
||||||
auto rot = glm::degrees(glm::eulerAngles(q));
|
auto rot = glm::degrees(glm::eulerAngles(q));
|
||||||
spdlog::info("Initializing offset of space {} to ({}, {}, {}) mm, ({}, {}, {})°",
|
spdlog::info("Initializing offset of space {} to ({}, {}, {}) mm, ({}, {}, {})°",
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "audio/audio.h"
|
#include "audio/audio.h"
|
||||||
#include "boost/pfr/core.hpp"
|
#include "boost/pfr/core.hpp"
|
||||||
#include "decoder/shard_accumulator.h"
|
#include "decoder/shard_accumulator.h"
|
||||||
#include "hardware.h"
|
|
||||||
#include "inplace_vector.hpp"
|
#include "inplace_vector.hpp"
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
#include "utils/named_thread.h"
|
#include "utils/named_thread.h"
|
||||||
@@ -217,7 +216,7 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto view = self->system.view_configuration_views(self->viewconfig)[0];
|
auto view = self->system.view_configuration_views(self->viewconfig)[0];
|
||||||
view = hmd_traits().override_view(view);
|
view = application::get_hmd_traits().override_view(view);
|
||||||
|
|
||||||
info.render_eye_width = view.recommendedImageRectWidth * config.resolution_scale;
|
info.render_eye_width = view.recommendedImageRectWidth * config.resolution_scale;
|
||||||
info.render_eye_height = view.recommendedImageRectHeight * config.resolution_scale;
|
info.render_eye_height = view.recommendedImageRectHeight * config.resolution_scale;
|
||||||
@@ -421,7 +420,7 @@ void scenes::stream::on_focused()
|
|||||||
{
|
{
|
||||||
gui_status_last_change = instance.now();
|
gui_status_last_change = instance.now();
|
||||||
|
|
||||||
const auto & profile = hmd_traits().controller_profile;
|
const auto & profile = application::get_hmd_traits().controller_profile;
|
||||||
input.emplace(
|
input.emplace(
|
||||||
*this,
|
*this,
|
||||||
"assets://controllers/" + profile + "/profile.json",
|
"assets://controllers/" + profile + "/profile.json",
|
||||||
@@ -434,7 +433,7 @@ void scenes::stream::on_focused()
|
|||||||
|
|
||||||
for (auto i: {xr::spaces::aim_left, xr::spaces::aim_right, xr::spaces::grip_left, xr::spaces::grip_right})
|
for (auto i: {xr::spaces::aim_left, xr::spaces::aim_right, xr::spaces::grip_left, xr::spaces::grip_right})
|
||||||
{
|
{
|
||||||
auto [p, q] = input->offset[i] = controller_offset(profile, i);
|
auto [p, q] = input->offset[i] = application::get_hmd_traits().controller_offset(i);
|
||||||
|
|
||||||
auto rot = glm::degrees(glm::eulerAngles(q));
|
auto rot = glm::degrees(glm::eulerAngles(q));
|
||||||
spdlog::info("Initializing offset of space {} to ({}, {}, {}) mm, ({}, {}, {})°",
|
spdlog::info("Initializing offset of space {} to ({}, {}, {}) mm, ({}, {}, {})°",
|
||||||
@@ -684,7 +683,7 @@ void scenes::stream::update_gui_position(xr::spaces controller)
|
|||||||
{
|
{
|
||||||
std::optional<std::pair<glm::vec3, glm::quat>> aim;
|
std::optional<std::pair<glm::vec3, glm::quat>> aim;
|
||||||
|
|
||||||
if (hmd_traits().view_locate)
|
if (application::get_hmd_traits().view_locate)
|
||||||
{
|
{
|
||||||
aim = application::locate_controller(
|
aim = application::locate_controller(
|
||||||
application::space(controller),
|
application::space(controller),
|
||||||
@@ -934,7 +933,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Allow the headset to time warp if we are redisplaying a frame
|
// Allow the headset to time warp if we are redisplaying a frame
|
||||||
if ((not hmd_traits().discard_frame) or
|
if ((not application::get_hmd_traits().discard_frame) or
|
||||||
std::ranges::any_of(current_blit_handles, [](const auto & h) { return h and h->feedback.times_displayed < 2; }) or
|
std::ranges::any_of(current_blit_handles, [](const auto & h) { return h and h->feedback.times_displayed < 2; }) or
|
||||||
is_gui_interactable())
|
is_gui_interactable())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ stream_defoveator::pipeline_t & stream_defoveator::ensure_pipeline(size_t view,
|
|||||||
// Fragment shader
|
// Fragment shader
|
||||||
auto specialization = make_specialization_constants(
|
auto specialization = make_specialization_constants(
|
||||||
int32_t(alpha),
|
int32_t(alpha),
|
||||||
VkBool32(hmd_traits().needs_srgb_conversion));
|
VkBool32(application::get_hmd_traits().needs_srgb_conversion));
|
||||||
auto fragment_shader = load_shader(device, "reprojection.frag");
|
auto fragment_shader = load_shader(device, "reprojection.frag");
|
||||||
|
|
||||||
vk::pipeline_builder pipeline_info{
|
vk::pipeline_builder pipeline_info{
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ void scenes::stream::tracking()
|
|||||||
break;
|
break;
|
||||||
case wivrn::device_id::EYE_GAZE:
|
case wivrn::device_id::EYE_GAZE:
|
||||||
// Eye gaze uses view pose as the origin
|
// Eye gaze uses view pose as the origin
|
||||||
if (hmd_traits().view_locate)
|
if (application::get_hmd_traits().view_locate)
|
||||||
tracking.device_poses.push_back(locate_space(item.device, spaces[item.device], spaces[wivrn::device_id::HEAD], tracking.timestamp));
|
tracking.device_poses.push_back(locate_space(item.device, spaces[item.device], spaces[wivrn::device_id::HEAD], tracking.timestamp));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -754,7 +754,7 @@ void scenes::stream::send_derived_pose()
|
|||||||
{
|
{
|
||||||
// This may happen if the runtime does not support palm ext
|
// This may happen if the runtime does not support palm ext
|
||||||
// check if we have a device specific offset
|
// check if we have a device specific offset
|
||||||
if (not hmd_traits().hand_interaction_grip_surface)
|
if (not application::get_hmd_traits().hand_interaction_grip_surface)
|
||||||
{
|
{
|
||||||
switch (target)
|
switch (target)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "wivrn_client.h"
|
#include "wivrn_client.h"
|
||||||
#include "hardware.h"
|
#include "application.h"
|
||||||
#include "protocol_version.h"
|
#include "protocol_version.h"
|
||||||
#include "secrets.h"
|
#include "secrets.h"
|
||||||
#include "smp.h"
|
#include "smp.h"
|
||||||
@@ -102,7 +102,7 @@ void wivrn_session::handshake(T address, bool tcp_only, crypto::key & headset_ke
|
|||||||
send_control(from_headset::crypto_handshake{
|
send_control(from_headset::crypto_handshake{
|
||||||
.protocol_version = wivrn::protocol_version,
|
.protocol_version = wivrn::protocol_version,
|
||||||
.public_key = headset_keypair.public_key(),
|
.public_key = headset_keypair.public_key(),
|
||||||
.name = model_name(),
|
.name = application::get_hmd_traits().model_name(),
|
||||||
});
|
});
|
||||||
|
|
||||||
to_headset::crypto_handshake crypto_handshake = std::get<to_headset::crypto_handshake>(receive(10s));
|
to_headset::crypto_handshake crypto_handshake = std::get<to_headset::crypto_handshake>(receive(10s));
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "face_tracker.h"
|
#include "face_tracker.h"
|
||||||
|
|
||||||
#include "hardware.h"
|
#include "application.h"
|
||||||
#include "xr/instance.h"
|
#include "xr/instance.h"
|
||||||
#include "xr/system.h"
|
#include "xr/system.h"
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ xr::face_tracker_type xr::face_tracker_supported(xr::instance & instance, xr::sy
|
|||||||
return xr::face_tracker_type::htc;
|
return xr::face_tracker_type::htc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hmd_traits().pico_face_tracker)
|
if (application::get_hmd_traits().pico_face_tracker)
|
||||||
{
|
{
|
||||||
// The extension used by Pico is not published
|
// The extension used by Pico is not published
|
||||||
// it doesn't even need to be requested...
|
// it doesn't even need to be requested...
|
||||||
@@ -85,7 +85,7 @@ xr::face_tracker xr::make_face_tracker(xr::instance & instance, xr::system & sys
|
|||||||
properties.supportLipFacialTracking);
|
properties.supportLipFacialTracking);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hmd_traits().pico_face_tracker)
|
if (application::get_hmd_traits().pico_face_tracker)
|
||||||
{
|
{
|
||||||
// The extension used by Pico is not published
|
// The extension used by Pico is not published
|
||||||
// it doesn't even need to be requested...
|
// it doesn't even need to be requested...
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "instance.h"
|
#include "instance.h"
|
||||||
|
|
||||||
#include "hardware.h"
|
#include "application.h"
|
||||||
#include "xr/details/enumerate.h"
|
#include "xr/details/enumerate.h"
|
||||||
#include "xr/htc_exts.h"
|
#include "xr/htc_exts.h"
|
||||||
#include "xr/to_string.h"
|
#include "xr/to_string.h"
|
||||||
@@ -100,11 +100,11 @@ static std::pair<XrVersion, XrInstance> create_instance(XrInstanceCreateInfo & i
|
|||||||
XR_API_VERSION_1_0,
|
XR_API_VERSION_1_0,
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
if (version > hmd_traits().max_openxr_api_version)
|
if (version > application::get_hmd_traits().max_openxr_api_version)
|
||||||
{
|
{
|
||||||
spdlog::info("skip OpenXR {} due to headset quirk max version {}",
|
spdlog::info("skip OpenXR {} due to headset quirk max version {}",
|
||||||
xr::to_string(version),
|
xr::to_string(version),
|
||||||
xr::to_string(hmd_traits().max_openxr_api_version));
|
xr::to_string(application::get_hmd_traits().max_openxr_api_version));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::vector<const char *> extensions;
|
std::vector<const char *> extensions;
|
||||||
|
|||||||
Reference in New Issue
Block a user