Bug 1426028 - Head rotation was being applied twice in gfxVRGVR r=kip
MozReview-Commit-ID: IzcRfzE7qxV
--- a/gfx/vr/gfxVRGVR.cpp
+++ b/gfx/vr/gfxVRGVR.cpp
@@ -402,17 +402,17 @@ VRDisplayGVR::GetSensorState()
result.flags |= VRDisplayCapabilityFlags::Cap_Position;
result.position[0] = m._14;
result.position[1] = m._24;
result.position[2] = m._34;
result.linearVelocity[0] = 0.0f;
result.linearVelocity[1] = 0.0f;
result.linearVelocity[2] = 0.0f;
- UpdateHeadToEye(context, &rot);
+ UpdateHeadToEye(context);
result.CalcViewMatrices(mHeadToEyes);
return result;
}
void
VRDisplayGVR::SetPaused(const bool aPaused)
{
@@ -461,32 +461,28 @@ VRDisplayGVR::SetPresentingContext(void*
// generation if we are presenting so that the DOM knows to end the current presentation.
if (mIsPresenting) {
mDisplayInfo.mPresentingGeneration++;
}
}
}
void
-VRDisplayGVR::UpdateHeadToEye(gvr_context* aContext, gfx::Quaternion* aRot)
+VRDisplayGVR::UpdateHeadToEye(gvr_context* aContext)
{
if (!aContext) {
return;
}
for (uint32_t eyeIndex = 0; eyeIndex < 2; eyeIndex++) {
gvr_mat4f eye = GVR_CHECK(gvr_get_eye_from_head_matrix(aContext, eyeIndex));
mDisplayInfo.mEyeTranslation[eyeIndex].x = -eye.m[0][3];
mDisplayInfo.mEyeTranslation[eyeIndex].y = -eye.m[1][3];
mDisplayInfo.mEyeTranslation[eyeIndex].z = -eye.m[2][3];
- if (aRot) {
- mHeadToEyes[eyeIndex].SetRotationFromQuaternion(*aRot);
- } else {
- mHeadToEyes[eyeIndex] = gfx::Matrix4x4();
- }
+ mHeadToEyes[eyeIndex] = gfx::Matrix4x4();
mHeadToEyes[eyeIndex].PreTranslate(eye.m[0][3], eye.m[1][3], eye.m[2][3]);
}
}
void
VRDisplayGVR::UpdateViewport()
{
gvr_context* context = (mPresentingContext ? mPresentingContext : GetNonPresentingContext());
--- a/gfx/vr/gfxVRGVR.h
+++ b/gfx/vr/gfxVRGVR.h
@@ -68,17 +68,17 @@ public:
void SetPaused(const bool aPaused);
void SetPresentingContext(void* aGVRPresentingContext);
void EnableControllers(const bool aEnable, VRSystemManager* aManager);
void UpdateControllers(VRSystemManager* aManager);
void GetControllers(nsTArray<RefPtr<VRControllerHost> >& aControllerResult);
protected:
virtual ~VRDisplayGVR();
- void UpdateHeadToEye(gvr_context* aContext, gfx::Quaternion* aRot = nullptr);
+ void UpdateHeadToEye(gvr_context* aContext);
void UpdateViewport();
void RecreateSwapChain();
bool mIsPresenting;
bool mControllerAdded;
gfx::Matrix4x4 mHeadToEyes[2];
gvr_context* mPresentingContext;