Skip to content

Commit

Permalink
Set ExternalVR timestamp (#928)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro authored and bluemarvin committed Feb 7, 2019
1 parent f198c0d commit 79c5a6a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/main/cpp/BrowserWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ BrowserWorld::DrawImmersive() {

m.device->StartFrame();
VRB_GL_CHECK(glDepthMask(GL_FALSE));
m.externalVR->PushFramePoses(m.device->GetHeadTransform(), m.controllers->GetControllers());
m.externalVR->PushFramePoses(m.device->GetHeadTransform(), m.controllers->GetControllers(), m.context->GetTimestamp());
int32_t surfaceHandle = 0;
device::EyeRect leftEye, rightEye;
bool aDiscardFrame = !m.externalVR->WaitFrameResult();
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/cpp/ExternalVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ ExternalVR::GetVRState() const {
}

void
ExternalVR::PushFramePoses(const vrb::Matrix& aHeadTransform, const std::vector<Controller>& aControllers) {
ExternalVR::PushFramePoses(const vrb::Matrix& aHeadTransform, const std::vector<Controller>& aControllers, const double aTimestamp) {
const vrb::Matrix inverseHeadTransform = aHeadTransform.Inverse();
vrb::Quaternion quaternion(inverseHeadTransform);
vrb::Vector translation = aHeadTransform.GetTranslation();
Expand Down Expand Up @@ -429,6 +429,8 @@ ExternalVR::PushFramePoses(const vrb::Matrix& aHeadTransform, const std::vector<
}
}

m.system.sensorState.timestamp = aTimestamp;

PushSystemState();
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/cpp/ExternalVR.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ExternalVR : public ImmersiveDisplay {
void SetCompositorEnabled(bool aEnabled);
bool IsPresenting() const;
VRState GetVRState() const;
void PushFramePoses(const vrb::Matrix& aHeadTransform, const std::vector<Controller>& aControllers);
void PushFramePoses(const vrb::Matrix& aHeadTransform, const std::vector<Controller>& aControllers, const double aTimestamp);
bool WaitFrameResult();
void GetFrameResult(int32_t& aSurfaceHandle, device::EyeRect& aLeftEye, device::EyeRect& aRightEye) const;
void StopPresenting();
Expand Down

0 comments on commit 79c5a6a

Please sign in to comment.