internal static W3dHModelHeader Parse(BinaryReader reader, W3dParseContext context) { return(ParseChunk(reader, context, header => { var result = new W3dHModelHeader { Version = reader.ReadUInt32(), Name = reader.ReadFixedLengthString(W3dConstants.NameLength), HierarchyName = reader.ReadFixedLengthString(W3dConstants.NameLength), ConnectionsCount = reader.ReadUInt16(), UnknownBytes = reader.ReadBytes((int)context.CurrentEndPosition - (int)reader.BaseStream.Position) }; // TODO: Determine W3dHModelHeader UnknownBytes return result; })); }
internal static W3dHModel Parse(BinaryReader reader, W3dParseContext context) { return(ParseChunk(reader, context, header => { var result = new W3dHModel(); ParseChunks(reader, context.CurrentEndPosition, chunkType => { switch (chunkType) { case W3dChunkType.W3D_CHUNK_HMODEL_HEADER: result.Header = W3dHModelHeader.Parse(reader, context); break; case W3dChunkType.W3D_CHUNK_NODE: result.Node = W3dNode.Parse(reader, context); break; case W3dChunkType.W3D_CHUNK_COLLISION_NODE: result.CollisionNode = W3dCollisionNode.Parse(reader, context); break; case W3dChunkType.W3D_CHUNK_SKIN_NODE: result.SkinNode = W3dSkinNode.Parse(reader, context); break; case W3dChunkType.OBSOLETE_W3D_CHUNK_HMODEL_AUX_DATA: result.AuxData = W3dHModelAuxData.Parse(reader, context); break; case W3dChunkType.OBSOLETE_W3D_CHUNK_SHADOW_NODE: result.ShadowNode = W3dShadowNode.Parse(reader, context); break; default: throw CreateUnknownChunkException(chunkType); } }); return result; })); }