IEnumerator BuildHierarchy() { using (MeasureTime("BuildHierarchy")) { var nodes = new List <NodeImporter.TransformWithSkin>(); for (int i = 0; i < Nodes.Count; ++i) { nodes.Add(NodeImporter.BuildHierarchy(this, i)); } NodeImporter.FixCoordinate(this, nodes); // skinning for (int i = 0; i < nodes.Count; ++i) { NodeImporter.SetupSkinning(this, nodes, i); } // connect root if (Root == null) { Root = new GameObject("_root_"); } foreach (var x in GLTF.rootnodes) { var t = nodes[x].Transform; t.SetParent(Root.transform, false); } } yield return(null); }
IEnumerator LoadNodes() { using (MeasureTime("LoadNodes")) { for (int i = 0; i < GLTF.nodes.Count; i++) { Nodes.Add(NodeImporter.ImportNode(GLTF.nodes[i], i).transform); } } yield return(null); }