/// <summary>Reads a single <see cref="Facet"/> from the <paramref name="reader"/>.</summary> /// <param name="reader">The reader which contains a <see cref="Facet"/> to be read at the current position</param> public static Facet Read(StreamReader reader) { if (reader == null) { return(null); } //Create the facet. Facet facet = new Facet(); //Read the normal. if ((facet.Normal = Normal.Read(reader)) == null) { return(null); } //Skip the "outer loop". reader.ReadLine(); //Read 3 vertices. facet.Vertices = Enumerable.Range(0, 3).Select(o => Vertex.Read(reader)).ToList(); //Read the "endloop" and "endfacet". reader.ReadLine(); reader.ReadLine(); return(facet); }
/// <summary>Reads a single <see cref="Facet"/> from the <paramref name="reader"/>.</summary> /// <param name="reader">The reader which contains a <see cref="Facet"/> to be read at the current position</param> public static Facet Read(BinaryReader reader) { if (reader == null) { return(null); } //Create the facet. Facet facet = new Facet(); //Read the normal. facet.Normal = Normal.Read(reader); //Read 3 vertices. facet.Vertices = Enumerable.Range(0, 3).Select(o => Vertex.Read(reader)).ToList(); //Read the attribute byte count. facet.AttributeByteCount = reader.ReadUInt16(); return(facet); }