public VRTF(int APIversion, EventHandler handler, uint version, int stride, VertexElementLayoutList layouts, bool extendedFormat) : base(APIversion, handler, null) { mExtendedFormat = extendedFormat; mLayouts = layouts == null ? null : new VertexElementLayoutList(handler, layouts); mStride = stride; mVersion = version; }
protected override void Parse(Stream s) { BinaryReader br = new BinaryReader(s); string tag = FOURCC(br.ReadUInt32()); if (checking && tag != Tag) { throw new InvalidDataException(string.Format("Invalid Tag read: '{0}'; expected: '{1}'; at 0x{2:X8}", tag, Tag, s.Position)); } mVersion = br.ReadUInt32(); mStride = br.ReadInt32(); int count = br.ReadInt32(); mExtendedFormat = br.ReadUInt32() > 0 ? true : false; mLayouts = new VertexElementLayoutList(handler, s, count); }
public override Stream UnParse() { if (mLayouts == null) { mLayouts = new VertexElementLayoutList(handler); } MemoryStream s = new MemoryStream(); BinaryWriter bw = new BinaryWriter(s); bw.Write((uint)FOURCC(Tag)); bw.Write(mVersion); bw.Write(mStride); bw.Write(mLayouts.Count); bw.Write(mExtendedFormat?1:0); mLayouts.UnParse(s); return(s); }