public static string ToJson(this glTFMaterialBaseColorTextureInfo self) { var f = new JsonFormatter(); GltfSerializer.Serialize_gltf_materials__pbrMetallicRoughness_baseColorTexture(f, self); return(f.ToString()); }
public void TextureInfoTest() { var model = new glTFMaterialBaseColorTextureInfo() { index = 1, }; var json = model.ToJson(); Assert.AreEqual(@"{""index"":1,""texCoord"":0}", json); Debug.Log(json); }
public void TextureInfoTestError() { var model = new glTFMaterialBaseColorTextureInfo(); var c = new JsonSchemaValidationContext("") { EnableDiagnosisForNotRequiredFields = true, }; var ex = Assert.Throws <JsonSchemaValidationException>( () => JsonSchema.FromType <glTFMaterialBaseColorTextureInfo>().Serialize(model, c) ); Assert.AreEqual("[index.String] minimum: ! -1>=0", ex.Message); }
public void TextureInfoTest() { var model = new glTFMaterialBaseColorTextureInfo() { index = 1, }; var json = model.ToJson(); Assert.AreEqual(@"{""index"":1,""texCoord"":0}", json); Debug.Log(json); var c = new JsonSchemaValidationContext("") { EnableDiagnosisForNotRequiredFields = true, }; var json2 = JsonSchema.FromType <glTFMaterialBaseColorTextureInfo>().Serialize(model, c); Assert.AreEqual(json, json2); }
public void TextureInfoTestError() { var model = new glTFMaterialBaseColorTextureInfo(); }
public static void Serialize_gltf_materials__pbrMetallicRoughness_baseColorTexture(JsonFormatter f, glTFMaterialBaseColorTextureInfo value) { f.BeginMap(); if (value.index >= 0) { f.Key("index"); f.Value(value.index); } if (value.texCoord >= 0) { f.Key("texCoord"); f.Value(value.texCoord); } if (value.extensions != null) { f.Key("extensions"); value.extensions.Serialize(f); } if (value.extras != null) { f.Key("extras"); value.extras.Serialize(f); } f.EndMap(); }