pvvmud/doc/bogfileformat.html
2025-03-05 08:37:43 +01:00

108 lines
6.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<HTML>
<HEAD>
<TITLE>PVVMUD - bog file format</TITLE>
<LINK REL=STYLESHEET HREF="/pvvmud/pvvmud.css" TYPE="text/css">
</HEAD>
<BODY>
<H1>Binary object geometry (bog) file format</H1>
<PRE>
Status : suggestion
Implementations : int CGeometry::readBOG( FILE * bog );
int CGeometry::writeBOG( FILE * bog );
</PRE>
<P>This is a binary representation of 3D mesh object. This file can be
printed in ascii using the <A HREF="geofileformat.html">geo file format</A></P>
<H2>Logical file structure</H2>
<TABLE>
<TR><TH></TH><TH></TH></TR>
<TR><TD VALIGN=top><A NAME="BOGFILE">bogFile</A></TD><TD>= bogHead + Geometry list</TD></TR>
<TR><TD VALIGN=top><A NAME="BOGHEAD">bogHead</A></TD><TD>=
File identification + File version + Number of geometries</TD></TR>
<TR><TD VALIGN=top><A NAME="FILEID">File identification</A></TD><TD>=
* String that identify this file format "BOG" *</TD></TR>
<TR><TD VALIGN=top><A NAME="FILEID">File version</A></TD><TD>= * file version number * </TD></TR>
<TR><TD VALIGN=top><A NAME="GEOMETRYLIST">Geometry liste</A></TD><TD>= {Geometry}</TD></TR>
<TR><TD VALIGN=top><A NAME="GEOMETRY">Geometry</A></TD><TD>=
Geometry head + Vertex list + Normal list + TexCoord list + Polygon list</TD></TR>
<TR><TD VALIGN=top><A NAME="GEOMETRYHEAD">Geometry head</A></TD><TD>= Geometry id +
Number of vertices + Number of normals +
Number of TexCoords + Number of polygons</TD></TR>
<TR><TD VALIGN=top><A NAME="VERTXLIST">Vertex list</A></TD><TD>= {Vertex}</TD></TR>
<TR><TD VALIGN=top><A NAME="VERTEX">Vertex</A></TD><TD>= x-coord + y-coord + z-coord</TD></TR>
<TR><TD VALIGN=top><A NAME="NORMALLIST">Normal list</A></TD><TD>= {Normal}</TD></TR>
<TR><TD VALIGN=top><A NAME="NORMAL">Normal</A></TD><TD>= x-coord + y-coord + z-coord</TD></TR>
<TR><TD VALIGN=top><A NAME="TEXCOORDLIST">TexCoord list</A></TD><TD>= {TexCoord}</TD></TR>
<TR><TD VALIGN=top><A NAME="TEXCOORD">TexCoord</A></TD><TD>= u-coord + v-coord </TD></TR>
<TR><TD VALIGN=top><A NAME="POLYGONLIST">Polygon list</A></TD><TD>= {Polygon}</TD></TR>
<TR><TD VALIGN=top><A NAME="POLYGON">Polygon</A></TD><TD>= PolyHead + Vertex indexes + Normal indexes + TexCood indexes</TD></TR>
<TR><TD VALIGN=top><A NAME="POLYHEAD">PolyHead</A></TD><TD>= Type + Material id + Number of vertex indexes + Number of normal indexes + Number of TexCoord indexes </TD></TR>
<TR><TD VALIGN=top><A NAME="TYPE">Type</A></TD><TD>=
[ Polygon | Triangles | Quads | Quad strip |
Triangle strip | Triangle fan ]</TD></TR>
<TR><TD VALIGN=top><A NAME="MATERIALID">Material id</A></TD><TD>=
* A string that identify the material. *</TD></TR>
<TR><TD VALIGN=top><A NAME="VERTEXINDEXES">Vertex indexes</A></TD><TD>= {index}</TD></TR>
<TR><TD VALIGN=top><A NAME="NORMALINDEXES">Normal indexes</A></TD><TD>= {index}</TD></TR>
<TR><TD VALIGN=top><A NAME="TEXCOORDINDEXES">TexCoord indexes</A></TD><TD>= {index}</TD></TR>
<TR><TD VALIGN=top><A NAME="INDEX">Index</A></TD><TD>=
* Pointer to element in a table. *</TD></TR>
</TABLE>
<H2>Example</H2>
<P>The bog file is a binary format but in this example
ascii text is used to demonstrate the file format.</P>
<PRE>
BOG 1 1 # File identification + File version + Number of geometries
1 8 6 4 6 # Geometry id + Number of vertices + Number of normals + Number of texCoords + Number of polygons
-1.000000 -1.000000 1.000000 # Vertex 0 = x-coord + y-coord + z-coord
1.000000 -1.000000 1.000000 # Vertex 1 = x-coord + y-coord + z-coord
1.000000 1.000000 1.000000 # Vertex 2 = x-coord + y-coord + z-coord
-1.000000 1.000000 1.000000 # Vertex 3 = x-coord + y-coord + z-coord
-1.000000 -1.000000 -1.000000 # Vertex 4 = x-coord + y-coord + z-coord
1.000000 -1.000000 -1.000000 # Vertex 5 = x-coord + y-coord + z-coord
1.000000 1.000000 -1.000000 # Vertex 6 = x-coord + y-coord + z-coord
-1.000000 1.000000 -1.000000 # Vertex 7 = x-coord + y-coord + z-coord
1.000000 0.000000 0.000000 # Normal 0 = x-coord + y-coord + z-coord
0.000000 1.000000 0.000000 # Normal 1 = x-coord + y-coord + z-coord
0.000000 0.000000 1.000000 # Normal 2 = x-coord + y-coord + z-coord
-1.000000 0.000000 0.000000 # Normal 3 = x-coord + y-coord + z-coord
0.000000 -1.000000 0.000000 # Normal 4 = x-coord + y-coord + z-coord
0.000000 0.000000 -1.000000 # Normal 5 = x-coord + y-coord + z-coord
0.000000 0.000000 # TexCoord 0 = u-coord + v-coord
1.000000 0.000000 # TexCoord 1 = u-coord + v-coord
1.000000 1.000000 # TexCoord 2 = u-coord + v-coord
0.000000 1.000000 # TexCoord 3 = u-coord + v-coord
2 0 4 1 4 # Polygon 0 = Type + Material id + Number of vertex indexes + Number of normal indexes + Number of TexCoord indexes
1 5 6 2 # Vertex indexes
0 # Normal indexes
0 1 2 3 # TexCoord indexes
2 1 4 1 4 # Polygon 1 = Type + Material id + Number of vertex indexes + Number of normal indexes + Number of TexCoord indexes
2 6 7 3 # Vertex indexes
1 # Normal indexes
0 1 2 3 # TexCoord indexes
2 2 4 1 4 # Polygon 2 = Type + Material id + Number of vertex indexes + Number of normal indexes + Number of TexCoord indexes
0 1 2 3 # Vertex indexes
2 # Normal indexes
0 1 2 3 # TexCoord indexes
2 3 4 1 4 # Polygon 3 = Type + Material id + Number of vertex indexes + Number of normal indexes + Number of TexCoord indexes
3 7 4 0 # Vertex indexes
3 # Normal indexes
0 1 2 3 # TexCoord indexes
2 4 4 1 4 # Polygon 4 = Type + Material id + Number of vertex indexes + Number of normal indexes + Number of TexCoord indexes
0 4 5 1 # Vertex indexes
4 # Normal indexes
0 1 2 3 # TexCoord indexes
2 5 4 1 4 # Polygon 5 = Type + Material id + Number of vertex indexes + Number of normal indexes + Number of TexCoord indexes
4 7 6 5 # Vertex indexes
5 # Normal indexes
0 1 2 3 # TexCoord indexes
</PRE>
</BODY>
</HTML>