Esempio n. 1
0
        public static List <glTF_VCI_Material> Parse(ListTreeNode <JsonValue> json)
        {
            var materials = json.DeserializeList <glTF_VCI_Material>();
            var jsonItems = json.ArrayItems().ToArray();

            for (var i = 0; i < materials.Count; ++i)
            {
                materials[i].floatProperties =
                    jsonItems[i][s_floatProperties].ObjectItems()
                    .ToDictionary(x => x.Key.GetString(), x => x.Value.GetSingle());
                materials[i].vectorProperties =
                    jsonItems[i][s_vectorProperties].ObjectItems().ToDictionary(x => x.Key.GetString(),
                                                                                x => { return(x.Value.ArrayItems().Select(y => y.GetSingle()).ToArray()); });
                materials[i].keywordMap =
                    jsonItems[i][s_keywordMap].ObjectItems()
                    .ToDictionary(x => x.Key.GetString(), x => x.Value.GetBoolean());
                materials[i].tagMap =
                    jsonItems[i][s_tagMap].ObjectItems().ToDictionary(x => x.Key.GetString(), x => x.Value.GetString());
                materials[i].textureProperties =
                    jsonItems[i][s_textureProperties].ObjectItems()
                    .ToDictionary(x => x.Key.GetString(), x => x.Value.GetInt32());
            }

            return(materials);
        }