Exemplo n.º 1
0
        protected override void ReadItem(MvdDocument document, MvdObject obj, BinaryReader br)
        {
            MvdCameraPropertyFrame cpf;

            this.Frames.Add(MvdCameraFrame.Parse(this, br, out cpf));

            if (cpf != null)
            {
                var cpd = obj.Sections.OfType<MvdCameraPropertyData>().FirstOrDefault();

                if (cpd == null)
                    obj.Sections.Add(cpd = new MvdCameraPropertyData());

                cpd.Frames.Add(cpf);
            }
        }
Exemplo n.º 2
0
        public static MvdCameraPropertyFrame Parse(MvdCameraPropertyData cpd, BinaryReader br)
        {
            var rt = new MvdCameraPropertyFrame
            {
                FrameTime = br.ReadInt64(),
                Enabled = br.ReadBoolean(),
                Perspective = br.ReadBoolean(),
                Alpha = br.ReadSingle(),
                EffectEnabled = br.ReadBoolean(),
            };

            switch (cpd.MinorType)
            {
                case 0:
                    br.ReadByte();

                    break;
                case 1:
                case 2:
                    rt.DynamicFov = br.ReadBoolean();
                    rt.DynamicFovRate = br.ReadSingle();
                    rt.DynamicFovCoefficent = br.ReadSingle();

                    if (cpd.MinorType == 2)
                    {
                        rt.RelatedModelId = br.ReadInt32();
                        rt.RelatedBoneId = br.ReadInt32();
                    }

                    break;
            }

            return rt;
        }
Exemplo n.º 3
0
        public void Write(MvdCameraPropertyData cpd, BinaryWriter bw)
        {
            bw.Write(this.FrameTime);
            bw.Write(this.Enabled);
            bw.Write(this.Perspective);
            bw.Write(this.Alpha);
            bw.Write(this.EffectEnabled);

            switch (cpd.MinorType)
            {
                case 0:
                    bw.Write(false);

                    break;
                case 1:
                case 2:
                    bw.Write(this.DynamicFov);
                    bw.Write(this.DynamicFovRate);
                    bw.Write(this.DynamicFovCoefficent);

                    if (cpd.MinorType == 2)
                    {
                        bw.Write(this.RelatedModelId);
                        bw.Write(this.RelatedBoneId);
                    }

                    break;
            }
        }
Exemplo n.º 4
0
        public static MvdSection Parse(MvdDocument document, MvdObject obj, BinaryReader br)
        {
            var tag = (MvdTag)br.ReadByte();
            MvdSection rt = null;

            switch (tag)
            {
                case MvdTag.NameList:
                    rt = new MvdNameList();

                    break;
                case MvdTag.Bone:
                    rt = new MvdBoneData();

                    break;
                case MvdTag.Morph:
                    rt = new MvdMorphData();

                    break;
                case MvdTag.MotionClip:
                    rt = new MvdMotionClipData();

                    break;
                case MvdTag.MotionBlend:
                    rt = new MvdMotionBlendLinkData();

                    break;
                case MvdTag.ModelProperty:
                    rt = new MvdModelPropertyData();

                    break;
                case MvdTag.AccessoryProperty:
                    rt = new MvdAccessoryPropertyData();

                    break;
                case MvdTag.EffectProperty:
                    rt = new MvdEffectPropertyData();

                    break;
                case MvdTag.Camera:
                    rt = new MvdCameraData();

                    break;
                case MvdTag.CameraProperty:
                    rt = new MvdCameraPropertyData();

                    break;
                case MvdTag.Light:
                    rt = new MvdLightData();

                    break;
                case MvdTag.Project:
                    rt = new MvdProjectData();

                    break;
                case MvdTag.Filter:
                    rt = new MvdFilterData();

                    break;
                case MvdTag.Eof:
                    br.ReadByte();

                    return null;
            }

            rt.MinorType = br.ReadByte();
            rt.RawKey = br.ReadInt32();
            rt.RawItemSize = br.ReadInt32();
            rt.RawCount = br.ReadInt32();

            using (var exr = br.CreateSizedBufferReader())
                rt.ReadExtensionRegion(document, obj, exr);

            rt.Read(document, obj, br);

            return rt;
        }