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); }
void init() { glClearColor(0.0, 0.0, 0.0, 1.0); glClearDepth(1.0); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); GLfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 }; GLfloat light_specular[] = {1.0, 1.0, 0.0,1.0}; GLfloat light_diffuse[] = {0.50, 0.50, 0.5,1.0}; GLfloat mat_specular[] = { 0.8, 0.5, 0.5, 1.0 }; GLfloat mat_shininess[] = { 20.0 }; GLfloat mat_ambient[] = { 0.2, 0.4, 0.99, 1.0 }; GLfloat mat_diffuse[] = { 0.4, 0.4, 0.4, 1.0 }; glShadeModel (GL_SMOOTH); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); glLightfv(GL_LIGHT0, GL_POSITION, light_position); glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); cam = new Camera(90); cam->resetView(width, height); mesh = new Mesh(); OBJReader r = OBJReader("cow.obj", mesh); r.readObj(); }
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); }