コード例 #1
0
        public static GLTFAnimationChannelTarget Deserialize(GLTFRoot root, JsonReader reader)
        {
            var animationChannelTarget = new GLTFAnimationChannelTarget();

            if (reader.Read() && reader.TokenType != JsonToken.StartObject)
            {
                throw new Exception("Animation channel target must be an object.");
            }

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

                switch (curProp)
                {
                case "node":
                    animationChannelTarget.Node = GLTFNodeId.Deserialize(root, reader);
                    break;

                case "path":
                    animationChannelTarget.Path = reader.ReadStringEnum <GLTFAnimationChannelPath>();
                    break;

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

            return(animationChannelTarget);
        }
コード例 #2
0
        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);
        }