PDA

View Full Version : parsing question for obj reader



mdog1234
12-06-2002, 02:21 PM
for anyone who knows a wavefront obj file knows that sometimes in the same file you may have a face like this f 1/2/3 or a face like this f 1//3 or f 1. The first is a face with a vertex, texture and a normal. The second is a face with a vertex and a normal and the third is a face with just a vertex.

i would like some sugestions as to how I go about checking for these differences. for right now my reader only reads faces with only a vertex or a face with all three.
thanks for the help.

p.s i know there have been alot of questions about object reader and i have read them all. None of them however check for these differences.

Old GLman
12-06-2002, 03:07 PM
Just keep some flags. Face data always comes at the end, so if you read some vertices and normals set a vertex and normal flag so you know to only read in those face indices.

Old GLman

31337
12-06-2002, 03:42 PM
I have to disagree with you GL Man. Face data does NOT always come at the end. It comes at the end of the current group.

Old GLman
12-06-2002, 05:15 PM
Your right, forgot about that. But it doesnt really matter, face data comes after verts, tex coords, and normals. Either way, keep some flags.

Old Glman