public NMSVertex(BinaryReader handle, NMSSectionStreamDescriptor desc) { _data = new List <float[]>(); foreach (var att in desc.Attributes) { switch (att.DataType) { case 0x140b: _data.Add(ReadCompressedFloats(handle, 4)); break; case 0x1401: _data.Add(ReadCompressedFloats(handle, 2)); break; } } }
private List <NMSVertex> ReadVertices(BinaryReader handle, int SecId, NMSSectionStreamDescriptor StreamDesc) { var array = new List <NMSVertex>(); var meta = SecHeader.HeaderOffsetSections[SecId]; handle.BaseStream.Position = meta.AbsOffset; long maxPos = meta.AbsOffset + meta.Count; array = new List <NMSVertex>(); while (handle.BaseStream.Position < maxPos) { array.Add(new NMSVertex(handle, StreamDesc)); } return(array); }
public void Read(BinaryReader handle) { ReadHeader(handle); SecData4 = ReadSection <NMSSectionUintList>(4, handle); SecVtxPartsStart = ReadSection <NMSSectionUintList>(5, handle); SecVtxPartsEnd = ReadSection <NMSSectionUintList>(6, handle); SecData7 = ReadSection <NMSSectionUintList>(7, handle); SecData8 = ReadSection <NMSSectionQuatList>(8, handle); SecData9 = ReadSection <NMSSectionQuatList>(9, handle); VertexStreamDesc1 = ReadSection <NMSSectionStreamDescriptor>(11, handle); VertexStreamDesc2 = ReadSection <NMSSectionStreamDescriptor>(13, handle); ReadIndices(handle); Vertices1 = ReadVertices(handle, 15, VertexStreamDesc1); Vertices2 = ReadVertices(handle, 16, VertexStreamDesc2); }