Exemple #1
0
        public static MvdSection Parse(MvdDocument document, 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.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.Light:
                    rt = new MvdLightData();

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

                    break;
                case MvdTag.Eof:
                    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, exr);

            rt.Read(document, br);

            return rt;
        }
Exemple #2
0
        public void Write(MvdModelPropertyData mpd, BinaryWriter bw)
        {
            bw.Write(this.FrameTime);
            bw.Write(this.Visible);
            bw.Write(this.Shadow);
            bw.Write(this.AddBlending);
            bw.Write(this.Physics);

            if (mpd.MinorType >= 1)
            {
                bw.Write(this.PhysicsStillMode);
                bw.Write(new byte[3]);                          // reserved[3]
            }

            bw.Write(this.EdgeWidth);
            this.EdgeColor.ForEach(bw.Write);
            this.IKEnabled.ForEach(bw.Write);
        }
        public static MvdModelPropertyFrame Parse(MvdModelPropertyData mpd, BinaryReader br)
        {
            var rt = new MvdModelPropertyFrame
            {
                FrameTime = br.ReadInt64(),
                Visible = br.ReadBoolean(),
                Shadow = br.ReadBoolean(),
                AddBlending = br.ReadBoolean(),
                Physics = br.ReadBoolean(),
            };

            if (mpd.MinorType >= 1)
            {
                rt.PhysicsStillMode = br.ReadBoolean();
                br.ReadBytes(3);		// reserved[3]
            }

            rt.EdgeWidth = br.ReadSingle();
            rt.EdgeColor = new[] { br.ReadByte(), br.ReadByte(), br.ReadByte(), br.ReadByte() };
            rt.IKEnabled = Enumerable.Range(0, mpd.IKBones.Length).Select(_ => br.ReadBoolean()).ToArray();

            return rt;
        }
Exemple #4
0
        public static MvdModelPropertyFrame Parse(MvdModelPropertyData mpd, BinaryReader br)
        {
            var rt = new MvdModelPropertyFrame
            {
                FrameTime   = br.ReadInt64(),
                Visible     = br.ReadBoolean(),
                Shadow      = br.ReadBoolean(),
                AddBlending = br.ReadBoolean(),
                Physics     = br.ReadBoolean(),
            };

            if (mpd.MinorType >= 1)
            {
                rt.PhysicsStillMode = br.ReadBoolean();
                br.ReadBytes(3);                                // reserved[3]
            }

            rt.EdgeWidth = br.ReadSingle();
            rt.EdgeColor = new[] { br.ReadByte(), br.ReadByte(), br.ReadByte(), br.ReadByte() };
            rt.IKEnabled = Enumerable.Range(0, mpd.IKBones.Length).Select(_ => br.ReadBoolean()).ToArray();

            return(rt);
        }
        public void Write(MvdModelPropertyData mpd, BinaryWriter bw)
        {
            bw.Write(this.FrameTime);
            bw.Write(this.Visible);
            bw.Write(this.Shadow);
            bw.Write(this.AddBlending);
            bw.Write(this.Physics);

            if (mpd.MinorType >= 1)
            {
                bw.Write(this.PhysicsStillMode);
                bw.Write(new byte[3]);		// reserved[3]
            }

            bw.Write(this.EdgeWidth);
            this.EdgeColor.ForEach(bw.Write);
            this.IKEnabled.ForEach(bw.Write);
        }
Exemple #6
0
        public static MvdSection Parse(MvdDocument document, 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.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.Light:
                rt = new MvdLightData();

                break;

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

                break;

            case MvdTag.Eof:
                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, exr);

            rt.Read(document, br);

            return(rt);
        }