public static TextureInfo Deserialize(GLTFRoot root, JsonReader reader) { var textureInfo = new TextureInfo(); if (reader.Read() && reader.TokenType != JsonToken.StartObject) { throw new Exception("Asset must be an object."); } while (reader.Read() && reader.TokenType == JsonToken.PropertyName) { var curProp = reader.Value.ToString(); switch (curProp) { case INDEX: textureInfo.Index = TextureId.Deserialize(root, reader); break; case TEXCOORD: textureInfo.TexCoord = reader.ReadAsInt32().Value; break; default: textureInfo.DefaultPropertyDeserializer(root, reader); break; } } return(textureInfo); }
public static TextureInfo Deserialize(GLTFRoot root, JProperty jProperty) { var textureInfo = new TextureInfo(); foreach (JToken child in jProperty.Children()) { if (child is JProperty) { JProperty childAsJProperty = child as JProperty; switch (childAsJProperty.Name) { case "index": textureInfo.Index = TextureId.Deserialize(root, childAsJProperty); break; case "texCoord": textureInfo.TexCoord = (int)childAsJProperty.Value; break; default: // todo: implement //textureInfo.DefaultPropertyDeserializer(root, childAsJProperty); break; } } } return(textureInfo); }
public TextureInfo(TextureInfo textureInfo, GLTFRoot gltfRoot) : base(textureInfo) { if (textureInfo == null) { return; } Index = new TextureId(textureInfo.Index, gltfRoot); TexCoord = textureInfo.TexCoord; }
public TextureId(TextureId id, GLTFRoot newRoot) : base(id, newRoot) { }