示例#1
0
        public BoneAnimationClip(float framesPerSecond, ushort totalFrames, KeyframeEnding preferedEnding = KeyframeEnding.Clamp,
                                 List <List <IVectorKey> > translationKeys = null, List <List <IQuaternionKey> > rotationKeys = null, List <List <IVectorKey> > scaleKeys = null)
        {
            _framesPerSecond = framesPerSecond;
            _totalFrames     = totalFrames;
            _preferedEnding  = preferedEnding;

            if (translationKeys == null)
            {
                _translationKeys = new List <List <IVectorKey> >();
            }
            else
            {
                _translationKeys = translationKeys;
            }

            if (rotationKeys == null)
            {
                _rotationKeys = new List <List <IQuaternionKey> >();
            }
            else
            {
                _rotationKeys = rotationKeys;
            }

            if (scaleKeys == null)
            {
                _scaleKeys = new List <List <IVectorKey> >();
            }
            else
            {
                _scaleKeys = scaleKeys;
            }
        }
 public BoneAnimationController(BoneAnimationClip animationClip)
 {
     AnimationClip   = animationClip;
     FramesPerSecond = animationClip.FramesPerSecond;
     _ending         = animationClip.PreferedEnding;
     UpdateDuration();
 }
示例#3
0
        public override object Read(ContentReader reader)
        {
            string                        name           = reader.ReadString();
            float                         fps            = (float)reader.ReadUInt32();
            ushort                        totalFrames    = (ushort)reader.ReadUInt32();
            KeyframeEnding                preferedEnding = reader.ReadEnum <KeyframeEnding>();
            int                           boneCount      = (int)reader.ReadUInt32();
            List <List <IVectorKey> >     translations   = new List <List <IVectorKey> >(boneCount);
            List <List <IQuaternionKey> > rotations      = new List <List <IQuaternionKey> >(boneCount);
            List <List <IVectorKey> >     scales         = new List <List <IVectorKey> >(boneCount);

            for (int i = 0; i < boneCount; i++)
            {
                translations.Add(reader.ReadObjectRaw <List <VectorKey> >().Cast <IVectorKey>().ToList());
            }
            for (int i = 0; i < boneCount; i++)
            {
                rotations.Add(reader.ReadObjectRaw <List <QuaternionKey> >().Cast <IQuaternionKey>().ToList());
            }
            for (int i = 0; i < boneCount; i++)
            {
                scales.Add(reader.ReadObjectRaw <List <VectorKey> >().Cast <IVectorKey>().ToList());
            }

            return(new BoneAnimationClip(fps, totalFrames, preferedEnding, translations, rotations, scales)
            {
                Name = name
            });
        }