refactor hmd_traits into separate file, make class in application, and remove hardware.h/cpp

This commit is contained in:
Amanda M. Watson
2026-05-10 19:11:17 +02:00
committed by xytovl
parent b0994c54f5
commit b9f2fde119
14 changed files with 288 additions and 208 deletions
+5 -6
View File
@@ -33,7 +33,6 @@
#include "audio/audio.h"
#include "boost/pfr/core.hpp"
#include "decoder/shard_accumulator.h"
#include "hardware.h"
#include "inplace_vector.hpp"
#include "spdlog/spdlog.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];
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_height = view.recommendedImageRectHeight * config.resolution_scale;
@@ -421,7 +420,7 @@ void scenes::stream::on_focused()
{
gui_status_last_change = instance.now();
const auto & profile = hmd_traits().controller_profile;
const auto & profile = application::get_hmd_traits().controller_profile;
input.emplace(
*this,
"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})
{
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));
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;
if (hmd_traits().view_locate)
if (application::get_hmd_traits().view_locate)
{
aim = application::locate_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
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
is_gui_interactable())
{