From 9421af9f108bc4323181da90e9260332ca32f238 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 6 May 2014 11:14:48 -0700 Subject: [PATCH] Fix for attachments' not appearing in rear view mirror head mode. --- interface/src/Application.cpp | 13 ++++++++++++- interface/src/avatar/Avatar.h | 1 + interface/src/ui/AttachmentsDialog.cpp | 1 - 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d9cc78304f..b50e9ef1dc 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2843,7 +2843,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { // save absolute translations glm::vec3 absoluteSkeletonTranslation = _myAvatar->getSkeletonModel().getTranslation(); glm::vec3 absoluteFaceTranslation = _myAvatar->getHead()->getFaceModel().getTranslation(); - + // get the eye positions relative to the neck and use them to set the face translation glm::vec3 leftEyePosition, rightEyePosition; _myAvatar->getHead()->getFaceModel().setTranslation(glm::vec3()); @@ -2857,11 +2857,22 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { _myAvatar->getSkeletonModel().setTranslation(_myAvatar->getHead()->getFaceModel().getTranslation() - neckPosition); + // update the attachments to match + QVector absoluteAttachmentTranslations; + glm::vec3 delta = _myAvatar->getSkeletonModel().getTranslation() - absoluteSkeletonTranslation; + foreach (Model* attachment, _myAvatar->getAttachmentModels()) { + absoluteAttachmentTranslations.append(attachment->getTranslation()); + attachment->setTranslation(attachment->getTranslation() + delta); + } + displaySide(_mirrorCamera, true); // restore absolute translations _myAvatar->getSkeletonModel().setTranslation(absoluteSkeletonTranslation); _myAvatar->getHead()->getFaceModel().setTranslation(absoluteFaceTranslation); + for (int i = 0; i < absoluteAttachmentTranslations.size(); i++) { + _myAvatar->getAttachmentModels().at(i)->setTranslation(absoluteAttachmentTranslations.at(i)); + } } else { displaySide(_mirrorCamera, true); } diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index b96145b213..edd53e4b8f 100755 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -83,6 +83,7 @@ public: //getters bool isInitialized() const { return _initialized; } SkeletonModel& getSkeletonModel() { return _skeletonModel; } + const QVector& getAttachmentModels() const { return _attachmentModels; } glm::vec3 getChestPosition() const; float getScale() const { return _scale; } const glm::vec3& getVelocity() const { return _velocity; } diff --git a/interface/src/ui/AttachmentsDialog.cpp b/interface/src/ui/AttachmentsDialog.cpp index 79b8d42f41..9fa26a2f00 100644 --- a/interface/src/ui/AttachmentsDialog.cpp +++ b/interface/src/ui/AttachmentsDialog.cpp @@ -68,7 +68,6 @@ void AttachmentsDialog::addAttachment(const AttachmentData& data) { static QDoubleSpinBox* createTranslationBox(AttachmentsDialog* dialog, float value) { QDoubleSpinBox* box = new QDoubleSpinBox(); - box->setSingleStep(0.01); box->setMinimum(-FLT_MAX); box->setMaximum(FLT_MAX); box->setValue(value);