Difference between revisions of "FF7/P"

From QhimmWiki
Jump to navigation Jump to search
Qhimm>Halkun
 
Qhimm>Halkun
Line 1: Line 1:
== "P" Polygon File Format ==


This is a short diagram of the file structure
<pre>
.p-File
  |
  +- Header
  |
  +- Vertices[]
  |
  (+- Normals[])
  |
  (+- Texture Coords[])
  |
  +- Vertice Colors[]
  |
  +- Polygon Colors[]
  |
  +- Edges[]
  |
  +- Polygons[]
  |
  +- Hundrets[]
  |
  +- Groups[]
  |
  +- BoundingBox
  |
  +- Normal Index Table[]
[] = a variable-sized array
</pre>
=== .P File Header ===
The .p files have a 128-Byte-long Header. The following is the known structure of the header.
<table CELLSPACING="0" style="text-align: center; margin-bottom: 17px;">
<tr>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
Off </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
01 </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
02 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
03 </td>
<td style="border-style: solid none solid solid; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; width: 33px; height: 25px; background-color: rgb(230, 230, 230);">
04 </td>
<td style="border-style: solid solid solid none; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 6px; height: 25px; background-color: rgb(230, 230, 230);">
</td><td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
05 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
06 </td>
<td style="border-style: solid none solid solid; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 6px; height: 25px; background-color: rgb(230, 230, 230);">
</td><td style="border-style: solid solid solid none; border-color: rgb(0, 0, 0); border-width: 1px; width: 34px; height: 25px; background-color: rgb(230, 230, 230);">
07 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
08 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
09 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
0a </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 40px; height: 25px; background-color: rgb(230, 230, 230);">
0b </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
0c </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
0d </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
0e </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 40px; height: 25px; background-color: rgb(230, 230, 230);">
0f </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
01 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border-style: solid none solid solid; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; width: 33px; height: 25px;">
01 </td>
<td style="border-style: solid solid solid none; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 6px; height: 25px;">
</td><td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border-style: solid none solid solid; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 6px; height: 25px;">
</td><td style="border-style: solid solid solid none; border-color: rgb(0, 0, 0); border-width: 1px; width: 34px; height: 25px;">
00 </td>
<td colspan="4" style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 157px; height: 25px;">
VertexColor </td>
<td colspan="4" style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 157px; height: 25px;">
NumVerts </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
10 </td>
<td colspan="4" style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 157px; height: 25px;">
NumNormals </td>
<td style="border-style: solid none solid solid; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; width: 33px; height: 25px;">
00 </td>
<td style="border-style: solid solid solid none; border-color: rgb(0, 0, 0); border-width: 1px; vertical-align: top; width: 6px; height: 25px;">
</td><td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border-style: solid none solid solid; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 6px; height: 25px;">
</td><td style="border-style: solid solid solid none; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; width: 34px; height: 25px;">
00 </td>
<td colspan="4" style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 157px; height: 25px;">
NumTexCs </td>
<td colspan="4" style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 157px; height: 25px;">
NumNormInds </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
20 </td>
<td colspan="4" style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 157px; height: 25px;">
NumEdges </td>
<td style="border-style: solid none solid solid; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 33px; height: 25px;">
</td><td colspan="4" style="border-style: solid none; border-color: rgb(0, 0, 0); border-width: 1px; width: 90px; height: 25px;">
NumPolys </td>
<td style="border-style: solid solid solid none; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 34px; height: 25px;">
</td><td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 40px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 40px; height: 25px;">
00 </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px; background-color: rgb(230, 230, 230);">
30 </td>
<td colspan="4" style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 157px; height: 25px;">
mirex_h </td>
<td style="border-style: solid none solid solid; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 33px; height: 25px;">
</td><td colspan="4" style="border-style: solid none; border-color: rgb(0, 0, 0); border-width: 1px; width: 90px; height: 25px;">
NumGroups </td>
<td style="border-style: solid solid solid none; border-color: rgb(0, 0, 0); border-width: 1px; text-align: center; vertical-align: top; width: 34px; height: 25px;">
</td><td colspan="4" style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 157px; height: 25px;">
mirex_g </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
01 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 39px; height: 25px;">
00 </td>
<td style="border: 1px solid rgb(0, 0, 0); text-align: center; width: 40px; height: 25px;">
00 </td>
</tr>
</table>
All Values, that can be Read out in this part of the header are 4-Byte-Integers
Here are the meanings:
<pre>
typedef struct
{
    long off00;
    long off04;
    long VertexColor;
    long NumVerts;
    long NumNormals;
    long off14;
    long NumTexCs;
    long NumNormInds;
    long NumEdges;
    long NumPolys;
    long off28;
    long off2c;
    long mirex_h;
    long NumGroups;
    long mirex_g;
    long off3c;
    long unknown[16];
}
t_p_header;
</pre>
<table CELLSPACING="0" style="margin-bottom: 0px;">
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 26px;">
VertexColor </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 26px;">
Specifies if Vertex-Colors are used (0=no,1=yes; default: 1) </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
NumVerts </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
Count of Vertices </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
NumNormals </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
Count of Normals (always 0 in Battle files) </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
NumTexCs </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
Count of Texture Coords </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
NumNormInds </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
Count of Normal Indices </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
NumEdges </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
Count of Lines for WireFrame-Model </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
NumPolys </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
Count of Polygons </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 26px;">
VertexColor </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 26px;">
Specifies if Vertex-Colors are used (0=no,1=yes; default: 1) </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
mirex_h </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
Count of Hundrets Chunk Entries (Textures?) </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
NumGroups </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
Count of Groups </td>
</tr>
<tr>
<td style="border: 1px solid rgb(0, 0, 0); width: 106px; height: 25px;">
mirex_g </td>
<td style="border: 1px solid rgb(0, 0, 0); width: 394px; height: 25px;">
? (sometimes 0 or 1)(but usually 1) </td>
</tr>
</table>

