mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-16 08:09:41 +00:00
Comparison operator for Pose, View, and co.
This commit is contained in:
parent
4361f4191d
commit
9ad910a8e7
2 changed files with 35 additions and 0 deletions
|
@ -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 <<(
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue