Exemple #1
0
        public static AnimationChannel Deserialize(GLTFRoot root, JsonReader reader)
        {
            var animationChannel = new AnimationChannel();

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

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

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

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

            return(animationChannel);
        }
Exemple #2
0
        public static AnimationChannelTarget Deserialize(GLTFRoot root, JsonReader reader)
        {
            var animationChannelTarget = new AnimationChannelTarget();

            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 = NodeId.Deserialize(root, reader);
                    break;

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

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

            return(animationChannelTarget);
        }
Exemple #3
0
        public AnimationChannelTarget(AnimationChannelTarget channelTarget, GLTFRoot gltfRoot) : base(channelTarget)
        {
            if (channelTarget == null)
            {
                return;
            }

            Node = new NodeId(channelTarget.Node, gltfRoot);
            Path = channelTarget.Path;
        }
Exemple #4
0
        public AnimationChannel(AnimationChannel animationChannel, GLTFRoot root) : base(animationChannel)
        {
            if (animationChannel == null)
            {
                return;
            }

            Sampler = new SamplerId(animationChannel.Sampler, root);
            Target  = new AnimationChannelTarget(animationChannel.Target, root);
        }