mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:58:59 +02:00
Merge branch 'rig' of github.com:howard-stearns/hifi into rig
This commit is contained in:
commit
d5400e2b9d
16 changed files with 60 additions and 35 deletions
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// AnimationCache.cpp
|
// AnimationCache.cpp
|
||||||
// libraries/script-engine/src/
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 4/14/14.
|
// Created by Andrzej Kapolka on 4/14/14.
|
||||||
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// AnimationCache.h
|
// AnimationCache.h
|
||||||
// libraries/script-engine/src/
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 4/14/14.
|
// Created by Andrzej Kapolka on 4/14/14.
|
||||||
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// AnimationHandle.cpp
|
// AnimationHandle.cpp
|
||||||
// interface/src/renderer
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 10/18/13.
|
// Created by Andrzej Kapolka on 10/18/13.
|
||||||
// Copyright 2013 High Fidelity, Inc.
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// AnimationHandle.h
|
// AnimationHandle.h
|
||||||
// interface/src/renderer
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 10/18/13.
|
// Created by Andrzej Kapolka on 10/18/13.
|
||||||
// Copyright 2013 High Fidelity, Inc.
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// AnimationLoop.cpp
|
// AnimationLoop.cpp
|
||||||
// libraries/animation
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Brad Hefta-Gaub on 11/12/14.
|
// Created by Brad Hefta-Gaub on 11/12/14.
|
||||||
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// AnimationLoop.h
|
// AnimationLoop.h
|
||||||
// libraries/script-engine/src/
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Brad Hefta-Gaub on 11/12/14.
|
// Created by Brad Hefta-Gaub on 11/12/14.
|
||||||
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// AnimationObject.cpp
|
// AnimationObject.cpp
|
||||||
// libraries/script-engine/src/
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 4/17/14.
|
// Created by Andrzej Kapolka on 4/17/14.
|
||||||
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// AnimationObject.h
|
// AnimationObject.h
|
||||||
// libraries/script-engine/src/
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 4/17/14.
|
// Created by Andrzej Kapolka on 4/17/14.
|
||||||
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2014 High Fidelity, Inc. All rights reserved.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// JointState.cpp
|
// JointState.cpp
|
||||||
// interface/src/renderer
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 10/18/13.
|
// Created by Andrzej Kapolka on 10/18/13.
|
||||||
// Copyright 2013 High Fidelity, Inc.
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// JointState.h
|
// JointState.h
|
||||||
// interface/src/renderer
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Andrzej Kapolka on 10/18/13.
|
// Created by Andrzej Kapolka on 10/18/13.
|
||||||
// Copyright 2013 High Fidelity, Inc.
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// Rig.cpp
|
// Rig.cpp
|
||||||
// libraries/script-engine/src/
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Created by Howard Stearns, Seth Alves, Anthony Thibault, Andrew Meadows on 7/15/15.
|
// Created by Howard Stearns, Seth Alves, Anthony Thibault, Andrew Meadows on 7/15/15.
|
||||||
// Copyright (c) 2015 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2015 High Fidelity, Inc. All rights reserved.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//
|
//
|
||||||
// Rig.h
|
// Rig.h
|
||||||
// libraries/script-engine/src/
|
// libraries/animation/src/
|
||||||
//
|
//
|
||||||
// Produces animation data and hip placement for the current timestamp.
|
// Produces animation data and hip placement for the current timestamp.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1087,7 +1087,7 @@ void AvatarData::setJointMappingsFromNetworkReply() {
|
||||||
}
|
}
|
||||||
|
|
||||||
networkReply->deleteLater();
|
networkReply->deleteLater();
|
||||||
emit jointsLoaded();
|
emit jointMappingLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarData::sendAvatarDataPacket() {
|
void AvatarData::sendAvatarDataPacket() {
|
||||||
|
|
|
@ -313,7 +313,7 @@ public:
|
||||||
bool shouldDie() const { return _owningAvatarMixer.isNull() || getUsecsSinceLastUpdate() > AVATAR_SILENCE_THRESHOLD_USECS; }
|
bool shouldDie() const { return _owningAvatarMixer.isNull() || getUsecsSinceLastUpdate() > AVATAR_SILENCE_THRESHOLD_USECS; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void jointsLoaded(); // So that test cases or anyone waiting on asynchronous loading can be informed.
|
void jointMappingLoaded(); // So that test cases or anyone waiting on asynchronous loading can be informed.
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sendAvatarDataPacket();
|
void sendAvatarDataPacket();
|
||||||
|
|
|
@ -40,30 +40,55 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
//#include "FSTReader.h"
|
#include <PathUtils.h>
|
||||||
// There are two good ways we could organize this:
|
|
||||||
// 1. Create a MyAvatar the same way that Interface does, and poke at it.
|
|
||||||
// We can't do that because MyAvatar (and even Avatar) are in interface, not a library, and our build system won't allow that dependency.
|
|
||||||
// 2. Create just the minimum skeleton in the most direct way possible, using only very basic library APIs (such as fbx).
|
|
||||||
// I don't think we can do that because not everything we need is exposed directly from, e.g., the fst and fbx readers.
|
|
||||||
// So here we do neither. Using as much as we can from AvatarData (which is in the avatar and further requires network and audio), and
|
|
||||||
// duplicating whatever other code we need from (My)Avatar. Ugh. We may refactor that later, but right now, cleaning this up is not on our critical path.
|
|
||||||
#include "AvatarData.h"
|
#include "AvatarData.h"
|
||||||
|
#include "OBJReader.h"
|
||||||
|
#include "FBXReader.h"
|
||||||
|
|
||||||
|
#include "AvatarRig.h" // We might later test Rig vs AvatarRig separately, but for now, we're concentrating on the main use case.
|
||||||
#include "RigTests.h"
|
#include "RigTests.h"
|
||||||
|
|
||||||
QTEST_MAIN(RigTests)
|
QTEST_MAIN(RigTests)
|
||||||
|
|
||||||
void RigTests::initTestCase() {
|
void RigTests::initTestCase() {
|
||||||
AvatarData avatar;
|
|
||||||
QEventLoop loop; // Create an event loop that will quit when we get the finished signal
|
|
||||||
QObject::connect(&avatar, &AvatarData::jointsLoaded, &loop, &QEventLoop::quit);
|
|
||||||
avatar.setSkeletonModelURL(QUrl("https://hifi-public.s3.amazonaws.com/marketplace/contents/4a690585-3fa3-499e-9f8b-fd1226e561b1/e47e6898027aa40f1beb6adecc6a7db5.fst")); // Zach
|
|
||||||
//std::cout << "sleep start" << std::endl;
|
|
||||||
loop.exec(); // Nothing is going to happen on this whole run thread until we get this
|
|
||||||
_rig = new Rig();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RigTests::dummyPassTest() {
|
// There are two good ways we could organize this:
|
||||||
|
// 1. Create a MyAvatar the same way that Interface does, and poke at it.
|
||||||
|
// We can't do that because MyAvatar (and even Avatar) are in interface, not a library, and our build system won't allow that dependency.
|
||||||
|
// 2. Create just the minimum skeleton in the most direct way possible, using only very basic library APIs (such as fbx).
|
||||||
|
// I don't think we can do that because not everything we need is exposed directly from, e.g., the fst and fbx readers.
|
||||||
|
// So here we do neither. Using as much as we can from AvatarData (which is in the avatar and further requires network and audio), and
|
||||||
|
// duplicating whatever other code we need from (My)Avatar. Ugh. We may refactor that later, but right now, cleaning this up is not on our critical path.
|
||||||
|
|
||||||
|
// Joint mapping from fst
|
||||||
|
auto avatar = std::make_shared<AvatarData>();
|
||||||
|
QEventLoop loop; // Create an event loop that will quit when we get the finished signal
|
||||||
|
QObject::connect(avatar.get(), &AvatarData::jointMappingLoaded, &loop, &QEventLoop::quit);
|
||||||
|
avatar->setSkeletonModelURL(QUrl("https://hifi-public.s3.amazonaws.com/marketplace/contents/4a690585-3fa3-499e-9f8b-fd1226e561b1/e47e6898027aa40f1beb6adecc6a7db5.fst")); // Zach fst
|
||||||
|
loop.exec(); // Blocking all further tests until signalled.
|
||||||
|
|
||||||
|
// Joint geometry from fbx.
|
||||||
|
QUrl fbxUrl("https://s3.amazonaws.com/hifi-public/models/skeletons/Zack/Zack.fbx");
|
||||||
|
QNetworkReply* netReply = OBJReader().request(fbxUrl, false); // Just a convenience hack for synchronoud http request
|
||||||
|
QCOMPARE(netReply->isFinished() && (netReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200), true);
|
||||||
|
FBXGeometry geometry = readFBX(netReply->readAll(), QVariantHash());
|
||||||
|
QCOMPARE(geometry.joints.count(), avatar->getJointNames().count());
|
||||||
|
|
||||||
|
QVector<JointState> jointStates;
|
||||||
|
for (int i = 0; i < geometry.joints.size(); ++i) {
|
||||||
|
const FBXJoint& joint = geometry.joints[i];
|
||||||
|
JointState state;
|
||||||
|
state.setFBXJoint(&joint);
|
||||||
|
jointStates.append(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
_rig = std::make_shared<AvatarRig>();
|
||||||
|
_rig->initJointStates(jointStates, glm::mat4());
|
||||||
|
std::cout << "Rig is ready " << geometry.joints.count() << " joints " << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*void RigTests::dummyPassTest() {
|
||||||
bool x = true;
|
bool x = true;
|
||||||
std::cout << "dummyPassTest x=" << x << std::endl;
|
std::cout << "dummyPassTest x=" << x << std::endl;
|
||||||
QCOMPARE(x, true);
|
QCOMPARE(x, true);
|
||||||
|
@ -73,4 +98,4 @@ void RigTests::dummyFailTest() {
|
||||||
bool x = false;
|
bool x = false;
|
||||||
std::cout << "dummyFailTest x=" << x << std::endl;
|
std::cout << "dummyFailTest x=" << x << std::endl;
|
||||||
QCOMPARE(x, true);
|
QCOMPARE(x, true);
|
||||||
}
|
}*/
|
||||||
|
|
|
@ -46,11 +46,11 @@ class RigTests : public QObject {
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
void dummyPassTest();
|
/*void dummyPassTest();
|
||||||
void dummyFailTest();
|
void dummyFailTest();*/
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Rig* _rig;
|
RigPointer _rig;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RigTests_h
|
#endif // hifi_RigTests_h
|
||||||
|
|
Loading…
Reference in a new issue