private void LoadAnimationPoses()
 {
     foreach (var animation in root.LibraryAnimations.Animations)
     {
         string   jointName = animation.Name;
         Matrix[] poses     = ColladaUtils.MatricesFromString(animation.Sources.Single(s => s.Id.EndsWith("-output-transform")).FloatArray);
         animationPosesByJointName[jointName] = poses;
     }
 }
        private void LoadBindPoses()
        {
            //Assumes bind_shape_matrix is Identity

            List <Source> controllerSources = root.ControllerLibrary.Controllers[0].Skin.Sources;

            string[] jointNames = controllerSources.Find(s => s.Id.EndsWith("-Joints")).NameArray
                                  .Split((char[])null, StringSplitOptions.RemoveEmptyEntries);
            Matrix[] inverseBindPoses = ColladaUtils.MatricesFromString(controllerSources.Find(s => s.Id.EndsWith("-Matrices")).FloatArray);

            if (inverseBindPoses.Length != jointNames.Length)
            {
                throw new InvalidOperationException("expected equal number of bind poses and weights");
            }

            for (int i = 0; i < jointNames.Length; ++i)
            {
                Matrix mat = inverseBindPoses[i];
                inverseBindPosesByJointName[jointNames[i]] = mat;
                mat.Invert();
                bindPosesByJointName[jointNames[i]] = mat;
            }
        }