This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <OVR.h> | |
#undef new | |
#undef min | |
#undef max | |
#include <glm/glm.hpp> | |
#include <glm/gtc/matrix_transform.hpp> | |
#include <glm/gtc/type_ptr.hpp> | |
#include <glm/gtc/noise.hpp> | |
#include <glm/gtc/epsilon.hpp> | |
#include <glm/gtx/norm.hpp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename Function> | |
void for_each_eye(Function f){ | |
for (Eye eye = LEFT; eye <= RIGHT; eye = static_cast<Eye>(eye + 1)) { | |
f(eye); | |
} | |
} | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void renderScene() { | |
// do all your normal rendering here | |
... | |
// Render the latency test color if required | |
renderLatencyTestSquare(); | |
} | |
void renderLatencyTestSquare() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In your class | |
OVR::Quatf currentOrientation; | |
OVR::SensorFusion sensorFusion; | |
// In my per-frame update code | |
... | |
currentOrientation = sensorFusion.GetPredictedOrientation(); | |
ovrLatencyTest.ProcessInputs(); | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In your class | |
OVR::Ptr<OVR::LatencyTestDevice> ovrLatencyTester; | |
OVR::Util::LatencyTest ovrLatencyTest; | |
// In your constructor | |
ovrLatencyTester = *ovrManager->EnumerateDevices<OVR::LatencyTestDevice>().CreateDevice(); | |
if (ovrLatencyTester) { | |
ovrLatencyTest.SetDevice(ovrLatencyTester); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void renderLatencyTestSquare() { | |
OVR::Color colorToDisplay; | |
// If this returns a non-0 value, we're performing a latency | |
// test and must render a colored square underneath the tester | |
// (On the lens axis) | |
if (ovrLatencyTest.DisplayScreenColor(colorToDisplay)) { | |
latencyTestProgram->use(); | |
latencyTestProgram->setUniform("Color", Rift::fromOvr(colorToDisplay)); |
NewerOlder