Esempio n. 1
0
        private PlyFormat ParseFormat()
        {
            string line = CurrentLine.Trim();

            PlyFormat format = default(PlyFormat);

            if (line.StartsWith(PlyKeywords.AsciiFormat))
            {
                format = PlyFormat.Ascii;
            }
            else if (line.StartsWith(PlyKeywords.BinaryBigEndianFormat))
            {
                format = PlyFormat.BinaryBigEndian;
            }
            else if (line.StartsWith(PlyKeywords.BinaryLittleEndianFormat))
            {
                format = PlyFormat.BinaryLittleEndian;
            }
            else
            {
                throw new PlyHeaderReaderException("Unknown format.", CurrentLine);
            }

            MoveNextLine();
            return(format);
        }
Esempio n. 2
0
 public PlyHeader(List <string> headerUnparsed)
 {
     Format = GetFormat(headerUnparsed.FirstOrDefault(x => x.Contains("format")).Split(' ')[1]);
     GloablMaterialElement = new PlyGlobalMaterialElement(headerUnparsed);
     GlobalMeshInfoElement = new PlyGlobalMeshInfoElement(headerUnparsed);
     VertexElement         = new PlyVertexElement(headerUnparsed, this);
     FaceElement           = new PlyFaceElement(headerUnparsed, this);
     LineElement           = new PlyLineElement(headerUnparsed);
     LineColorElement      = new PlyLineColorElement(headerUnparsed);
     RawHeader             = headerUnparsed;
 }
Esempio n. 3
0
        public PlyHeader(List <string> headerUnparsed)
        {
            Format = GetFormat(headerUnparsed.FirstOrDefault(x => x.Contains("format")).Split(' ')[1]);
            var elementVertexIndex = headerUnparsed.IndexOf(headerUnparsed.FirstOrDefault(x => x.Contains("element vertex")));

            VertexCount = Convert.ToInt32(headerUnparsed[elementVertexIndex].Split(' ')[2]);
            var elementFaceIndex = headerUnparsed.IndexOf(headerUnparsed.FirstOrDefault(x => x.Contains("element face")));

            FaceCount = Convert.ToInt32(headerUnparsed[elementFaceIndex].Split(' ')[2]);
            SetVertexProperties(GetProperties(headerUnparsed, elementVertexIndex));
            SetFaceProperties(GetProperties(headerUnparsed, elementFaceIndex));
            RawHeader = headerUnparsed;
        }