Example #1
0
        public static VmdCameraFrame Parse(BinaryReader br, VmdVersion version)
        {
            var rt = new VmdCameraFrame
            {
                FrameTime = br.ReadUInt32(),
                Radius    = br.ReadSingle(),
                Position  = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
                Angle     = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
            };

            if (version == VmdVersion.MMDVer3)
            {
                rt.XInterpolation      = ReadInterpolationPair(br);
                rt.YInterpolation      = ReadInterpolationPair(br);
                rt.ZInterpolation      = ReadInterpolationPair(br);
                rt.AngleInterpolation  = ReadInterpolationPair(br);
                rt.RadiusInterpolation = ReadInterpolationPair(br);
                rt.FovInterpolation    = ReadInterpolationPair(br);
                rt.FovInDegree         = br.ReadInt32();
                rt.Ortho = br.ReadBoolean();
            }
            else
            {
                rt.AngleInterpolation = ReadInterpolationPair(br);
            }

            return(rt);
        }
Example #2
0
        static IEnumerable <VmdCameraFrame> ReadCameraFrames(BinaryReader br, VmdVersion version)
        {
            var count = br.ReadUInt32();

            for (uint i = 0; i < count; i++)
            {
                yield return(VmdCameraFrame.Parse(br, version));
            }
        }
Example #3
0
        public static VmdCameraFrame Parse(BinaryReader br, VmdVersion version)
        {
            var rt = new VmdCameraFrame
            {
                FrameTime = br.ReadUInt32(),
                Radius = br.ReadSingle(),
                Position = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
                Angle = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
            };

            if (version == VmdVersion.MMDVer3)
            {
                rt.XInterpolation = ReadInterpolationPair(br);
                rt.YInterpolation = ReadInterpolationPair(br);
                rt.ZInterpolation = ReadInterpolationPair(br);
                rt.AngleInterpolation = ReadInterpolationPair(br);
                rt.RadiusInterpolation = ReadInterpolationPair(br);
                rt.FovInterpolation = ReadInterpolationPair(br);
                rt.FovInDegree = br.ReadInt32();
                rt.Ortho = br.ReadBoolean();
            }
            else
                rt.AngleInterpolation = ReadInterpolationPair(br);

            return rt;
        }