bool SectionFace(string[] tokens) { if (tokens[0] == "}") { return(false); } int nface = int.Parse(tokens[0]); { StringBuilder sb = new StringBuilder(); foreach (string i in tokens) { sb.Append(' ').Append(i); } string line = sb.ToString().Trim(); tokens = SplitString(line); } switch (nface) { case 3: { MqoFace f = new MqoFace(); for (int i = 1; i < tokens.Length; ++i) { string t = tokens[i]; if (t.StartsWith("V(")) { string[] t3 = SplitParam(t); f.a = ushort.Parse(t3[1]); f.b = ushort.Parse(t3[2]); f.c = ushort.Parse(t3[3]); } else if (t.StartsWith("M(")) { string[] t3 = SplitParam(t); f.spec = ushort.Parse(t3[1]); } else if (t.StartsWith("UV(")) { string[] t3 = SplitParam(t); f.ta = Point2.Parse(t3, 1); f.tb = Point2.Parse(t3, 3); f.tc = Point2.Parse(t3, 5); } } obj.faces.Add(f); } break; case 4: { MqoFace f = new MqoFace(); MqoFace f2 = new MqoFace(); for (int i = 1; i < tokens.Length; ++i) { string t = tokens[i]; if (t.StartsWith("V(")) { string[] t3 = SplitParam(t); f.a = ushort.Parse(t3[1]); f.b = ushort.Parse(t3[2]); f.c = ushort.Parse(t3[3]); f2.a = f.a; f2.b = f.c; f2.c = ushort.Parse(t3[4]); } else if (t.StartsWith("M(")) { string[] t3 = SplitParam(t); f.spec = ushort.Parse(t3[1]); f2.spec = f.spec; } else if (t.StartsWith("UV(")) { string[] t3 = SplitParam(t); f.ta = Point2.Parse(t3, 1); f.tb = Point2.Parse(t3, 3); f.tc = Point2.Parse(t3, 5); f2.ta = f.ta; f2.tb = f.tc; f2.tc = Point2.Parse(t3, 7); } } obj.faces.Add(f); obj.faces.Add(f2); } break; default: Console.WriteLine("unsupported: nface {0}", nface); break; } return(true); }