Ejemplo n.º 1
0
        public static ElMeshContainer Parse(ElData data)
        {
            var rt = new ElMeshContainer
            {
                baseData = data,
            };

            foreach (var i in data.Children)
            {
                switch (i.Name)
                {
                case "Name":
                    rt.Name = i.Values.First().Trim('"');

                    break;

                case "VertexFormat":
                    rt.VertexFormat = i.Children.Select(_ => Util.ParseEnum <ElVertexFormat>(_.Values.First().Trim('"'))).ToList();

                    break;

                case "BoneNames":
                    rt.BoneNames = i.Children.Select(_ => _.Values.First().Trim('"')).ToList();

                    break;

                case "OffsetMatrices":
                    rt.OffsetMatrices = i.Children.Select(_ => _.Values.Select(float.Parse).ToArray()).ToList();

                    break;

                case "Materials":
                    rt.Materials = i.Children.Where(_ => _.Name == "Material").Select(ElMaterial.Parse).ToList();

                    break;

                case "Mesh":
                    rt.Meshes.Add(ElMesh.Parse(i));

                    break;
                }
            }

            return(rt);
        }
Ejemplo n.º 2
0
        public static ElMeshContainer Parse(ElData data)
        {
            var rt = new ElMeshContainer
            {
                baseData = data,
            };

            foreach (var i in data.Children)
                switch (i.Name)
                {
                    case "Name":
                        rt.Name = i.Values.First().Trim('"');

                        break;
                    case "VertexFormat":
                        rt.VertexFormat = i.Children.Select(_ => Util.ParseEnum<ElVertexFormat>(_.Values.First().Trim('"'))).ToList();

                        break;
                    case "BoneNames":
                        rt.BoneNames = i.Children.Select(_ => _.Values.First().Trim('"')).ToList();

                        break;
                    case "OffsetMatrices":
                        rt.OffsetMatrices = i.Children.Select(_ => _.Values.Select(float.Parse).ToArray()).ToList();

                        break;
                    case "Materials":
                        rt.Materials = i.Children.Where(_ => _.Name == "Material").Select(ElMaterial.Parse).ToList();

                        break;
                    case "Mesh":
                        rt.Meshes.Add(ElMesh.Parse(i));

                        break;
                }

            return rt;
        }