Difference between revisions of "CGFX"

From 3dbrew
Jump to navigation Jump to search
Line 130: Line 130:
 
| 0x1
 
| 0x1
 
| Vertex data format size (in bytes)
 
| Vertex data format size (in bytes)
 +
|}
 +
 +
{| class="wikitable"
 +
|-
 +
! Vertex format size
 +
! Description
 +
|-
 +
| 0x14
 +
| X (float), Y (float), Z (float), U (float), V (float)
 +
|-
 +
| 0x18
 +
| X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)
 +
|-
 +
| 0x20
 +
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)
 +
|-
 +
| 0x28
 +
| X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32?), Unk2 (u32?)
 
|}
 
|}

Revision as of 21:01, 9 February 2014

CGFX is a container format used to store graphics resources. It can contain 3D models, textures and animation data.

DICT

DICTs are generic structures used to store values (and associate them to a key ?). A DICT header is 0x1C bytes long.

DICT header :

Offset Length Description
0x0 0x4 Magic "DICT"
0x8 0x4 DICT size (in bytes)
0xC 0x4 Number of entries

DICT entry:

Offset Length Description
0x0 0x4 ?
0x4 0x4 ?
0x8 0x4 Value (often offsets)
0xC 0x4 ?

CMDL Header

Offset Length Description
0x0 0x4 Magic "CMDL"
0x8 0x4 CMDL section size (in bytes)
0x28 0x4 Offset (self-relative) to first DICT
0x2C 0xC Global scale vector (3 floats : x, y, z)
0xB0 0x4 N/2, where N is the number of entries in SOBJ list
0xB4 0x4 Offset (self-relative) to SOBJ list
0xB4+[0xB4] 0x4*N*2 SOBJ list; each word is an offset (self-relative) to an SOBJ structure

CMDL is used to describe a 3D model. A CMDL section refers to outside data; it can not be considered separately from the rest of the CGFX file. The second DICT in the CMDL section contains offsets to MTOB objects.

SOBJ

SOBJ structures can be used to describe 3D objects that are part of the model. If such is the case then they will follow this structure :

Offset Length Description
0x0 0x4 Magic "SOBJ"
0x44 0x4 X = Offset (relative to SOBJ magic) to SOBJ data structure
X+0x18 0x1 Face data format (?) : 0x1 = u8, 0x3 = u16
X+0x20 0x4 Face data section size (in bytes)
X+0x24 0x4 Face data section offset (self-relative)
X+0x58 0x4 Vertex data section size (in bytes)
X+0x5C 0x4 Vertex data section offset (self-relative)
X+0x68 0x1 Vertex data format size (in bytes)
Vertex format size Description
0x14 X (float), Y (float), Z (float), U (float), V (float)
0x18 X (float), Y (float), Z (float), Unk (u32?), U (float), V (float)
0x20 X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float)
0x28 X (float), Y (float), Z (float), NX (float), NY (float), NZ (float), U (float), V (float), Unk1 (u32?), Unk2 (u32?)