Пример #1
0
        public static GLTFAnimation Deserialize(GLTFRoot root, JsonReader reader)
        {
            var animation = new GLTFAnimation();

            while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
            {
                var curProp = reader.Value.ToString();

                switch (curProp)
                {
                case "channels":
                    animation.Channels = reader.ReadList(() => GLTFAnimationChannel.Deserialize(root, reader));
                    break;

                case "samplers":
                    animation.Samplers = reader.ReadList(() => GLTFAnimationSampler.Deserialize(root, reader));
                    break;

                default:
                    animation.DefaultPropertyDeserializer(root, reader);
                    break;
                }
            }

            return(animation);
        }
        public static GLTFAnimationChannel Deserialize(GLTFRoot root, JsonReader reader)
        {
            var animationChannel = new GLTFAnimationChannel();

            while (reader.Read() && reader.TokenType == JsonToken.PropertyName)
            {
                var curProp = reader.Value.ToString();

                switch (curProp)
                {
                case "sampler":
                    animationChannel.Sampler = GLTFSamplerId.Deserialize(root, reader);
                    break;

                case "target":
                    animationChannel.Target = GLTFAnimationChannelTarget.Deserialize(root, reader);
                    break;

                default:
                    animationChannel.DefaultPropertyDeserializer(root, reader);
                    break;
                }
            }

            return(animationChannel);
        }