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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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();
 }
Exemplo n.º 6
0
        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();
        }