Skip to content

File openxr_view_frame.hpp

File List > data_format > serialization > openxr_view_frame.hpp

Go to the documentation of this file

#pragma once

#include "illixr/data_format/openxr_view_frame.hpp"
#include "illixr/data_format/serialization/misc.hpp"

#include 

namespace boost::serialization {

template<class Archive>
void serialize(Archive& ar, ILLIXR::data_format::openxr_eye_view& view, const unsigned int) {
    // Keep the wire order identical for OpenXR poses on Quest and Eigen poses
    // on the desktop, including the existing w, x, y, z quaternion order.
#ifdef USING_OPENXR
    ar & view.position.x;
    ar & view.position.y;
    ar & view.position.z;
    ar & view.orientation.w;
    ar & view.orientation.x;
    ar & view.orientation.y;
    ar & view.orientation.z;
#else
    ar & view.position.x();
    ar & view.position.y();
    ar & view.position.z();
    ar & view.orientation.w();
    ar & view.orientation.x();
    ar & view.orientation.y();
    ar & view.orientation.z();
#endif
    ar & view.angle_left;
    ar & view.angle_right;
    ar & view.angle_up;
    ar & view.angle_down;
    ar & view.recommended_width;
    ar & view.recommended_height;
    ar & view.valid;
    ar & view.pose_tracked;
}

template<class Archive>
void serialize(Archive& ar, ILLIXR::data_format::openxr_view_frame& frame, const unsigned int) {
    ar& boost::serialization::base_object<ILLIXR::switchboard::event>(frame);
    ar & frame.sequence;
    ar & frame.sample_time;
    ar & frame.xr_sample_time;
    ar & frame.xr_predicted_display_period;
    ar & frame.should_render;
    ar & frame.left;
    ar & frame.right;
}

} // namespace boost::serialization

BOOST_CLASS_EXPORT_KEY(ILLIXR::data_format::openxr_view_frame)