I'm trying to create a basic model viewer for Wavefront Object files, and part of the reading of the file includes splitting each line. The faces are defined based on slashes. These are the different types of faces that can be parsed from Wikipedia:
f v1 v2 v3 v4 ... <- Face built of vertices
f v1/vt1 v2/vt2 v3/vt3 ... <- Face built of vertices + textures
f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 ... <- Face built of vertices, textures, and normals
f v1//vn1 v2//vn2 v3//vn3 ... <- Face built of vertices and normals
I've been reading each line progressively, and if it starts with "f ", I send that to another method after removing the first two characters of the entire line to create the face.
e.g. f v1 v2 v3
would go to v1 v2 v3
When I have to deal with lines with slashes in them, I think I'm splitting them wrong as I'm not getting proper results. I'm currently using these two splits:
string.split("/");
string.split("//");
Does this create problems because the split parameter is supposed to be a regex while I'm trying to split by characters which are (I believe to be) commonly used in regex?