animation is ok.

This commit is contained in:
lvlong 2014-08-16 19:51:59 +08:00
parent 9c41b1a826
commit b1c9fb99e3
2 changed files with 4 additions and 3 deletions

View File

@ -1292,7 +1292,7 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue)
for (rapidjson::SizeType j = 0; j < bones.Size(); j++) for (rapidjson::SizeType j = 0; j < bones.Size(); j++)
{ {
const rapidjson::Value& bone = bones[i]; const rapidjson::Value& bone = bones[j];
// node // node
if (!bone.HasMember(NODE)) if (!bone.HasMember(NODE))
@ -1306,9 +1306,9 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue)
Mat4 invbindpos; Mat4 invbindpos;
const rapidjson::Value& jtransform = bone[TRANSFORM]; const rapidjson::Value& jtransform = bone[TRANSFORM];
for (rapidjson::SizeType j = 0; j < jtransform.Size(); j++) for (rapidjson::SizeType k = 0; k < jtransform.Size(); k++)
{ {
invbindpos.m[j] = jtransform[j].GetDouble(); invbindpos.m[k] = jtransform[k].GetDouble();
} }
//invbindpos.inverse(); //invbindpos.inverse();

View File

@ -299,6 +299,7 @@ Skeleton3D* Skeleton3D::create(const std::vector<NodeData*>& skeletondata)
auto skeleton = new Skeleton3D(); auto skeleton = new Skeleton3D();
for (const auto& it : skeletondata) { for (const auto& it : skeletondata) {
auto bone = skeleton->createBone3D(*it); auto bone = skeleton->createBone3D(*it);
bone->resetPose();
skeleton->_rootBones.pushBack(bone); skeleton->_rootBones.pushBack(bone);
} }
skeleton->autorelease(); skeleton->autorelease();