In the following discussion, tag will be used to denote a four character tag used in the file format. All tags must be four characters and if necessary can contain a space.
The file format is similar to the riff file format, in the sense that there are separate chunks, each of which contain the length of the chunk and the appropriate data. A sample chunk is as follows:
tag# (4 byte tag) length (4 byte length) data... data... .... (length bytes of data)
Tag | Description |
"PCAO" | This is the first tag of a valid pca object file. This tag is only followed by the length of the data and the number of subobjects that make up this conglomerate object. Which would be the entire file, since only one PCAO is allowed per file |
"POBJ" | This is the definition of a subobject. It is followed by the length of the object then the objects id(a 4 byte integer), the # of channels. The next part is the properties of each of the channel. So for each channel there is a width, height and number of basis for the channel (All integers). First comes channel ones description, followed by channel 2 etc. Next is the description of the look-up table for each channel. This consists of a width and a height for each channel. Again channel 0 is first, etc. All of the description variables are stored as 4 byte integers. |
"BAS " | This is a specific number of basis elements for a subobject. The tag is followed by the length, then the object ID that they are assosciated to, followed by which channel, and which index these basis' should start at. Finally is the number of basis vectors in the chunk. All the properties are represented as integers. After this comes the raw data in byte format. The only restriction is that the number of basis vectors in the chunk must be a multiple of four and the data is interleaved in fours B0P0 B1P0 B2P0 B3P0 .... B0PN B1PN B2PN B3PN followed by B4 -- B7 etc. |
"LUT " | This is the lookup table data, and the tag is followed by first the length, then the object ID and the channel. Then is the lookup table data as floating point data. |
"GEOA" | This is the geometric information in an ascii format. The tag is followed by the length, then the object ID then the raw data in its ascii format. Which is #vertices followed by the vertices, one per line(three floats). Then the #of texture vertices, followed by the texture vertices, one per line(two floats). Finally is the # of faces, followed by indexes of the vertices representing the faces one per line(each face is 3 vertices, so 3 integer verticies per line) |
"LUTR" | LUT Range data. It is followed by the length, then the object ID and then the number of ranges(should be the same as the number of channels in the subobject). The data after is meanchannel0,meanchannel1,...meanchanneln,minchannel0,...,minchanneln,maxchannel0,...,maxchanneln as floating point data. So the size in the length should be nchannels*3*sizeof(float)+2*sizeof(int). |
PCAO len nrobj POBJ len id nrchannel width channel0 height channel0 max # basis channel0 ... width channeln height channeln max # basis channeln width lut0 (look up table 0) height lut0 ... width lutn height lutn GEOA len objid geometry data in ascii format "BAS " len objid channel first,last basisindex data "LUT " len objid channel first, last basisindex data LUTR len objid num_range_data mean0 min0 max0 ... meann minn maxn EOF
The file format allows you to skip a tag if you do not know how to interpret it, as well as add any necessary data sections in the future.