Breakable (RW Section)

From GTAMods Wiki
Revision as of 18:57, 30 September 2007 by Aschratt (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Mesh Extension

Mesh Extension is one of Rockstar's custom sections used in GTA San Andreas. It has the Offset 0x0253F2FD and is used to create breakable objects for the game. It contains information how to split the objects after destroying them in any way. An object including this section needs to be defined in the Object.dat file which is locatet in the data folder of the game.

The typical location in a SA dff section hierarchy is Clump > Geometry List > Geometry > Extension > Mesh Extension.

Binary structure

Header

The header includes 4 bytes. Those bytes are the same as in the Night Vertex Color Section.

 4b - BYTE[]  - unknown (Can be left 0)

Subheader

Each section contains an subheader of 52 bytes which inculdes information about the count of the data-arrays following at the end of the file.

 4b - UINT32  - Allways 1
 4b - UINT32  - VertexCount
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - FacesCount
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - ObjectsCount
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)

The subheader information are used to define the number of the array entries follow after the subheader

Vertex Information

The vertex section contains all vertieces. The number of entries is the same as the VertexCount from the subheader. The structure is a 3-Point Floating Array:

12b - FLOAT[] - XYZ

UV Mapping Coords

Contains the UV MappingCoords for each vertex. The index of the vertex is also the index of the mappingcoord information.

 8b - FLOAT[] - UV

VCol Information

The vertex color section contains information about the vertex colors. Here the index of the vertex is also the index of the VCol information.

 4b - BYTE[]  - RGBA

Faces

The faces section contains infromation about the vertex which are connected to an face. Each face is an triangle (so it has 3 vertex). The section contains a specific number of faces (FacesCount). Each entry is an index of a vertex defined below.

 2b - UINT16  - VertexIndex1
 2b - UINT16  - VertexIndex2
 2b - UINT16  - VertexIndex3

Because of the UInt16 values the number of vertexes is limited to 65535.

Materials

The materials section contains information about the index to the "material". The material is the number of the object. Each entry in this section has the same index as an face. It gives the face with the same index an ID which connects the face to an object.

 2b - UINT16  - MaterialID

Textures

The textures section contains all names of the textures used by an object. The number of the entries is the same as ObjectCount

32b - STRING  - TextureName

Alphas

The alpha section contains additional information for the textures section: the alphanames. The section inculdes as many entries as the textures section.

32b - STRING  - AlphaName

Unknown

This section is currently unknown. It includes several floating point values which are mostly 1.0. The number of entries is the same as the ObjectCount.

 4b - FLOAT    - Unknown (Mostly 1.0)
 4b - FLOAT    - Unknown (Mostly 1.0)
 4b - FLOAT    - Unknown (Mostly 1.0)

Object.dat entry

You have to define the object in the object.dat to get it work.

Tools and Scripts