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 "input_profile.h"
|
||||
|
||||
#include "application.h"
|
||||
#include "hardware.h"
|
||||
#include "render/scene_components.h"
|
||||
#include "utils/mapped_file.h"
|
||||
#include "xr/space.h"
|
||||
@@ -306,7 +305,7 @@ input_profile::input_profile(scene & scene, const std::filesystem::path & json_p
|
||||
else
|
||||
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";
|
||||
spdlog::debug("Created entity {}", ray_node.name);
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "constants.h"
|
||||
#include "glm/geometric.hpp"
|
||||
#include "hand_model.h"
|
||||
#include "hardware.h"
|
||||
#include "imgui.h"
|
||||
#include "openxr/openxr.h"
|
||||
#include "protocol_version.h"
|
||||
@@ -1114,7 +1113,7 @@ void scenes::lobby::on_focused()
|
||||
|
||||
auto views = system.view_configuration_views(viewconfig);
|
||||
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;
|
||||
height = views[0].recommendedImageRectHeight;
|
||||
|
||||
@@ -1135,7 +1134,7 @@ void scenes::lobby::on_focused()
|
||||
config.save();
|
||||
}
|
||||
|
||||
const auto & profile = hmd_traits().controller_profile;
|
||||
const auto & profile = application::get_hmd_traits().controller_profile;
|
||||
input.emplace(
|
||||
*this,
|
||||
"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})
|
||||
{
|
||||
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, ({}, {}, {})°",
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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(hmd_traits().needs_srgb_conversion));
|
||||
VkBool32(application::get_hmd_traits().needs_srgb_conversion));
|
||||
auto fragment_shader = load_shader(device, "reprojection.frag");
|
||||
|
||||
vk::pipeline_builder pipeline_info{
|
||||
|
||||
@@ -493,7 +493,7 @@ void scenes::stream::tracking()
|
||||
break;
|
||||
case wivrn::device_id::EYE_GAZE:
|
||||
// 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));
|
||||
else
|
||||
{
|
||||
@@ -754,7 +754,7 @@ void scenes::stream::send_derived_pose()
|
||||
{
|
||||
// This may happen if the runtime does not support palm ext
|
||||
// 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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user