Removed EntityRig and AvatarRig. One Rig to rule them all.

This commit is contained in:
Anthony J. Thibault 2015-11-20 14:27:01 -08:00
parent a77ea8da43
commit cb89f09635
12 changed files with 36 additions and 127 deletions

View file

@ -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);

View file

@ -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

View file

@ -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())
{

View file

@ -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)

View file

@ -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;
}
}

View file

@ -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

View file

@ -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;
}
}

View file

@ -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

View file

@ -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) {

View file

@ -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);

View file

@ -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));

View file

@ -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);