add runtime-initialized 'hmd_traits' struct to streamline hmd-specific checks

This commit is contained in:
amwatson
2026-05-10 19:11:17 +02:00
committed by xytovl
parent 86c19fc5cc
commit d70c1fb414
9 changed files with 261 additions and 233 deletions
+1 -1
View File
@@ -306,7 +306,7 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
else
continue;
auto && [ray_entity, ray_node] = scene.add_gltf(controller_ray_model_name(), layer_mask_ray);
auto && [ray_entity, ray_node] = scene.add_gltf(runtime_hmd_traits().controller_ray_model, layer_mask_ray);
ray_node.name = (std::string)layout.key + "_ray";
spdlog::debug("Created entity {}", ray_node.name);
+3 -3
View File
@@ -1135,10 +1135,10 @@ void scenes::lobby::on_focused()
config.save();
}
std::string profile = controller_name();
const std::string_view profile = runtime_hmd_traits().controller_profile;
input.emplace(
*this,
"assets://controllers/" + profile + "/profile.json",
"assets://controllers/" + std::string(profile) + "/profile.json",
layer_controllers,
layer_rays,
get_action("left_trigger").first,
@@ -1148,7 +1148,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})
{
auto [p, q] = input->offset[i] = controller_offset(controller_name(), i);
auto [p, q] = input->offset[i] = controller_offset(profile, i);
auto rot = glm::degrees(glm::eulerAngles(q));
spdlog::info("Initializing offset of space {} to ({}, {}, {}) mm, ({}, {}, {})°",
+3 -3
View File
@@ -421,10 +421,10 @@ void scenes::stream::on_focused()
{
gui_status_last_change = instance.now();
std::string profile = controller_name();
const std::string_view profile = runtime_hmd_traits().controller_profile;
input.emplace(
*this,
"assets://controllers/" + profile + "/profile.json",
"assets://controllers/" + std::string(profile) + "/profile.json",
layer_controllers,
layer_rays,
get_action("left_trigger").first,
@@ -434,7 +434,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})
{
auto [p, q] = input->offset[i] = controller_offset(controller_name(), i);
auto [p, q] = input->offset[i] = controller_offset(profile, i);
auto rot = glm::degrees(glm::eulerAngles(q));
spdlog::info("Initializing offset of space {} to ({}, {}, {}) mm, ({}, {}, {})°",
+1 -1
View File
@@ -127,7 +127,7 @@ stream_defoveator::pipeline_t & stream_defoveator::ensure_pipeline(size_t view,
// Fragment shader
auto specialization = make_specialization_constants(
int32_t(alpha),
VkBool32(need_srgb_conversion(guess_model())));
VkBool32(runtime_hmd_traits().needs_srgb_conversion));
auto fragment_shader = load_shader(device, "reprojection.frag");
vk::pipeline_builder pipeline_info{