// // Created by Bradley Austin Davis on 2015/06/12 // Copyright 2015 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #pragma once #include #include #include #include vr::IVRSystem* acquireOpenVrSystem(); void releaseOpenVrSystem(); template void openvr_for_each_eye(F f) { f(vr::Hmd_Eye::Eye_Left); f(vr::Hmd_Eye::Eye_Right); } inline mat4 toGlm(const vr::HmdMatrix44_t& m) { return glm::transpose(glm::make_mat4(&m.m[0][0])); } inline vec3 toGlm(const vr::HmdVector3_t& v) { return vec3(v.v[0], v.v[1], v.v[2]); } inline mat4 toGlm(const vr::HmdMatrix34_t& m) { mat4 result = mat4( m.m[0][0], m.m[1][0], m.m[2][0], 0.0, m.m[0][1], m.m[1][1], m.m[2][1], 0.0, m.m[0][2], m.m[1][2], m.m[2][2], 0.0, m.m[0][3], m.m[1][3], m.m[2][3], 1.0f); return result; }