Пример #1
0
            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();
            }
Пример #2
0
            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();
            }
Пример #3
0
        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);
                }
            }
        }
Пример #4
0
        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);
                }
            }
        }