FF7/P

From QhimmWiki
Revision as of 22:38, 12 March 2005 by Qhimm>Halkun
Jump to navigation Jump to search

"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)