示例#1
0
 protected override void ReadItem(MvdDocument document, BinaryReader br)
 {
     this.Frames.Add(MvdCameraFrame.Parse(br));
 }
示例#2
0
        public static MvdCameraFrame Parse(MvdCameraData cd, BinaryReader br, out MvdCameraPropertyFrame propertyFrame)
        {
            var rt = new MvdCameraFrame
            {
                StageId = br.ReadInt32(),
                FrameTime = br.ReadInt64(),
                Radius = br.ReadSingle(),
                Position = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
                Angle = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
                Fov = br.ReadSingle(),
            };

            propertyFrame = null;

            switch (cd.MinorType)
            {
                case 0:
                    propertyFrame = new MvdCameraPropertyFrame
                    {
                        FrameTime = rt.FrameTime,
                        Perspective = br.ReadBoolean(),
                    };

                    break;
                case 1:
                    propertyFrame = new MvdCameraPropertyFrame
                    {
                        FrameTime = rt.FrameTime,
                        Enabled = br.ReadBoolean(),
                        Perspective = br.ReadBoolean(),
                        Alpha = br.ReadSingle(),
                        EffectEnabled = br.ReadBoolean(),
                    };

                    break;
                case 3:
                    rt.Spline = br.ReadBoolean();
                    br.ReadBytes(3);

                    break;
            }

            rt.PositionInterpolation = new[] { MvdInterpolationPoint.Parse(br), MvdInterpolationPoint.Parse(br) };
            rt.AngleInterpolation = new[] { MvdInterpolationPoint.Parse(br), MvdInterpolationPoint.Parse(br) };
            rt.RadiusInterpolation = new[] { MvdInterpolationPoint.Parse(br), MvdInterpolationPoint.Parse(br) };
            rt.FovInterpolation = new[] { MvdInterpolationPoint.Parse(br), MvdInterpolationPoint.Parse(br) };

            return rt;
        }