Skip to content

Commit

Permalink
OvrIntegration: Add TrackingOrigin enum
Browse files Browse the repository at this point in the history
Signed-off-by: Squareys <Squareys@googlemail.com>
  • Loading branch information
Squareys committed Apr 2, 2016
1 parent 6f04923 commit 4ff4317
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Magnum/OvrIntegration/HmdEnum.cpp
Expand Up @@ -60,6 +60,17 @@ Debug& operator<<(Debug& debug, const HmdTrackingCapability value) {
return debug << "OvrIntegration::HmdTrackingCapability::(invalid)";
}

Debug& operator<<(Debug& debug, const TrackingOrigin value) {
switch(value) {
#define _c(value) case TrackingOrigin::value: return debug << "OvrIntegration::TrackingOrigin::" #value;
_c(EyeLevel)
_c(FloorLevel)
#undef _c
}

return debug << "OvrIntegration::TrackingOrigin::(invalid)";
}

Debug& operator<<(Debug& debug, const TrackerFlag value) {
switch(value) {
#define _c(value) case TrackerFlag::value: return debug << "OvrIntegration::TrackerFlag::" #value;
Expand Down
35 changes: 35 additions & 0 deletions src/Magnum/OvrIntegration/HmdEnum.h
Expand Up @@ -85,6 +85,41 @@ typedef Containers::EnumSet<HmdTrackingCapability> HmdTrackingCapabilities;

CORRADE_ENUMSET_OPERATORS(HmdTrackingCapabilities)

/**
* @brief Tracking origin
*/
enum class TrackingOrigin: Int {
/**
* @brief Tracking system origin reported at eye (HMD) height
*
* Prefer using this origin when your application requires matching user's
* current physical head pose to a virtual head pose without any regards to
* the height of the floor. Cockpit-based, or 3rd-person experiences are
* ideal candidates.
* When used, all poses in ovrTrackingState are reported as an offset
* transform from the profile calibrated or recentered HMD pose.
* It is recommended that apps using this origin type call @ref Hmd::recenterTrackingOrigin()
* prior to starting the VR experience, but notify the user before doing so
* to make sure the user is in a comfortable pose, facing a comfortable
* direction.
*/
EyeLevel = ovrTrackingOrigin_EyeLevel,

/**
* @brief Tracking system origin reported at floor height
*
* Prefer using this origin when your application requires the physical
* floor height to match the virtual floor height, such as standing
* experiences.
* When used, all poses in ovrTrackingState are reported as an offset
* transform from the profile calibrated floor pose. Calling @ref Hmd::recenterTrackingOrigin()
* will recenter the X & Z axes as well as yaw, but the Y-axis (i.e. height)
* will continue to be reported using the floor height as the origin for
* all poses.
*/
FloorLevel = ovrTrackingOrigin_FloorLevel,
};

/**
@brief Tracker flag
Expand Down
12 changes: 12 additions & 0 deletions src/Magnum/OvrIntegration/Test/EnumTest.cpp
Expand Up @@ -42,6 +42,7 @@ struct EnumTest: TestSuite::Tester {

void hmdType();
void hmdTrackingCapability();
void trackingOrigin();
void trackerFlag();
void button();
void touch();
Expand All @@ -57,6 +58,7 @@ struct EnumTest: TestSuite::Tester {
EnumTest::EnumTest() {
addTests({&EnumTest::hmdType,
&EnumTest::hmdTrackingCapability,
&EnumTest::trackingOrigin,
&EnumTest::trackerFlag,
&EnumTest::button,
&EnumTest::touch,
Expand Down Expand Up @@ -89,6 +91,16 @@ void EnumTest::hmdTrackingCapability() {
CORRADE_COMPARE(out.str(), "OvrIntegration::HmdTrackingCapability::(invalid)\n");
}

void EnumTest::trackingOrigin() {
std::ostringstream out;
Debug(&out) << TrackingOrigin::EyeLevel;
CORRADE_COMPARE(out.str(), "OvrIntegration::TrackingOrigin::EyeLevel\n");

out.str("");
Debug(&out) << TrackingOrigin(-1);
CORRADE_COMPARE(out.str(), "OvrIntegration::TrackingOrigin::(invalid)\n");
}

void EnumTest::trackerFlag() {
std::ostringstream out;
Debug(&out) << TrackerFlag::Connected;
Expand Down

0 comments on commit 4ff4317

Please sign in to comment.