Geometry (geo) file format

Status          : suggestion
Implementations : util/geo2bog
                  geoexp.dle (3D Studio MAX file export plugin)

Describing a 3D mesh object. This file is a ascii representation of the bog file format. The utility program geo2bog converts from geo to bog file format.

Logical file structure

geoFile= geoHead + Geometry list
geoHead= (File version)
File version= * Version number *
Geometry list= {Geometry}
Geometry= (Object name) + Vertex list + Normal list + TexCoord list + Polygon list
Object name= * String that identify sub objects *
Vertex list= {Vertex}
Vertex= x-coord + y-coord + z-coord
Normal list= {Normal}
Normal= x-coord + y-coord + z-coord
TexCoord list= {TexCoord}
TexCoord= u-coord + v-coord
Polygon list= {Polygon}
Polygon= Polygon type + Material name + Vertex index list + Normal index list + TexCood index list
Polygon type= [ "Polygon" | "Triangles" | "Quads" | "Quad strip" | "Triangle strip" | "Triangle fan" ]
Material name= * A string that identify the material. *
Vertex index list= {index}
Normal index list= {index}
TexCoord index list= {index}
Index= * Pointer to element in a table. *

Example

GEO(Version=1)

# Box with size = 2
#  Two sides with equal materials.

Geometry(Name="Box") {
  VertexList   = [ ( -1.0, -1.0,  1.0 ),
                   (  1.0, -1.0,  1.0 ),
                   (  1.0,  1.0,  1.0 ),
                   ( -1.0,  1.0,  1.0 ),
                   ( -1.0, -1.0, -1.0 ),
                   (  1.0, -1.0, -1.0 ),
                   (  1.0,  1.0, -1.0 ),
                   ( -1.0,  1.0, -1.0 ) ];
  NormalList   = [ (   1.0,   0.0,   0.0 ),
                   (   0.0,   1.0,   0.0 ),
                   (   0.0,   0.0,   1.0 ),
                   (  -1.0,   0.0,   0.0 ),
                   (   0.0,  -1.0,   0.0 ),
                   (   0.0,   0.0,  -1.0 ) ];
  TexCoordList = [ (   0.0,   0.0 ),
                   (   1.0,   0.0 ),
                   (   1.0,   1.0 ),
                   (   0.0,   1.0 ) ];
  Polygon {
    Type = QUADS;
    Material = "1";
    Vertex   = [ 1, 5, 6, 2 ];
    Normal   = [ 0 ];
    TexCoord = [ 0, 1, 2, 3 ];
  }
  Polygon {
    Type = QUADS;
    Material = "2";
    Vertex   = [ 2, 6, 7, 3, 0, 1, 2, 3 ];
    Normal   = [ 1, 2 ];
    TexCoord = [ 0, 1, 2, 3, 0, 1, 2, 3 ];
  }
  Polygon {
    Type = QUADS;
    Material = "3";
    Vertex   = [ 3, 7, 4, 0 ];
    Normal   = [ 3 ];
    TexCoord = [ 0, 1, 2, 3 ];
  }
  Polygon {
    Type = QUADS;
    Material = "4";
    Vertex   = [ 0, 4, 5, 1 ];
    Normal   = [ 4 ];
    TexCoord = [ 0, 1, 2, 3 ];
  }
  Polygon {
    Type = QUADS;
    Material = "5";
    Vertex   = [ 4, 7, 6, 5 ];
    Normal   = [ 5 ];
    TexCoord = [ 0, 1, 2, 3 ];
  }
}