Beispiel #1
0
 /// <summary>
 /// Parse a face.
 /// </summary>
 void ParseFace()
 {
     SkipWhitespace ();
     var face = new ObjFace ();
     var raw = ReadVertexGroupString (ReadLine ());
     for (var i = 0; i < raw.Length; i++) {
         var vertex = ExtractFaceVertex (raw [i]);
         var vi = vertex.VertexIndex;
         var ti = vertex.TextureIndex;
         var ni = vertex.NormalIndex;
         this.Log ("Read face vertex (V:{0}; T:{1}; N:{2})", vi, ti, ni);
         face.Vertices.Add (vertex);
     }
     if (result.Groups.All (e => e.Name != currentGroup)) {
         result.Groups.Add (new ObjFaceGroup (currentGroup));
         this.Log ("Added face group {0}", currentGroup);
     }
     var g = result.Groups.First (e => e.Name == currentGroup);
     g.Faces.Add (face);
 }