-
Notifications
You must be signed in to change notification settings - Fork 0
1_Data Structure
Each model is created by following this sequence:
Model Header --> Mesh Struct -->
Polygon 1 Header --> Vertex 1 Struct --> Polygon 2 Header --> Vertex 2 Struct...
After the Mesh struct, when following for the length specified in the Mesh struct specified in 0x4c, the mesh has reached its ending point. The very next thing to follow will then be either:
- a new Mesh Struct, with its Polygon Headers and Vertex Structs as usual
OR
- Model End Struct
Face building formula is based on incremental vertex sequence: (0, 1, 2) (1, 2, 3) (2, 3, 4)...
| Address | Length | Description |
|---|---|---|
| 0x00 | 0x18 | Model header |
| 0x00 | 0x04 | Naomi globalflag0, values: 0 = pure beta / 1 = super index / -1 NULL |
| 0x04 | 0x04 | Naomi globalflag1, (Check the Table ) |
| 0x08 | 0x04 | Centroid of object, X Coordinate (Float) |
| 0x0C | 0x04 | Centroid of object, Y Coordinate (Float) |
| 0x10 | 0x04 | Centroid of object, Z Coordinate (Float) |
| 0x14 | 0x04 | Bounding radius of object (Float) |
| Address | Length | Description |
|---|---|---|
| 0x00 | 0x50 | Mesh Instructions |
| 0x00 | 0x04 | Mesh Parameter (Check the Table ) |
| 0x04 | 0x04 | Image Synth & Shading Proc. |
| 0x08 | 0x04 | Texture & Shading Proc. |
| 0x08 | 0x01 | Texture size + Shadows ON/OFF (bit flag) (Check the Table ) |
| 0x09 | 0x01 | Texture filtering (bit flag) ( 04 = OFF / 24 = Bilinear / A4 = trilinear? ) |
| 0x0A | 0x01 | U/V Flip + Clamp (bit flag) (Check the Table ) |
| 0x0B | 0x01 | SRC/DST Alpha Blending mode (Check the Table ) |
| 0x0C | 0x04 | Texture Control (bit flag) (Check the Table ) |
| 0x0F | 0x01 | Texture color format (RGB1555/ARGB1555/RGB565/RGB4444/ARGB4444) |
| 0x10 | 0x04 | Centroid of mesh, X Coordinate (Float) |
| 0x14 | 0x04 | Centroid of mesh, Y Coordinate (Float) |
| 0x18 | 0x04 | Centroid of mesh, Z Coordinate (Float) |
| 0x1C | 0x04 | Bounding radius of mesh (Float) |
| 0x20 | 0x01 | Texture number (in PVR archive or mem offset) |
| 0x24 | 0x04 | Specular light value (? bitflag ) |
| 0x28 | 0x04 | Light value (Float -3.5 + 3.5) |
| 0x2C | 0x04 | Transparency value (Float) |
| 0x30 | 0x04 | Vertex Color - RED (Float) |
| 0x34 | 0x04 | Vertex Color - GREEN (Float) |
| 0x38 | 0x04 | Vertex Color - BLUE (Float) |
| 0x3C | 0x04 | Specular Transparency value (Float) |
| 0x40 | 0x04 | Specular Light - RED (Float) |
| 0x44 | 0x04 | Specular Light - GREEN (Float) |
| 0x48 | 0x04 | Specular Light - BLUE (Float) |
| 0x4C | 0x04 | Total Mesh Vertex data length |
| Address | Length | Description |
|---|---|---|
| 0x00 | 0x08 | Polygon Instructions |
| 0x00 | 0x04 | Polygon Type: (Check the Table ) |
| 0x04 | 0x04 | Total verts ( Regular-Type ) or Total verts / 3 ( Triple-Type) |
| Address | Length | Description |
|---|---|---|
| 0x0 | 0x20 | Vertex Type A |
| 0x0 | 0x04 | X (Float) |
| 0x4 | 0x04 | Y (Float) |
| 0x8 | 0x04 | Z (Float) |
| 0xC | 0x04 | X Normal (Float) |
| 0x10 | 0x04 | Y Normal (Float) |
| 0x14 | 0x04 | Z Normal (Float) |
| 0x18 | 0x04 | U (Float) |
| 0x1C | 0x04 | V (Float) |
Type B acts as a pointer to an already used vertex.
| Address | Length | Description |
|---|---|---|
| 0x0 | 0x08 | Vertex Type B |
| 0x0 | 0x04 |
NaN value to detect Type B / Vertex Index Counter |
| 0x4 | 0x04 | Vertex Pointer |
VincentNL method (physical offset) by using vertex pointer at 0x4:
Vertex_Offset = Type_B_Offset - (0xFFFF FFF8 - Vertex_Pointer) (big endian)
Example:
Type_B_offset: 0x4B98 (big endian)
Data array:0x80E8 FF5F 00EA FFFF (little endian)
Vertex_Pointer: 0x00EA FFFF (little endian)
Calculation:
0x4B98 - ( 0xFFFF FFF8 - 0xFFFF EA00) = 0x35A0 (big endian)
Vertex offset at: 0x35A0
Egregiousguy method (vertex index) by using vertex pointer at 0x0:
Every vertex is considered as a fixed value of 0x20.
By subtracting 0x1000000 to vertex pointer, then dividing by 0x20, we know how many vertices back it is from Type_B_Offset.
Example:
Data array:0x80FE FF5F 0xA8FE FFFF (little endian)
Vertex_pointer: 0xFF FE80 (big endian)
Calculation:
(0x1000000 - 0xFFFE80) / 0x20 = 0xC (big endian)
Vertex offset is 12 (0xC) vertices back.
| Address | Length | Description |
|---|---|---|
| 0x0 | 0x08 | Model End |
| 0x0 | 0x04 | 00 00 00 00 |
| 0x4 | 0x04 | Total Vertex of model |