public MeshSplitPart( MeshSplitter splitter, GeometryContent geom, int vertexStartIndex) { this.index = vertexStartIndex; this.splitter = splitter; this.oldToNewDict = new SortedDictionary <int, int>(); this.vertexStartIndex = vertexStartIndex; this.vertexEndIndex = vertexStartIndex; this.geom = geom; GetWeightChannel(); }
private void ProcessMesh(MeshContent mesh) { if (MeshSplitter.NeedsSplitting(mesh, maxBones)) { modelModified = true; MeshSplitter splitter = new MeshSplitter(mesh, maxBones); List <MeshContent> meshes = splitter.Split(); foreach (MeshContent m in meshes) { MeshHelper.MergeDuplicatePositions(m, 0); MeshHelper.MergeDuplicateVertices(m); MeshHelper.OptimizeForCache(m); } MeshContent firstMesh = meshes[0]; NodeContent parent = mesh.Parent; List <NodeContent> children = new List <NodeContent>(); foreach (NodeContent child in mesh.Children) { children.Add(child); } foreach (NodeContent child in children) { mesh.Children.Remove(child); } parent.Children.Remove(mesh); foreach (MeshContent m in meshes) { parent.Children.Add(m); } foreach (NodeContent child in children) { firstMesh.Children.Add(child); } foreach (NodeContent child in firstMesh.Children) { ProcessNode(child); } } }