Example #1
0
        public static ShadingShiftTextureInfo Deserialize_ShadingShiftTexture(JsonNode parsed)
        {
            var value = new ShadingShiftTextureInfo();

            foreach (var kv in parsed.ObjectItems())
            {
                var key = kv.Key.GetString();

                if (key == "extensions")
                {
                    value.Extensions = new glTFExtensionImport(kv.Value);
                    continue;
                }

                if (key == "extras")
                {
                    value.Extras = new glTFExtensionImport(kv.Value);
                    continue;
                }

                if (key == "index")
                {
                    value.Index = kv.Value.GetInt32();
                    continue;
                }

                if (key == "texCoord")
                {
                    value.TexCoord = kv.Value.GetInt32();
                    continue;
                }

                if (key == "scale")
                {
                    value.Scale = kv.Value.GetSingle();
                    continue;
                }
            }
            return(value);
        }
Example #2
0
        public static void Serialize_ShadingShiftTexture(JsonFormatter f, ShadingShiftTextureInfo value)
        {
            f.BeginMap();


            if (value.Extensions != null)
            {
                f.Key("extensions");
                (value.Extensions as glTFExtension).Serialize(f);
            }

            if (value.Extras != null)
            {
                f.Key("extras");
                (value.Extras as glTFExtension).Serialize(f);
            }

            if (value.Index.HasValue)
            {
                f.Key("index");
                f.Value(value.Index.GetValueOrDefault());
            }

            if (value.TexCoord.HasValue)
            {
                f.Key("texCoord");
                f.Value(value.TexCoord.GetValueOrDefault());
            }

            if (value.Scale.HasValue)
            {
                f.Key("scale");
                f.Value(value.Scale.GetValueOrDefault());
            }

            f.EndMap();
        }