Revision as of 22:38, 12 March 2005

"P" Polygon File Format

This is a short diagram of the file structure

.p-File
   |
   +- Header
   |
   +- Vertices[]
   |
   (+- Normals[])
   |
   (+- Texture Coords[])
   |
   +- Vertice Colors[]
   |
   +- Polygon Colors[]
   |
   +- Edges[]
   |
   +- Polygons[]
   |
   +- Hundrets[]
   |
   +- Groups[]
   |
   +- BoundingBox
   |
   +- Normal Index Table[]

[] = a variable-sized array


.P File Header

The .p files have a 128-Byte-long Header. The following is the known structure of the header.

Off 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
00 01 00 00 00 01 00 00 00 VertexColor NumVerts
10 NumNormals 00 00 00 00 NumTexCs NumNormInds
20 NumEdges NumPolys 00 00 00 00 00 00 00 00
30 mirex_h NumGroups mirex_g 01 00 00 00

All Values, that can be Read out in this part of the header are 4-Byte-Integers

Here are the meanings:

typedef struct
{
     long off00;
     long off04;
     long VertexColor;
     long NumVerts;
     long NumNormals;
     long off14;
     long NumTexCs;
     long NumNormInds;
     long NumEdges;
     long NumPolys;
     long off28;
     long off2c;
     long mirex_h;
     long NumGroups;
     long mirex_g;
     long off3c;
     long unknown[16];
} 
t_p_header;
VertexColor Specifies if Vertex-Colors are used (0=no,1=yes; default: 1)
NumVerts Count of Vertices
NumNormals Count of Normals (always 0 in Battle files)
NumTexCs Count of Texture Coords
NumNormInds Count of Normal Indices
NumEdges Count of Lines for WireFrame-Model
NumPolys Count of Polygons
VertexColor Specifies if Vertex-Colors are used (0=no,1=yes; default: 1)
mirex_h Count of Hundrets Chunk Entries (Textures?)
NumGroups Count of Groups
mirex_g ? (sometimes 0 or 1)(but usually 1)