hey homies, i been trying to make a reader for milkshape 3d the graphics program. the software exports text files which the reader would read. I i were to make a simple box in milkshape and export in text it would look like this:
im not tring to display any graphics yet i want it to take all the values like the number of points 8 and store them in a varible so when i finally do make a graphical window i will be able to display them making a call to the varibles. right now im guessing the best way to go about this is to use the fstream header but i dont know how to skip lines like in the box text file i wouldnt want it to read
simplemeshformat 1
instead i want it to skip that and store a varible called points which in this case would equal 8. does any one know how to this?
There are MilkShape viewers with source code available at chumbalaum site.
Study the file reading sections of those for tips though I think for the text format viewer the code is more C than C++.
Also look for source code for other ascii format (obj, mqo) model viewers since you will see in general how to read the file. In general you read every line of the file but do nothing with the lines you want to ignore, just tell the program to read the next line.
For your example above read the first line, read the second line, read the third line, read the fourth line, store the number of vertices, for the next (number of vertices) lines read x,y,z and store them, read the next line store the number of faces, for the next (number of faces) lines read vert indices, normals, uv's etc.