mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
Always use the latest eye pose data from the HMD
This commit is contained in:
parent
a83afa07ea
commit
2da474c484
2 changed files with 10 additions and 1 deletions
|
|
@ -329,6 +329,11 @@ void OpenVRRenderState::reset(vr::IVRSystem* hmd)
|
||||||
if (!mHMD)
|
if (!mHMD)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
updateHMDProjection();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenVRRenderState::updateHMDProjection()
|
||||||
|
{
|
||||||
vr::HmdMatrix34_t mat = mHMD->GetEyeToHeadTransform(vr::Eye_Left);
|
vr::HmdMatrix34_t mat = mHMD->GetEyeToHeadTransform(vr::Eye_Left);
|
||||||
mEyePose[0] = OpenVRUtil::convertSteamVRAffineMatrixToMatrixFPlain(mat);
|
mEyePose[0] = OpenVRUtil::convertSteamVRAffineMatrixToMatrixFPlain(mat);
|
||||||
mEyePose[0].inverse();
|
mEyePose[0].inverse();
|
||||||
|
|
@ -911,6 +916,9 @@ void OpenVRProvider::updateTrackedPoses()
|
||||||
|
|
||||||
compositor->WaitGetPoses(mTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, NULL, 0);
|
compositor->WaitGetPoses(mTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, NULL, 0);
|
||||||
|
|
||||||
|
// Make sure we're using the latest eye offset in case user has changed IPD
|
||||||
|
mHMDRenderState.updateHMDProjection();
|
||||||
|
|
||||||
mValidPoseCount = 0;
|
mValidPoseCount = 0;
|
||||||
|
|
||||||
for (int nDevice = 0; nDevice < vr::k_unMaxTrackedDeviceCount; ++nDevice)
|
for (int nDevice = 0; nDevice < vr::k_unMaxTrackedDeviceCount; ++nDevice)
|
||||||
|
|
@ -924,7 +932,7 @@ void OpenVRProvider::updateTrackedPoses()
|
||||||
if (nDevice == vr::k_unTrackedDeviceIndex_Hmd)
|
if (nDevice == vr::k_unTrackedDeviceIndex_Hmd)
|
||||||
{
|
{
|
||||||
mHMDRenderState.mHMDPose = mat;
|
mHMDRenderState.mHMDPose = mat;
|
||||||
// jaeesu - store the last rotation for temp debugging
|
// jamesu - store the last rotation for temp debugging
|
||||||
MatrixF torqueMat(1);
|
MatrixF torqueMat(1);
|
||||||
OpenVRUtil::convertTransformFromOVR(mat, torqueMat);
|
OpenVRUtil::convertTransformFromOVR(mat, torqueMat);
|
||||||
gLastMoveRot = AngAxisF(torqueMat);
|
gLastMoveRot = AngAxisF(torqueMat);
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,7 @@ struct OpenVRRenderState
|
||||||
void renderPreview();
|
void renderPreview();
|
||||||
|
|
||||||
void reset(vr::IVRSystem* hmd);
|
void reset(vr::IVRSystem* hmd);
|
||||||
|
void updateHMDProjection();
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpenVRProvider : public IDisplayDevice, public IInputDevice
|
class OpenVRProvider : public IDisplayDevice, public IInputDevice
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue