Time for action - designing and parsing a new file format
We will design a new file format and create the I/O plugin for it in this example. Its format specification should be simple enough so that we won't take much time in explaining the usage and parsing it to a scene graph.
The new format will only focus on quickly creating triangle strips—that is, a series of connected triangles with
N+2 shared vertices, where
N is the number of triangles to be drawn. The file is in text format, and has one extension,
.tri, which means triangle file format. The total number of vertices will always be written at the first line of every
.tri file. The following lines provide the vertices data fields. Each vertex is stored as three float values in a row. An ...