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

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

                    break;

                case "Diffuse":
                    rt.Diffuse = i.Values.Select(float.Parse).ToArray();

                    break;

                case "Ambient":
                    rt.Ambient = i.Values.Select(float.Parse).ToArray();

                    break;

                case "Emissive":
                    rt.Emissive = i.Values.Select(float.Parse).ToArray();

                    break;

                case "Specular":
                    rt.Specular = i.Values.Select(float.Parse).ToArray();

                    break;

                case "SpecularSharpness":
                    rt.SpecularSharpness = float.Parse(i.Values.First());

                    break;

                case "TextureFilename":
                    rt.TextureFilename = i.Values.First().Trim('"');

                    break;
                }
            }

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

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

                        break;
                    case "Diffuse":
                        rt.Diffuse = i.Values.Select(float.Parse).ToArray();

                        break;
                    case "Ambient":
                        rt.Ambient = i.Values.Select(float.Parse).ToArray();

                        break;
                    case "Emissive":
                        rt.Emissive = i.Values.Select(float.Parse).ToArray();

                        break;
                    case "Specular":
                        rt.Specular = i.Values.Select(float.Parse).ToArray();

                        break;
                    case "SpecularSharpness":
                        rt.SpecularSharpness = float.Parse(i.Values.First());

                        break;
                    case "TextureFilename":
                        rt.TextureFilename = i.Values.First().Trim('"');

                        break;
                }

            return rt;
        }