void SetupBoneMatrices(CustomMeshContainer meshContainer)
        {
            if (meshContainer.SkinInfo == null)
            {
                return;
            }

            meshContainer.BoneMatricesLookup = new CustomFrame[meshContainer.SkinInfo.BoneCount];
            for (int i = 0; i < meshContainer.SkinInfo.BoneCount; i++)
            {
                CustomFrame frame = (CustomFrame)RootFrame.FindChild(meshContainer.SkinInfo.GetBoneName(i));
                meshContainer.BoneMatricesLookup[i] = frame;
            }
        }
        void ForEachFrame(Frame frame, Action <CustomFrame> action)
        {
            CustomFrame cframe = frame as CustomFrame;

            action(cframe);

            if (cframe.Sibling != null)
            {
                ForEachFrame(cframe.Sibling, action);
            }

            if (cframe.FirstChild != null)
            {
                ForEachFrame(cframe.FirstChild, action);
            }
        }
        public void UpdateFrameMatrices(Frame frame, Matrix matrix)
        {
            CustomFrame cframe = frame as CustomFrame;

            cframe.CombinedTransform = cframe.TransformationMatrix * matrix;

            if (cframe.Sibling != null)
            {
                UpdateFrameMatrices(cframe.Sibling, matrix);
            }

            if (cframe.FirstChild != null)
            {
                UpdateFrameMatrices(cframe.FirstChild, cframe.CombinedTransform);
            }
        }