Пример #1
0
        private BonePoseImage[] ReadFrame()
        {
            var boneCount = _meta.BoneCount;
            var ret       = new BonePoseImage[boneCount];

            for (var i = 0; i < boneCount; i++)
            {
                var position      = MmdReaderUtil.ReadVector3(_reader);
                var rotationEular = MmdReaderUtil.ReadVector3(_reader);
                ret[i] = new BonePoseImage
                {
                    Position = position,
                    Rotation = Quaternion.Euler(rotationEular)
                };
            }
            return(ret);
        }
Пример #2
0
        public static BonePoseImage[] GetBonePoseImage(Poser poser)
        {
            var boneCount       = poser.BoneImages.Length;
            var ret             = new BonePoseImage[boneCount];
            var model           = poser.Model;
            var poserBoneImages = poser.BoneImages;

            for (var i = 0; i < boneCount; ++i)
            {
                var poserBoneImage = poserBoneImages[i];
                var position       = poserBoneImage.SkinningMatrix.MultiplyPoint3x4(model.Bones[i].Position);
                var rotation       = poserBoneImage.SkinningMatrix.ExtractRotation();
                ret[i] = new BonePoseImage
                {
                    Position = position,
                    Rotation = rotation
                };
            }
            return(ret);
        }