cmake: change project c++-lang to c++20

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2258>
This commit is contained in:
Korcan Hussein 2024-06-25 17:59:21 +01:00
parent 3139079aaa
commit 1e67a27326
3 changed files with 37 additions and 21 deletions

View file

@ -46,7 +46,7 @@ set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD_REQUIRED ON)
# We use C++17 # We use C++17
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# So that clangd/Intellisense/Sourcetrail know how to parse our code. # So that clangd/Intellisense/Sourcetrail know how to parse our code.

View file

@ -25,11 +25,19 @@ struct InputClass;
struct DeviceBuilder struct DeviceBuilder
{ {
std::shared_ptr<Context> ctx; using ContextPtr = std::shared_ptr<Context>;
ContextPtr ctx;
vr::ITrackedDeviceServerDriver *driver; vr::ITrackedDeviceServerDriver *driver;
const char *serial; const char *serial;
const std::string &steam_install; const std::string &steam_install;
DeviceBuilder(const ContextPtr &p_ctx,
vr::ITrackedDeviceServerDriver *p_driver,
const char *p_serial,
const std::string &p_stream_install)
: ctx{p_ctx}, driver{p_driver}, serial{p_serial}, steam_install{p_stream_install}
{}
// no copies! // no copies!
DeviceBuilder(const DeviceBuilder &) = delete; DeviceBuilder(const DeviceBuilder &) = delete;
DeviceBuilder DeviceBuilder

View file

@ -1249,15 +1249,15 @@ CDeviceDriver_Monado::DebugRequest(const char *pchRequest, char *pchResponseBuff
//! @todo //! @todo
} }
static inline vr::HmdQuaternion_t static constexpr inline vr::HmdQuaternion_t
HmdQuaternion_Init(double w, double x, double y, double z) HmdQuaternion_Init(double w, double x, double y, double z)
{ {
vr::HmdQuaternion_t quat; return vr::HmdQuaternion_t{
quat.w = w; .w = w,
quat.x = x; .x = x,
quat.y = y; .y = y,
quat.z = z; .z = z,
return quat; };
} }
vr::DriverPose_t vr::DriverPose_t
@ -1275,23 +1275,31 @@ CDeviceDriver_Monado::GetPose()
m_relation_chain_push_pose_if_not_identity(&chain, offset); m_relation_chain_push_pose_if_not_identity(&chain, offset);
m_relation_chain_resolve(&chain, &rel); m_relation_chain_resolve(&chain, &rel);
vr::DriverPose_t t = {}; vr::DriverPose_t t = {
// monado predicts pose "now", see xrt_device_get_tracked_pose
.poseTimeOffset = 0,
.qWorldFromDriverRotation = HmdQuaternion_Init(1, 0, 0, 0),
.vecWorldFromDriverTranslation = {0, 0, 0},
.qDriverFromHeadRotation = HmdQuaternion_Init(1, 0, 0, 0),
.vecDriverFromHeadTranslation = {0, 0, 0},
// monado predicts pose "now", see xrt_device_get_tracked_pose .vecPosition = {0, 0, 0},
t.poseTimeOffset = 0; .vecVelocity = {0, 0, 0},
.vecAcceleration = {0, 0, 0},
//! @todo: Monado head model? .qRotation = HmdQuaternion_Init(1, 0, 0, 0),
t.shouldApplyHeadModel = !m_xdev->position_tracking_supported;
t.willDriftInYaw = !m_xdev->position_tracking_supported;
t.qWorldFromDriverRotation = HmdQuaternion_Init(1, 0, 0, 0); .vecAngularVelocity = {0, 0, 0},
t.qDriverFromHeadRotation = HmdQuaternion_Init(1, 0, 0, 0); .vecAngularAcceleration = {0, 0, 0},
t.poseIsValid = rel.relation_flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT;
t.result = vr::TrackingResult_Running_OK;
t.deviceIsConnected = true;
.result = vr::TrackingResult_Running_OK,
.poseIsValid = (rel.relation_flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) != 0,
.willDriftInYaw = !m_xdev->position_tracking_supported,
//! @todo: Monado head model?
.shouldApplyHeadModel = !m_xdev->position_tracking_supported,
.deviceIsConnected = true,
};
apply_pose(&rel, &t); apply_pose(&rel, &t);
#ifdef DUMP_POSE #ifdef DUMP_POSE