diff --git a/apps/openmw/mwvr/openxrmanager.cpp b/apps/openmw/mwvr/openxrmanager.cpp index 4d56cf77c..c1987bea0 100644 --- a/apps/openmw/mwvr/openxrmanager.cpp +++ b/apps/openmw/mwvr/openxrmanager.cpp @@ -242,6 +242,19 @@ namespace MWVR return *this; } + bool Pose::operator==(const Pose& rhs) const + { + return position == rhs.position && orientation == rhs.orientation && velocity == rhs.velocity; + } + + bool FieldOfView::operator==(const FieldOfView& rhs) const + { + return angleDown == rhs.angleDown + && angleUp == rhs.angleUp + && angleLeft == rhs.angleLeft + && angleRight == rhs.angleRight; + } + // near and far named with an underscore because of galaxy brain defines in included windows headers. osg::Matrix FieldOfView::perspectiveMatrix(float near_, float far_) { @@ -287,6 +300,21 @@ namespace MWVR return osg::Matrix(matrix); } + bool PoseSet::operator==(const PoseSet& rhs) const + { + return eye[0] == rhs.eye[0] + && eye[1] == rhs.eye[1] + && hands[0] == rhs.hands[0] + && hands[1] == rhs.hands[1] + && view[0] == rhs.view[0] + && view[1] == rhs.view[1] + && head == rhs.head; + + } + bool View::operator==(const View& rhs) const + { + return pose == rhs.pose && fov == rhs.fov; + } } std::ostream& operator <<( diff --git a/apps/openmw/mwvr/openxrmanager.hpp b/apps/openmw/mwvr/openxrmanager.hpp index 2d56dafe3..00f4cb2bd 100644 --- a/apps/openmw/mwvr/openxrmanager.hpp +++ b/apps/openmw/mwvr/openxrmanager.hpp @@ -52,6 +52,8 @@ namespace MWVR //! Scale a pose (does not affect orientation) Pose operator*(float scalar); const Pose& operator*=(float scalar); + + bool operator==(const Pose& rhs) const; }; struct FieldOfView { @@ -60,6 +62,8 @@ namespace MWVR float angleUp; float angleDown; + bool operator==(const FieldOfView& rhs) const; + osg::Matrix perspectiveMatrix(float near, float far); }; @@ -67,6 +71,7 @@ namespace MWVR { Pose pose; FieldOfView fov; + bool operator==(const View& rhs) const; }; struct PoseSet @@ -75,6 +80,8 @@ namespace MWVR Pose eye[2]{}; Pose hands[2]{}; Pose head{}; + + bool operator==(const PoseSet& rhs) const; }; //! Describes what limb to track.