mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 04:12:09 +02:00
Fix offset when UI transform is not identity
This commit is contained in:
parent
175dbb8924
commit
f3c47acbb2
4 changed files with 9 additions and 1 deletions
|
@ -415,9 +415,11 @@ bool HmdDisplayPlugin::setHandLaser(uint32_t hands, HandLaserMode mode, const ve
|
|||
void HmdDisplayPlugin::compositeExtra() {
|
||||
std::array<HandLaserInfo, 2> handLasers;
|
||||
std::array<mat4, 2> renderHandPoses;
|
||||
Transform uiModelTransform;
|
||||
withPresentThreadLock([&] {
|
||||
handLasers = _handLasers;
|
||||
renderHandPoses = _handPoses;
|
||||
uiModelTransform = _uiModelTransform;
|
||||
});
|
||||
|
||||
// If neither hand laser is activated, exit
|
||||
|
@ -457,7 +459,7 @@ void HmdDisplayPlugin::compositeExtra() {
|
|||
|
||||
// Find the intersection of the laser with he UI and use it to scale the model matrix
|
||||
float distance;
|
||||
if (!glm::intersectRaySphere(vec3(renderHandPoses[i][3]), castDirection, vec3(0), uiRadius * uiRadius, distance)) {
|
||||
if (!glm::intersectRaySphere(vec3(renderHandPoses[i][3]), castDirection, uiModelTransform.getTranslation(), uiRadius * uiRadius, distance)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <ThreadSafeValueCache.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <Transform.h>
|
||||
|
||||
#include "../OpenGLDisplayPlugin.h"
|
||||
|
||||
|
@ -59,6 +60,7 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
Transform _uiModelTransform;
|
||||
std::array<HandLaserInfo, 2> _handLasers;
|
||||
std::array<glm::mat4, 2> _handPoses;
|
||||
std::array<glm::mat4, 2> _eyeOffsets;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <ViewFrustum.h>
|
||||
#include <controllers/Pose.h>
|
||||
#include <display-plugins/CompositorHelper.h>
|
||||
|
||||
#include "OculusHelpers.h"
|
||||
|
||||
|
@ -40,6 +41,7 @@ bool OculusBaseDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
|||
});
|
||||
|
||||
withRenderThreadLock([&] {
|
||||
_uiModelTransform = DependencyManager::get<CompositorHelper>()->getModelTransform();
|
||||
_handPoses = handPoses;
|
||||
_frameInfos[frameIndex] = _currentRenderFrameInfo;
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <PerfStat.h>
|
||||
#include <plugins/PluginContainer.h>
|
||||
#include <ViewFrustum.h>
|
||||
#include <display-plugins/CompositorHelper.h>
|
||||
#include <shared/NsightHelpers.h>
|
||||
#include "OpenVrHelpers.h"
|
||||
|
||||
|
@ -198,6 +199,7 @@ bool OpenVrDisplayPlugin::beginFrameRender(uint32_t frameIndex) {
|
|||
}
|
||||
|
||||
withRenderThreadLock([&] {
|
||||
_uiModelTransform = DependencyManager::get<CompositorHelper>()->getModelTransform();
|
||||
// Make controller poses available to the presentation thread
|
||||
_handPoses = handPoses;
|
||||
_frameInfos[frameIndex] = _currentRenderFrameInfo;
|
||||
|
|
Loading…
Reference in a new issue