/// <summary> /// Create bone /// </summary> /// <param name="setMatrix">Set matrix</param> /// <param name="setParentBone">Set parent bone</param> /// <param name="setNum">Set number</param> /// <param name="setId">Set id name</param> public ColladaBone(Matrix setMatrix, ColladaBone setParentBone, int setNum, string setId, string nSid) { initialMatrix = setMatrix; pos = initialMatrix.Translation; parent = setParentBone; num = setNum; id = setId; sid = nSid; invBoneSkinMatrix = Matrix.Identity; } // Bone(setMatrix, setParentBone, setNum)
private void LoadBone(SkinnedBone parentBone, ColladaBone colladaBone) { SkinnedBone bone = new SkinnedBone(); bone.num = skinnedModel.Bones.Count; skinnedModel.Bones.Add(bone); bone.parent = parentBone; if (parentBone != null) { parentBone.children.Add(bone); } bone.initialMatrix = colladaBone.initialMatrix; bone.invBoneSkinMatrix = colladaBone.invBoneSkinMatrix; bone.animationMatrices = colladaBone.animationMatrices; bone.finalMatrix = bone.GetMatrixRecursively(); for (int i = 0; i < colladaBone.children.Count; i++) { LoadBone(bone, colladaBone.children[i]); } }