Example #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 GLTFAnimationSampler Deserialize(GLTFRoot root, JsonReader reader)
        {
            var animationSampler = new GLTFAnimationSampler();

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

                switch (curProp)
                {
                case "input":
                    animationSampler.Input = GLTFAccessorId.Deserialize(root, reader);
                    break;

                case "interpolation":
                    animationSampler.Interpolation = reader.ReadStringEnum <GLTFInterpolationType>();
                    break;

                case "output":
                    animationSampler.Output = GLTFAccessorId.Deserialize(root, reader);
                    break;

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

            return(animationSampler);
        }