Skip to content
Snippets Groups Projects

OpenVR support

Merged Sebastian Hahta requested to merge feature/121/vr into master
2 files
+ 11
4
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -335,7 +335,7 @@ bool ftl::gui::Camera::thumbnail(cv::Mat &thumb) {
cv::flip(thumb, thumb, 0);
return true;
}
#include <math.h>
const GLTexture &ftl::gui::Camera::captureFrame() {
float now = (float)glfwGetTime();
delta_ = now - ftime_;
@@ -369,17 +369,23 @@ const GLTexture &ftl::gui::Camera::captureFrame() {
Eigen::Matrix4d viewPose = t.matrix() * pose;
// flip rotation (different coordinate axis on OpenGL/ftl)
// NOTE: image also flipped!
Eigen::Vector3d ea = viewPose.block<3, 3>(0, 0).eulerAngles(0, 1, 2);
//double rd = 180.0 / M_PI;
//LOG(INFO) << "Camera X: " << ea[0] *rd << ", Y: " << ea[1] * rd << ", Z: " << ea[2] * rd;
// NOTE: If modified, should be verified with VR headset!
Eigen::Matrix3d R;
R = Eigen::AngleAxisd(-ea[0], Eigen::Vector3d::UnitX()) *
Eigen::AngleAxisd(ea[1], Eigen::Vector3d::UnitY()) *
Eigen::AngleAxisd(-ea[2], Eigen::Vector3d::UnitZ());
Eigen::AngleAxisd(ea[2], Eigen::Vector3d::UnitZ());
viewPose.block<3, 3>(0, 0) = R;
if (src_->hasCapabilities(ftl::rgbd::kCapMovable)) src_->setPose(viewPose);
} else {
LOG(ERROR) << "No VR Pose";
//LOG(ERROR) << "No VR Pose";
}
#endif
} else {
Loading