Joint * BVHParser::createJoint( BVHNode * node ) { Joint * b = new Joint(); b->name = node->name; b->offset = node->offset; for( int i = 0; i < node->children.size(); i++ ) { if(!node->children[i]->endNode) b->addChild( createJoint( node->children[i] ) ); } return b; }
Joint* WFObjLoader::loadJoint(BinaryStream& stream) { Joint *jt = new Joint(); bool hasSid = stream.readByte() == 1 ? true : false; if (hasSid) { short sidSize = stream.readShort(); for (int i = 0; i < sidSize; i++) { jt->sid.append(1, stream.readByte()); } } bool hasMatrix = stream.readByte() == 1 ? true : false; if (hasMatrix) { float m[16]; for (int i = 0; i < 16; i++) { m[i] = stream.readFloat(); } jt->baseMatrix->setElements(m); jt->transForm->setElements(m); } bool hasBindPoses = stream.readByte() == 1 ? true : false; if (hasBindPoses) { float m[16]; for (int i = 0; i < 16; i++) { m[i] = stream.readFloat(); } jt->invBindMatrix->setElements(m); } else { jt->hasMesh = false; } int childrenSize = stream.readShort(); for (int i = 0; i < childrenSize; i++) { short type = stream.readShort(); if (type != TYPE_NODE) { LOGE("Illegal type. [type=%d]", type); } jt->addChild(loadJoint(stream)); } return jt; }