Skip to content

Commit

Permalink
Set ExternalVR timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Feb 4, 2019
1 parent 2aa5299 commit 581174c
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 @@ -1033,7 +1033,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 @@ -347,7 +347,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 @@ -404,6 +404,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 @@ -47,7 +47,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 581174c

Please sign in to comment.