mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
DisplayPlugins: updateHeadPose() no longer returns a value.
Also, moved updateHeadPose so that the overlay and the main rendering use the same headPose. Which should also be the same place the latencyMarker for the ovr_GetTrackingState is set.
This commit is contained in:
parent
2faaf243a1
commit
960ffd9c9e
6 changed files with 13 additions and 21 deletions
|
@ -1418,6 +1418,12 @@ void Application::paintGL() {
|
||||||
// FIXME not needed anymore?
|
// FIXME not needed anymore?
|
||||||
_offscreenContext->makeCurrent();
|
_offscreenContext->makeCurrent();
|
||||||
|
|
||||||
|
// Tell the plugin what pose we're using to render. In this case we're just using the
|
||||||
|
// unmodified head pose because the only plugin that cares (the Oculus plugin) uses it
|
||||||
|
// for rotational timewarp. If we move to support positonal timewarp, we need to
|
||||||
|
// ensure this contains the full pose composed with the eye offsets.
|
||||||
|
displayPlugin->updateHeadPose(_frameCount);
|
||||||
|
|
||||||
// update the avatar with a fresh HMD pose
|
// update the avatar with a fresh HMD pose
|
||||||
getMyAvatar()->updateFromHMDSensorMatrix(getHMDSensorPose());
|
getMyAvatar()->updateFromHMDSensorMatrix(getHMDSensorPose());
|
||||||
|
|
||||||
|
@ -1598,12 +1604,7 @@ void Application::paintGL() {
|
||||||
auto baseProjection = renderArgs._viewFrustum->getProjection();
|
auto baseProjection = renderArgs._viewFrustum->getProjection();
|
||||||
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
|
auto hmdInterface = DependencyManager::get<HMDScriptingInterface>();
|
||||||
float IPDScale = hmdInterface->getIPDScale();
|
float IPDScale = hmdInterface->getIPDScale();
|
||||||
|
mat4 headPose = displayPlugin->getHeadPose();
|
||||||
// Tell the plugin what pose we're using to render. In this case we're just using the
|
|
||||||
// unmodified head pose because the only plugin that cares (the Oculus plugin) uses it
|
|
||||||
// for rotational timewarp. If we move to support positonal timewarp, we need to
|
|
||||||
// ensure this contains the full pose composed with the eye offsets.
|
|
||||||
mat4 headPose = displayPlugin->updateHeadPose(_frameCount);
|
|
||||||
|
|
||||||
// FIXME we probably don't need to set the projection matrix every frame,
|
// FIXME we probably don't need to set the projection matrix every frame,
|
||||||
// only when the display plugin changes (or in non-HMD modes when the user
|
// only when the display plugin changes (or in non-HMD modes when the user
|
||||||
|
|
|
@ -122,9 +122,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// will query the underlying hmd api to compute the most recent head pose
|
// will query the underlying hmd api to compute the most recent head pose
|
||||||
virtual glm::mat4 updateHeadPose(uint32_t frameIndex) {
|
virtual void updateHeadPose(uint32_t frameIndex) {}
|
||||||
return glm::mat4();
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns a copy of the most recent head pose, computed via updateHeadPose
|
// returns a copy of the most recent head pose, computed via updateHeadPose
|
||||||
virtual glm::mat4 getHeadPose() const {
|
virtual glm::mat4 getHeadPose() const {
|
||||||
|
|
|
@ -15,16 +15,11 @@ void OculusBaseDisplayPlugin::resetSensors() {
|
||||||
ovr_RecenterPose(_session);
|
ovr_RecenterPose(_session);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 OculusBaseDisplayPlugin::updateHeadPose(uint32_t frameIndex) {
|
void OculusBaseDisplayPlugin::updateHeadPose(uint32_t frameIndex) {
|
||||||
static uint32_t lastFrameSeen = 0;
|
|
||||||
auto displayTime = ovr_GetPredictedDisplayTime(_session, frameIndex);
|
auto displayTime = ovr_GetPredictedDisplayTime(_session, frameIndex);
|
||||||
auto trackingState = ovr_GetTrackingState(_session, displayTime, frameIndex > lastFrameSeen);
|
auto trackingState = ovr_GetTrackingState(_session, displayTime, true);
|
||||||
if (frameIndex > lastFrameSeen) {
|
|
||||||
lastFrameSeen = frameIndex;
|
|
||||||
}
|
|
||||||
mat4 headPose = toGlm(trackingState.HeadPose.ThePose);
|
mat4 headPose = toGlm(trackingState.HeadPose.ThePose);
|
||||||
_headPoseCache.set(headPose);
|
_headPoseCache.set(headPose);
|
||||||
return headPose;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 OculusBaseDisplayPlugin::getHeadPose() const {
|
glm::mat4 OculusBaseDisplayPlugin::getHeadPose() const {
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
|
|
||||||
// Stereo specific methods
|
// Stereo specific methods
|
||||||
virtual void resetSensors() override final;
|
virtual void resetSensors() override final;
|
||||||
virtual glm::mat4 updateHeadPose(uint32_t frameIndex) override;
|
virtual void updateHeadPose(uint32_t frameIndex) override;
|
||||||
virtual glm::mat4 getHeadPose() const override;
|
virtual glm::mat4 getHeadPose() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -112,7 +112,7 @@ void OpenVrDisplayPlugin::resetSensors() {
|
||||||
_sensorResetMat = glm::inverse(cancelOutRollAndPitch(m));
|
_sensorResetMat = glm::inverse(cancelOutRollAndPitch(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 OpenVrDisplayPlugin::updateHeadPose(uint32_t frameIndex) {
|
void OpenVrDisplayPlugin::updateHeadPose(uint32_t frameIndex) {
|
||||||
|
|
||||||
float displayFrequency = _system->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_DisplayFrequency_Float);
|
float displayFrequency = _system->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_DisplayFrequency_Float);
|
||||||
float frameDuration = 1.f / displayFrequency;
|
float frameDuration = 1.f / displayFrequency;
|
||||||
|
@ -141,8 +141,6 @@ glm::mat4 OpenVrDisplayPlugin::updateHeadPose(uint32_t frameIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_headPoseCache.set(_trackedDevicePoseMat4[0]);
|
_headPoseCache.set(_trackedDevicePoseMat4[0]);
|
||||||
|
|
||||||
return _trackedDevicePoseMat4[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 OpenVrDisplayPlugin::getHeadPose() const {
|
glm::mat4 OpenVrDisplayPlugin::getHeadPose() const {
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
|
|
||||||
// Stereo specific methods
|
// Stereo specific methods
|
||||||
virtual void resetSensors() override;
|
virtual void resetSensors() override;
|
||||||
virtual glm::mat4 updateHeadPose(uint32_t frameIndex) override;
|
virtual void updateHeadPose(uint32_t frameIndex) override;
|
||||||
virtual glm::mat4 getHeadPose() const override;
|
virtual glm::mat4 getHeadPose() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue