Read() public static method

Reads a single Normal from the reader.
public static Read ( BinaryReader reader ) : Normal
reader System.IO.BinaryReader The reader which contains a to be read at the current position
return Normal
Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }