Next: , Previous: ND Transformation matrices, Up: Conventions


4.1.8 Binary format

Many OOGL objects accept binary as well as ASCII file formats. These files begin with the usual ASCII token (e.g. CQUAD) followed by the word BINARY. Binary data begins at the byte following the first newline after BINARY. White space and a single comment may intervene, e.g.

     OFF BINARY	# binary-format "OFF" data follows

Binary data comprise 32-bit integers and 32-bit IEEE-format floats, both in big-endian format (i.e., with most significant byte first). This is the native format for 'int's and 'float's on Sun-3's, Sun-4's, and Irises, among others.

Binary data formats resemble the corresponding ASCII formats, with ints and floats in just the places you'd expect. There are some exceptions though, specifically in the QUAD, OFF and COMMENT file formats. Details are given in the individual file format descriptions. See QUAD, See OFF, and See COMMENT.

Binary OOGL objects may be freely mixed in ASCII object streams:

     LIST
     { = MESH BINARY
     ... binary data for mesh here ...
     }
     { = QUAD
     	1 0 0   0 0 1   0 1 0  0 1 0
     }

Note that ASCII data resumes immediately following the last byte of binary data.

Naturally, it's impossible to embed comments inside a binary-format OOGL object, though comments may appear in the header before the beginning of binary data.