Exemplo n.º 1
0
        public JNT1(Assimp.Scene scene, VTX1 vertexData)
        {
            BoneNameIndices = new Dictionary <string, int>();
            FlatSkeleton    = new List <Rigging.Bone>();
            Assimp.Node root = null;

            for (int i = 0; i < scene.RootNode.ChildCount; i++)
            {
                if (scene.RootNode.Children[i].Name.ToLowerInvariant() == "skeleton_root")
                {
                    root = scene.RootNode.Children[i].Children[0];
                    break;
                }
            }

            if (root == null)
            {
                SkeletonRoot = new Rigging.Bone("root");
                SkeletonRoot.Bounds.GetBoundsValues(vertexData.Attributes.Positions);

                FlatSkeleton.Add(SkeletonRoot);
                BoneNameIndices.Add("root", 0);
            }

            else
            {
                SkeletonRoot = AssimpNodesToBonesRecursive(root, null, FlatSkeleton);

                foreach (Rigging.Bone bone in FlatSkeleton)
                {
                    BoneNameIndices.Add(bone.Name, FlatSkeleton.IndexOf(bone));
                }
            }
        }
Exemplo n.º 2
0
 public void UpdateBoundingBoxes(VTX1 vertexData)
 {
     FlatSkeleton[0].Bounds.GetBoundsValues(vertexData.Attributes.Positions);
     for (int i = 1; i < FlatSkeleton.Count; i++)
     {
         FlatSkeleton[i].Bounds = FlatSkeleton[0].Bounds;
     }
 }