mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:17:01 +02:00
Test evolution.
This commit is contained in:
parent
4e298d815d
commit
cff7bb703e
2 changed files with 31 additions and 20 deletions
|
@ -61,25 +61,34 @@ void RigTests::initTestCase() {
|
||||||
// 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
|
// 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.
|
// 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
|
// Joint mapping from fst. FIXME: Do we need this???
|
||||||
auto avatar = std::make_shared<AvatarData>();
|
/*auto avatar = std::make_shared<AvatarData>();
|
||||||
QEventLoop loop; // Create an event loop that will quit when we get the finished signal
|
QEventLoop loop; // Create an event loop that will quit when we get the finished signal
|
||||||
QObject::connect(avatar.get(), &AvatarData::jointMappingLoaded, &loop, &QEventLoop::quit);
|
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
|
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.
|
loop.exec();*/ // Blocking all further tests until signalled.
|
||||||
|
|
||||||
// Joint geometry from fbx.
|
// Joint geometry from fbx.
|
||||||
|
#define FROM_FILE "/Users/howardstearns/howardHiFi/Zack.fbx"
|
||||||
|
#ifdef FROM_FILE
|
||||||
|
QFile file(FROM_FILE);
|
||||||
|
QCOMPARE(file.open(QIODevice::ReadOnly), true);
|
||||||
|
FBXGeometry geometry = readFBX(file.readAll(), QVariantHash());
|
||||||
|
#else
|
||||||
QUrl fbxUrl("https://s3.amazonaws.com/hifi-public/models/skeletons/Zack/Zack.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
|
QNetworkReply* reply = OBJReader().request(fbxUrl, false); // Just a convenience hack for synchronoud http request
|
||||||
QCOMPARE(netReply->isFinished() && (netReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200), true);
|
auto fbxHttpCode = !reply->isFinished() ? -1 : reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
FBXGeometry geometry = readFBX(netReply->readAll(), QVariantHash());
|
QCOMPARE(fbxHttpCode, 200);
|
||||||
QCOMPARE(geometry.joints.count(), avatar->getJointNames().count());
|
FBXGeometry geometry = readFBX(reply->readAll(), QVariantHash());
|
||||||
|
#endif
|
||||||
|
//QCOMPARE(geometry.joints.count(), avatar->getJointNames().count());
|
||||||
|
|
||||||
QVector<JointState> jointStates;
|
QVector<JointState> jointStates;
|
||||||
for (int i = 0; i < geometry.joints.size(); ++i) {
|
for (int i = 0; i < geometry.joints.size(); ++i) {
|
||||||
const FBXJoint& joint = geometry.joints[i];
|
// Note that if the geometry is stack allocated and goes away, so will the joints. Hence the heap copy here.
|
||||||
|
FBXJoint* joint = new FBXJoint(geometry.joints[i]);
|
||||||
JointState state;
|
JointState state;
|
||||||
state.setFBXJoint(&joint);
|
state.setFBXJoint(joint);
|
||||||
jointStates.append(state);
|
jointStates.append(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,14 +97,17 @@ void RigTests::initTestCase() {
|
||||||
std::cout << "Rig is ready " << geometry.joints.count() << " joints " << std::endl;
|
std::cout << "Rig is ready " << geometry.joints.count() << " joints " << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void RigTests::dummyPassTest() {
|
void reportJoint(int index, JointState joint) { // Handy for debugging
|
||||||
bool x = true;
|
std::cout << "\n";
|
||||||
std::cout << "dummyPassTest x=" << x << std::endl;
|
std::cout << index << " " << joint.getFBXJoint().name.toUtf8().data() << "\n";
|
||||||
QCOMPARE(x, true);
|
std::cout << " pos:" << joint.getPosition() << "/" << joint.getPositionInParentFrame() << " from " << joint.getParentIndex() << "\n";
|
||||||
|
std::cout << " rot:" << safeEulerAngles(joint.getRotation()) << "/" << safeEulerAngles(joint.getRotationInParentFrame()) << "/" << safeEulerAngles(joint.getRotationInBindFrame()) << "\n";
|
||||||
|
std::cout << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void RigTests::dummyFailTest() {
|
void RigTests::initialPoseArmsDown() {
|
||||||
bool x = false;
|
for (int i = 0; i < _rig->getJointStateCount(); i++) {
|
||||||
std::cout << "dummyFailTest x=" << x << std::endl;
|
JointState joint = _rig->getJointState(i);
|
||||||
QCOMPARE(x, true);
|
reportJoint(i, joint);
|
||||||
}*/
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -46,8 +46,7 @@ class RigTests : public QObject {
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
/*void dummyPassTest();
|
void initialPoseArmsDown();
|
||||||
void dummyFailTest();*/
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RigPointer _rig;
|
RigPointer _rig;
|
||||||
|
|
Loading…
Reference in a new issue