Breakable (RW Section)
|RW Stream Section|
Breakable, formerly Breakable Model, is one of Rockstar's custom sections used in GTA San Andreas. It contains information on how to split breakable objects when they are hit. An object including this section has to be defined in object.dat.
The initial 4 bytes sequence signals the usage of the extension:
If zero, the section ends here. A non-zero value has no particular meaning and can be any (see Meaningless values).
There is a 52 byte header which holds information about the amount of data arrays that follow:
UINT32 posnRule (0 = OBJECT_ORIGIN, 1 = COLLISION_ORIGIN) // Vertex data UINT16 numVertices UINT16 UINT32 (assumed offset to verts, unused) UINT32 (assumed offset to texCoords, unused) UINT32 (assumed offset to preLitLum, unused) // Triangle data UINT16 numTriangles UINT16 UINT32 (assumed offset to vertIndices, unused) UINT32 (assumed offset to matIndices, unused) // Material data UINT16 numMaterials UINT16 UINT32 (assumed offset to textures, unused) UINT32 (assumed offset to textureNames, unused) UINT32 (assumed offset to textureMasks, unused) UINT32 (assumed offset to ambientColors, unused)
The position rule imposes whether to calculate the position relatively to the collision model or to the clump/atomic RwFrame. See Meaningless values for clarifications about the unused fields.
FLOAT verts[numVertices] FLOAT texCoords[numVertices] BYTE preLitLum[numVertices] (RGBA)
UINT16 vertIndices[numTriangles] UINT16 matIndices[numTriangles]
Each polygon group sharing the same material is treated as a separate fragment when the object is split up:
CHAR textureNames[numMaterials] CHAR textureMasks[numMaterials] FLOAT ambientColors[numMaterials] (RGB normalized in range [0,1])