public RenderBatch(byte[] inData) { using (MemoryStream ms = new MemoryStream(inData)) { using (BinaryReader br = new BinaryReader(ms)) { BoundingBox = br.ReadShortBox(); FirstPolygonIndex = br.ReadUInt32(); PolygonIndexCount = br.ReadUInt16(); FirstVertexIndex = br.ReadUInt16(); LastVertexIndex = br.ReadUInt16(); UnknownFlags = br.ReadByte(); MaterialIndex = br.ReadByte(); } } }
/// <summary> /// Writes a 12-byte <see cref="ShortBox"/> to the data stream. /// </summary> /// <param name="binaryWriter">The current <see cref="BinaryWriter"/> object.</param> /// <param name="box">In box.</param> public static void WriteShortBox(this BinaryWriter binaryWriter, ShortBox box) { binaryWriter.WriteVector3s(box.BottomCorner); binaryWriter.WriteVector3s(box.TopCorner); }