diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index a056819a82..14ae1ccb83 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -44,7 +44,7 @@ #include "Util.h" #include "world.h" #include "InterfaceLogging.h" -#include "EntityRig.h" +#include <Rig.h> using namespace std; @@ -965,7 +965,7 @@ void Avatar::setAttachmentData(const QVector<AttachmentData>& attachmentData) { if (_unusedAttachments.size() > 0) { model = _unusedAttachments.takeFirst(); } else { - model = new Model(std::make_shared<EntityRig>(), this); + model = new Model(std::make_shared<Rig>(), this); } model->init(); _attachmentModels.append(model); diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index 4b9bfd21a3..23e17ab864 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -35,7 +35,7 @@ #include "Menu.h" #include "MyAvatar.h" #include "SceneScriptingInterface.h" -#include "AvatarRig.h" +#include <Rig.h> // 70 times per second - target is 60hz, but this helps account for any small deviations // in the update loop @@ -66,7 +66,7 @@ AvatarManager::AvatarManager(QObject* parent) : { // register a meta type for the weak pointer we'll use for the owning avatar mixer for each avatar qRegisterMetaType<QWeakPointer<Node> >("NodeWeakPointer"); - _myAvatar = std::make_shared<MyAvatar>(std::make_shared<AvatarRig>()); + _myAvatar = std::make_shared<MyAvatar>(std::make_shared<Rig>()); auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver(); packetReceiver.registerListener(PacketType::BulkAvatarData, this, "processAvatarDataPacket"); @@ -169,7 +169,7 @@ void AvatarManager::simulateAvatarFades(float deltaTime) { } AvatarSharedPointer AvatarManager::newSharedAvatar() { - return AvatarSharedPointer(std::make_shared<Avatar>(std::make_shared<AvatarRig>())); + return AvatarSharedPointer(std::make_shared<Avatar>(std::make_shared<Rig>())); } // virtual diff --git a/interface/src/avatar/Head.cpp b/interface/src/avatar/Head.cpp index e8452583fc..29ec781f23 100644 --- a/interface/src/avatar/Head.cpp +++ b/interface/src/avatar/Head.cpp @@ -26,7 +26,7 @@ #include "devices/DdeFaceTracker.h" #include "devices/EyeTracker.h" #include "devices/Faceshift.h" -#include "AvatarRig.h" +#include <Rig.h> using namespace std; @@ -62,7 +62,7 @@ Head::Head(Avatar* owningAvatar) : _isLookingAtMe(false), _lookingAtMeStarted(0), _wasLastLookingAtMe(0), - _faceModel(this, std::make_shared<AvatarRig>()), + _faceModel(this, std::make_shared<Rig>()), _leftEyeLookAtID(DependencyManager::get<GeometryCache>()->allocateID()), _rightEyeLookAtID(DependencyManager::get<GeometryCache>()->allocateID()) { diff --git a/interface/src/ui/overlays/ModelOverlay.cpp b/interface/src/ui/overlays/ModelOverlay.cpp index b9cbde9f31..3738f829f3 100644 --- a/interface/src/ui/overlays/ModelOverlay.cpp +++ b/interface/src/ui/overlays/ModelOverlay.cpp @@ -10,7 +10,7 @@ // #include "ModelOverlay.h" -#include "EntityRig.h" +#include <Rig.h> #include "Application.h" @@ -18,7 +18,7 @@ QString const ModelOverlay::TYPE = "model"; ModelOverlay::ModelOverlay() - : _model(std::make_shared<EntityRig>()), + : _model(std::make_shared<Rig>()), _modelTextures(QVariantMap()), _updateModel(false) { @@ -28,7 +28,7 @@ ModelOverlay::ModelOverlay() ModelOverlay::ModelOverlay(const ModelOverlay* modelOverlay) : Volume3DOverlay(modelOverlay), - _model(std::make_shared<EntityRig>()), + _model(std::make_shared<Rig>()), _modelTextures(QVariantMap()), _url(modelOverlay->_url), _updateModel(false) diff --git a/libraries/animation/src/AvatarRig.cpp b/libraries/animation/src/AvatarRig.cpp deleted file mode 100644 index aec696327e..0000000000 --- a/libraries/animation/src/AvatarRig.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -// AvatarRig.cpp -// libraries/animation/src/ -// -// Created by SethAlves on 2015-7-22. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include "AvatarRig.h" - -void AvatarRig::setJointTranslation(int index, bool valid, const glm::vec3& translation, float priority) { - if (index >= 0 && index < (int)_overrideFlags.size()) { - if (valid) { - assert(_overrideFlags.size() == _overridePoses.size()); - _overrideFlags[index] = true; - _overridePoses[index].trans = translation; - } - } -} - -void AvatarRig::setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, float priority) { - if (index >= 0 && index < (int)_overrideFlags.size()) { - assert(_overrideFlags.size() == _overridePoses.size()); - _overrideFlags[index] = true; - _overridePoses[index].rot = rotation; - _overridePoses[index].trans = translation; - } -} diff --git a/libraries/animation/src/AvatarRig.h b/libraries/animation/src/AvatarRig.h deleted file mode 100644 index 230647998a..0000000000 --- a/libraries/animation/src/AvatarRig.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// AvatarRig.h -// libraries/animation/src/ -// -// Created by SethAlves on 2015-7-22. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_AvatarRig_h -#define hifi_AvatarRig_h - -#include <QObject> - -#include "Rig.h" - -class AvatarRig : public Rig { - Q_OBJECT - -public: - ~AvatarRig() {} - virtual void setJointTranslation(int index, bool valid, const glm::vec3& translation, float priority); - virtual void setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, float priority); -}; - - - -#endif // hifi_AvatarRig_h diff --git a/libraries/animation/src/EntityRig.cpp b/libraries/animation/src/EntityRig.cpp deleted file mode 100644 index e96e5d58d5..0000000000 --- a/libraries/animation/src/EntityRig.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// EntityRig.cpp -// libraries/animation/src/ -// -// Created by SethAlves on 2015-7-22. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include "EntityRig.h" - -void EntityRig::setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, float priority) { - if (index >= 0 && index < (int)_overrideFlags.size()) { - assert(_overrideFlags.size() == _overridePoses.size()); - _overrideFlags[index] = true; - _overridePoses[index].rot = rotation; - _overridePoses[index].trans = translation; - } -} diff --git a/libraries/animation/src/EntityRig.h b/libraries/animation/src/EntityRig.h deleted file mode 100644 index d283816a1a..0000000000 --- a/libraries/animation/src/EntityRig.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// EntityRig.h -// libraries/animation/src/ -// -// Created by SethAlves on 2015-7-22. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_EntityRig_h -#define hifi_EntityRig_h - -#include <QObject> - -#include "Rig.h" - -class EntityRig : public Rig { - Q_OBJECT - -public: - ~EntityRig() {} - virtual void setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, float priority); -}; - -#endif // hifi_EntityRig_h diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index ea85460897..b8d5075a9b 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -285,6 +285,25 @@ void Rig::clearJointAnimationPriority(int index) { } } +void Rig::setJointTranslation(int index, bool valid, const glm::vec3& translation, float priority) { + if (index >= 0 && index < (int)_overrideFlags.size()) { + if (valid) { + assert(_overrideFlags.size() == _overridePoses.size()); + _overrideFlags[index] = true; + _overridePoses[index].trans = translation; + } + } +} + +void Rig::setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, float priority) { + if (index >= 0 && index < (int)_overrideFlags.size()) { + assert(_overrideFlags.size() == _overridePoses.size()); + _overrideFlags[index] = true; + _overridePoses[index].rot = rotation; + _overridePoses[index].trans = translation; + } +} + // Deprecated. // WARNING: this is not symmetric with getJointRotation. It's historical. Use the appropriate specific variation. void Rig::setJointRotation(int index, bool valid, const glm::quat& rotation, float priority) { diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index 43977e058f..c73e343303 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -97,9 +97,8 @@ public: void clearJointStates(); void clearJointAnimationPriority(int index); - virtual void setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, - float priority) = 0; - virtual void setJointTranslation(int index, bool valid, const glm::vec3& translation, float priority) {} + void setJointState(int index, bool valid, const glm::quat& rotation, const glm::vec3& translation, float priority); + void setJointTranslation(int index, bool valid, const glm::vec3& translation, float priority); void setJointRotation(int index, bool valid, const glm::quat& rotation, float priority); void restoreJointRotation(int index, float fraction, float priority); diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 8c81ceaeb8..1f5777a0e4 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -43,7 +43,7 @@ #include "RenderablePolyLineEntityItem.h" #include "EntitiesRendererLogging.h" #include "AddressManager.h" -#include "EntityRig.h" +#include <Rig.h> EntityTreeRenderer::EntityTreeRenderer(bool wantScripts, AbstractViewStateInterface* viewState, AbstractScriptingServicesInterface* scriptingServices) : @@ -422,7 +422,7 @@ Model* EntityTreeRenderer::allocateModel(const QString& url, const QString& coll return model; } - model = new Model(std::make_shared<EntityRig>()); + model = new Model(std::make_shared<Rig>()); model->init(); model->setURL(QUrl(url)); model->setCollisionModelURL(QUrl(collisionUrl)); @@ -455,7 +455,7 @@ Model* EntityTreeRenderer::updateModel(Model* original, const QString& newUrl, c } // create the model and correctly initialize it with the new url - model = new Model(std::make_shared<EntityRig>()); + model = new Model(std::make_shared<Rig>()); model->init(); model->setURL(QUrl(newUrl)); model->setCollisionModelURL(QUrl(collisionUrl)); diff --git a/tests/animation/src/RigTests.cpp b/tests/animation/src/RigTests.cpp index ff457ff804..3392f75476 100644 --- a/tests/animation/src/RigTests.cpp +++ b/tests/animation/src/RigTests.cpp @@ -44,7 +44,7 @@ #include "FBXReader.h" #include "OBJReader.h" -#include "AvatarRig.h" // We might later test Rig vs AvatarRig separately, but for now, we're concentrating on the main use case. +#include <Rig.h> #include "RigTests.h" static void reportJoint(int index, JointState joint) { // Handy for debugging @@ -94,7 +94,7 @@ void RigTests::initTestCase() { jointStates.append(state); } - _rig = std::make_shared<AvatarRig>(); + _rig = std::make_shared<Rig>(); _rig->initJointStates(jointStates, glm::mat4(), 0, 41, 40, 39, 17, 16, 15); // FIXME? get by name? do we really want to exclude the shoulder blades? std::cout << "Rig is ready " << geometry->joints.count() << " joints " << std::endl; reportAll(_rig);