Ejemplo n.º 1
0
        void Add <T>(ref List <KeyFrame <T> > target, AssetSource source, UniGLTF.glTFAnimationSampler sampler) where T : struct
        {
            var interpolation = ParseInterpolation(sampler.interpolation);
            var input         = source.GLTF.GetArrayFromAccessor <float>(source.IO, sampler.input);
            var output        = source.GLTF.GetArrayFromAccessor <T>(source.IO, sampler.output);

            target = new List <KeyFrame <T> >(input.Length);
            for (int i = 0; i < input.Length; ++i)
            {
                LastSeconds = Math.Max(LastSeconds, input[i]);
                target.Add(new KeyFrame <T>(input[i], output[i]));
            }
        }
Ejemplo n.º 2
0
        public void Add(AnimationTarget target, AssetSource source, UniGLTF.glTFAnimationSampler sampler)
        {
            switch (target)
            {
            case AnimationTarget.Translation:
                Add(ref Translation, source, sampler);
                break;

            case AnimationTarget.Rotation:
                Add(ref Rotation, source, sampler);
                break;

            case AnimationTarget.Scale:
                Add(ref Scale, source, sampler);
                break;

            default:
                throw new NotImplementedException();
            }
        }