Ejemplo n.º 1
0
        public static MvdEffectParameterData Parse(MvdEffectPropertyData epd, int index, BinaryReader br)
        {
            switch (epd.Parameters[index].Type)
            {
            case MvdEffectParameterType.Boolean:
                return(new MvdEffectParameterData(br.ReadBoolean()));

            case MvdEffectParameterType.Integer:
                return(new MvdEffectParameterData(br.ReadInt32()));

            case MvdEffectParameterType.Single:
                return(new MvdEffectParameterData(br.ReadSingle()));

            case MvdEffectParameterType.Single2:
                return(new MvdEffectParameterData(br.ReadSingle(), br.ReadSingle()));

            case MvdEffectParameterType.Single3:
                return(new MvdEffectParameterData(br.ReadSingle(), br.ReadSingle(), br.ReadSingle()));

            case MvdEffectParameterType.Single4:
                return(new MvdEffectParameterData(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle()));

            default:
                throw new NotSupportedException();
            }
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
 public static MvdEffectPropertyFrame Parse(MvdEffectPropertyData epd, BinaryReader br)
 {
     return new MvdEffectPropertyFrame
     {
         FrameTime = br.ReadInt64(),
         Visible = br.ReadBoolean(),
         Shadow = br.ReadBoolean(),
         AddBlending = br.ReadBoolean(),
         Reserved = br.ReadBoolean(),
         Scaling = br.ReadSingle(),
         Alpha = br.ReadSingle(),
         RelatedModelId = br.ReadInt32(),
         RelatedBoneId = br.ReadInt32(),
         Parameters = Enumerable.Range(0, epd.Parameters.Count).Select(_ => MvdEffectParameterData.Parse(epd, _, br)).ToArray(),
     };
 }
Ejemplo n.º 4
0
 public static MvdEffectPropertyFrame Parse(MvdEffectPropertyData epd, BinaryReader br)
 {
     return(new MvdEffectPropertyFrame
     {
         FrameTime = br.ReadInt64(),
         Visible = br.ReadBoolean(),
         Shadow = br.ReadBoolean(),
         AddBlending = br.ReadBoolean(),
         Reserved = br.ReadBoolean(),
         Scaling = br.ReadSingle(),
         Alpha = br.ReadSingle(),
         RelatedModelId = br.ReadInt32(),
         RelatedBoneId = br.ReadInt32(),
         Parameters = Enumerable.Range(0, epd.Parameters.Count).Select(_ => MvdEffectParameterData.Parse(epd, _, br)).ToArray(),
     });
 }
Ejemplo n.º 5
0
 public static MvdEffectParameterData Parse(MvdEffectPropertyData epd, int index, BinaryReader br)
 {
     switch (epd.Parameters[index].Type)
     {
         case MvdEffectParameterType.Boolean:
             return new MvdEffectParameterData(br.ReadBoolean());
         case MvdEffectParameterType.Integer:
             return new MvdEffectParameterData(br.ReadInt32());
         case MvdEffectParameterType.Single:
             return new MvdEffectParameterData(br.ReadSingle());
         case MvdEffectParameterType.Single2:
             return new MvdEffectParameterData(br.ReadSingle(), br.ReadSingle());
         case MvdEffectParameterType.Single3:
             return new MvdEffectParameterData(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
         case MvdEffectParameterType.Single4:
             return new MvdEffectParameterData(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
         default:
             throw new NotSupportedException();
     }
 }
Ejemplo n.º 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);
        }