.3DO File Format - Vertices, etc. by P.A.Flack 1999

last revised 24/May/1999

XYZS - Vertices
This section gives the vertices for the polygons which make up the object(s).  The numbers for the vertices are 32-bit floats.
 
Bytes Values Notes
0-3 
4-7 
8-11 
12-
"SZYX" 
0x00000000 
data size 
data...
Section Type (reversed) 
Seems to be a zero all the time 
Size of data in bytes 
Sets of 16 bytes

The data section consists of multiples of 16bytes: 4bytes each for the s, x, y & z coordinates (in that order).  The s coord has been zero in all the files I've seen.  The coordinates are in float format, and can be read (in C) with:
    float x;
    FILE* f;
    fread(&x, sizeof(float), 1, f);


PLAN - Planes
This section looks very much like the Vertices section, but the use of the values is different.  The header is the same as for XYZS, apart from bytes 0-3, which are "NALP".  The contents are used to define planes, as in Ax + By + Cz + D = 0.  The length of the vector A,B,C is 1.

Here is a diagram to hopefully show how these numbers define a plane:

The point (A*-D, B*-D, C*-D) can be thought of as the centre of the plane.  In reality, planes stretch off to infinity and there is no centre.  Planes are oriented at right angles to the line shown.

Planes are used in GPL for two purposes - for Hidden Surface Removal (HSR), and Collision Detection.  In both cases they are used to split 3D space into two parts, above and below.  GPL also uses on the plane, and sometimes uses - on the plane viewed from above, and on the plane viewed from below.


NORM - Normals
I've seen this section in the car 3DO files, and I'm guessing it's used for lighting effects.  The layout is fairly similar to XYZS & PLAN.  First value is homogeneous coordinate, next three are x,y,z.

In general terms, normals are unit length (1.0) vectors that define the direction a polygon lies in - e.g. for a table top the normal would point straight up.  Normals can be defined either once for the entire polygon (used for polygons that represent flat objects), or once per vertex (used for spheres, etc.).


STRN - String Table
This lists strings which give the file names used by this object.  No file extensions are given - the extension is implied in the PRIM section (see later).  Each string is terminated with a 0x00 byte, and the STRN section is terminated with 0xFF.  Not included in the size of the section (taken from bytes 8-11 of the header) is the number of bytes required to round the size of the STRN section to a 4 byte multiple.  0x20's are used for this purpose (spaces).

A typical STRN section looks like this (kyalami/in-t9.3do, if you must know).
 

Bytes Values Notes
0-3 
4-7 
8-11 
12-
"NRTS" 
0x00000000 
data size 
grass02, 0x00
0xFF
Section Type
Seems to be a zero all the time 
Size of data in bytes (not including padding spaces)
Strings, each terminated with a 0x00 character
A single 0xFF character terminating the string table
Padding 0x20 characters (spaces).  Either 0, 1, 2 or 3, to bring the STRN size up to a multiple of 4.

 
last revised 24/May/1999