mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 10:43:21 +02:00
Merge pull request #5332 from ctrlaltdavid/20612
Fix full-screen mirror not mirroring correctly with Faceshift or DDE
This commit is contained in:
commit
6dbe6bc375
1 changed files with 16 additions and 8 deletions
|
@ -79,7 +79,7 @@ const float MyAvatar::ZOOM_MAX = 25.0f;
|
||||||
const float MyAvatar::ZOOM_DEFAULT = 1.5f;
|
const float MyAvatar::ZOOM_DEFAULT = 1.5f;
|
||||||
|
|
||||||
MyAvatar::MyAvatar() :
|
MyAvatar::MyAvatar() :
|
||||||
Avatar(),
|
Avatar(),
|
||||||
_gravity(0.0f, 0.0f, 0.0f),
|
_gravity(0.0f, 0.0f, 0.0f),
|
||||||
_wasPushing(false),
|
_wasPushing(false),
|
||||||
_isPushing(false),
|
_isPushing(false),
|
||||||
|
@ -253,6 +253,9 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FaceTracker* tracker = Application::getInstance()->getActiveFaceTracker();
|
||||||
|
bool inFacetracker = tracker && !tracker->isMuted();
|
||||||
|
|
||||||
if (inHmd) {
|
if (inHmd) {
|
||||||
estimatedPosition = qApp->getHeadPosition();
|
estimatedPosition = qApp->getHeadPosition();
|
||||||
estimatedPosition.x *= -1.0f;
|
estimatedPosition.x *= -1.0f;
|
||||||
|
@ -260,12 +263,17 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
|
|
||||||
const float OCULUS_LEAN_SCALE = 0.05f;
|
const float OCULUS_LEAN_SCALE = 0.05f;
|
||||||
estimatedPosition /= OCULUS_LEAN_SCALE;
|
estimatedPosition /= OCULUS_LEAN_SCALE;
|
||||||
} else {
|
} else if (inFacetracker) {
|
||||||
FaceTracker* tracker = Application::getInstance()->getActiveFaceTracker();
|
estimatedPosition = tracker->getHeadTranslation();
|
||||||
if (tracker && !tracker->isMuted()) {
|
_trackedHeadPosition = estimatedPosition;
|
||||||
estimatedPosition = tracker->getHeadTranslation();
|
estimatedRotation = glm::degrees(safeEulerAngles(tracker->getHeadRotation()));
|
||||||
_trackedHeadPosition = estimatedPosition;
|
if (Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||||
estimatedRotation = glm::degrees(safeEulerAngles(tracker->getHeadRotation()));
|
// Invert yaw and roll when in mirror mode
|
||||||
|
// NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror
|
||||||
|
// it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to
|
||||||
|
// match your body movements.
|
||||||
|
YAW(estimatedRotation) *= -1.0f;
|
||||||
|
ROLL(estimatedRotation) *= -1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +320,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
// NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror
|
// NOTE: this is kinda a hack, it's the same hack we use to make the head tilt. But it's not really a mirror
|
||||||
// it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to
|
// it just makes you feel like you're looking in a mirror because the body movements of the avatar appear to
|
||||||
// match your body movements.
|
// match your body movements.
|
||||||
if (inHmd && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
if ((inHmd || inFacetracker) && Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
|
||||||
relativePosition.x = -relativePosition.x;
|
relativePosition.x = -relativePosition.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue