Exemplo n.º 1
0
        public static List <glTF_VRM_Material> Parse(JsonNode json)
        {
            var materials = json.DeserializeList <glTF_VRM_Material>();
            var jsonItems = json.ArrayItems.ToArray();

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