Example #1
0
void RigTests::initTestCase() {
//#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");
    QNetworkReply* reply = OBJReader().request(fbxUrl, false);  // Just a convenience hack for synchronoud http request
    auto fbxHttpCode = !reply->isFinished() ? -1 : reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
    QCOMPARE(fbxHttpCode, 200);
    FBXGeometry geometry = readFBX(reply->readAll(), QVariantHash());
#endif
 
    QVector<JointState> jointStates;
    for (int i = 0; i < geometry.joints.size(); ++i) {
        JointState state(geometry.joints[i]);
        jointStates.append(state);
    }

    _rig = std::make_shared<AvatarRig>();
    _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);
   }
Example #2
0
void RigTests::initTestCase() {
//#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");
    QNetworkReply* reply = OBJReader().request(fbxUrl, false);  // Just a convenience hack for synchronoud http request
    auto fbxHttpCode = !reply->isFinished() ? -1 : reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
    QCOMPARE(fbxHttpCode, 200);
    FBXGeometry* geometry = readFBX(reply->readAll(), QVariantHash());
#endif
    QVERIFY((bool)geometry);

    _rig = std::make_shared<Rig>();
    _rig->initJointStates(*geometry, glm::mat4());
    std::cout << "Rig is ready " << geometry->joints.count() << " joints " << std::endl;
    reportAll(_rig);
}