private bool ParseObjLine(ref string objline) { linePart = objline.Trim().Split(linePartSplitChar); switch (linePart[0]) { case O: //buffer.AddObject(linePart[1].Trim()); We skip object seperation, to reduce object count. //Importing large SketchupUp generated OBJ files results in an enormous amount of objects, making WebGL builds explode. break; case MTLLIB: mtllib = line.Substring(linePart[0].Length + 1).Trim(); break; case USEMTL: buffer.AddSubMeshGroup(linePart[1].Trim()); break; case V: buffer.PushVertex(new Vector3(cf(linePart[1]), cf(linePart[2]), cf(linePart[3]))); break; case VT: buffer.PushUV(new Vector2(cf(linePart[1]), cf(linePart[2]))); break; case VN: buffer.PushNormal(new Vector3(cf(linePart[1]), cf(linePart[2]), cf(linePart[3]))); break; case F: var faces = new FaceIndices[linePart.Length - 1]; GetFaceIndices(faces, linePart); if (linePart.Length == 4) { //tris buffer.PushFace(faces[0]); buffer.PushFace(faces[1]); buffer.PushFace(faces[2]); } else if (linePart.Length == 5) { //quad buffer.PushFace(faces[0]); buffer.PushFace(faces[1]); buffer.PushFace(faces[3]); buffer.PushFace(faces[3]); buffer.PushFace(faces[1]); buffer.PushFace(faces[2]); } else { Debug.LogWarning("face vertex count :" + (linePart.Length - 1) + " larger than 4. Ngons not supported."); return(false); //Return failure. Not triangulated. } break; } return(true); }