LSLib.Granny.Model.Bone.FromCollada C# (CSharp) Méthode

FromCollada() public static méthode

public static FromCollada ( node bone, int parentIndex, List bones, Bone>.Dictionary boneSIDs, Bone>.Dictionary boneIDs ) : Bone
bone Collada141.node
parentIndex int
bones List
boneSIDs Bone>.Dictionary
boneIDs Bone>.Dictionary
Résultat Bone
        public static Bone FromCollada(node bone, int parentIndex, List<Bone> bones, Dictionary<string, Bone> boneSIDs, Dictionary<string, Bone> boneIDs)
        {
            var transMat = ColladaHelpers.TransformFromNode(bone);
            var colladaBone = new Bone();
            colladaBone.TransformSID = transMat.TransformSID;
            var myIndex = bones.Count;
            bones.Add(colladaBone);
            boneSIDs.Add(bone.sid, colladaBone);
            if (bone.id != null)
            {
                boneIDs.Add(bone.id, colladaBone);
            }

            colladaBone.ParentIndex = parentIndex;
            colladaBone.Name = bone.name;
            colladaBone.LODError = 0; // TODO
            colladaBone.Transform = transMat.transform;
            colladaBone.UpdateInverseWorldTransform(bones);

            if (bone.node1 != null)
            {
                foreach (var node in bone.node1)
                {
                    if (node.type == NodeType.JOINT)
                    {
                        FromCollada(node, myIndex, bones, boneSIDs, boneIDs);
                    }
                }
            }

            return colladaBone;
        }

Usage Example

Exemple #1
0
        public static Skeleton FromCollada(node root)
        {
            var skeleton = new Skeleton();

            skeleton.Bones      = new List <Bone>();
            skeleton.LODType    = 0;
            skeleton.Name       = root.name;
            skeleton.BonesBySID = new Dictionary <string, Bone>();
            skeleton.BonesByID  = new Dictionary <string, Bone>();
            Bone.FromCollada(root, -1, skeleton.Bones, skeleton.BonesBySID, skeleton.BonesByID);
            return(skeleton);
        }