public void Write(MvdProjectData pd, BinaryWriter bw) { bw.Write(this.FrameTime); if (pd.MinorType >= 1) { bw.Write(this.Gravity); this.GravityVector.ForEach(bw.Write); } bw.Write((int)this.SelfShadowModel); bw.Write(this.SelfShadowDistance); bw.Write(this.SelfShadowDeep); }
public void Write(MvdProjectData pd, BinaryWriter bw) { bw.Write(this.FrameTime); if (pd.MinorType >= 1) { bw.Write(this.Gravity); this.GravityVector.ForEach(bw.Write); } bw.Write((int)this.SelfShadowModel); bw.Write(this.SelfShadowDistance); bw.Write(this.SelfShadowDeep); }
public static MvdProjectFrame Parse(MvdProjectData pd, BinaryReader br) { var rt = new MvdProjectFrame { FrameTime = br.ReadInt64(), }; if (pd.MinorType >= 1) { rt.Gravity = br.ReadSingle(); rt.GravityVector = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), }; } rt.SelfShadowModel = (MvdSelfShadowModel)br.ReadInt32(); rt.SelfShadowDistance = br.ReadSingle(); if (pd.MinorType >= 1 || br.GetRemainingLength() >= 4) rt.SelfShadowDeep = br.ReadSingle(); return rt; }
public static MvdProjectFrame Parse(MvdProjectData pd, BinaryReader br) { var rt = new MvdProjectFrame { FrameTime = br.ReadInt64(), }; if (pd.MinorType >= 1) { rt.Gravity = br.ReadSingle(); rt.GravityVector = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), }; } rt.SelfShadowModel = (MvdSelfShadowModel)br.ReadInt32(); rt.SelfShadowDistance = br.ReadSingle(); if (pd.MinorType >= 1 || br.GetRemainingLength() >= 4) { rt.SelfShadowDeep = br.ReadSingle(); } return(rt); }
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; }
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); }