Difference between revisions of "Breakable (RW Section)"

From GTAMods Wiki
Jump to navigation Jump to search
m (Material Data)
m (Updated structures with trustworthy naming, hopefully.)
Line 7: Line 7:
 
==Header==
 
==Header==
  
There is a ''56 byte'' header which holds information about the amount of data arrays that follow.
+
There is a ''56 byte'' header which holds information about the amount of data arrays that follow:
  
  4b - UINT32  - Offset to this data (zero if ''Breakable model'' is not used)
+
UINT32  magicNumber (zero if ''Breakable model'' is not used, otherwise any random non-zero value)
  4b - UINT32  - Position rule (if 1 then position is calculated relatively to object collision model, if 0 - to clump position)
+
UINT32  posnRule{{ref|posnrule|[*]}} (0 = OBJECT_ORIGIN, 1 = COLLISION_ORIGIN)
  4b - UINT32 - Vertex Count
+
  // Vertex data
  4b - UINT32  - Offset to vertices (''unused'')
+
UINT16  numVertices
  4b - UINT32  - Offset to texture coors (''unused'')
+
UINT16 
  4b - UINT32  - Offset to vertex colors (''unused'')
+
UINT32  (assumed offset to verts, unused)
  4b - UINT32 - Face Count
+
UINT32  (assumed offset to texCoords, unused)
  4b - UINT32  - Offset to faces (''unused'')
+
UINT32  (assumed offset to preLitLum, unused)
  4b - UINT32  - Offset to material assignments (''unused'')
+
  // Triangle data
  4b - UINT32 - Material Count (= Fragment Count)
+
UINT16  numTriangles
  4b - UINT32  - Offset to textures (''unused'')
+
UINT16 
  4b - UINT32  - Offset to texture names  (''unused'')
+
UINT32  (assumed offset to vertIndices, unused)
  4b - UINT32  - Offset to mask names  (''unused'')
+
UINT32  (assumed offset to matIndices, unused)
  4b - UINT32  - Offset to material properties  (''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)
  
==Geometry Data==
+
;Note
 +
:{{note|posnrule}} Impose whether to calculate the position relatively to the collision model or to the clump/atomic ''RwFrame''.
  
Vertices: array of <nowiki>[Vertex Count]</nowiki> elements
+
==Vertex data==
  12b - FLOAT[3]  - XYZ
 
 
UV Coords: array of <nowiki>[Vertex Count]</nowiki> elements
 
    8b - FLOAT[2]  - UV
 
 
Vertex Colors: array of <nowiki>[Vertex Count]</nowiki> elements
 
    4b - BYTE[4]  - RGBA
 
 
Faces: array of <nowiki>[Face Count]</nowiki> elements
 
    6b - UINT16[3] - 3 indices into vertex array
 
 
Material Assignments: array of <nowiki>[Face Count]</nowiki> elements
 
    2b - UINT16    - Material ID
 
  
==Material Data==
+
FLOAT[3]    verts[numVertices]
 +
FLOAT[2]    texCoords[numVertices]
 +
BYTE[4]    preLitLum[numVertices] (RGBA)
  
Each polygon group sharing the same material is treated as a separate fragment when the object is split up.
+
==Triangle data==
  
  Texture Names: array of <nowiki>[Material Count]</nowiki> elements
+
  UINT16[3]  vertIndices[numTriangles]
  32b - CHAR[32] - Texture Name
+
UINT16      matIndices[numTriangles]
+
 
  Alpha Names: array of <nowiki>[Material Count]</nowiki> elements
+
==Material data==
  32b - CHAR[32] - Alpha Texture Name
+
 
   
+
Each polygon group sharing the same material is treated as a separate fragment when the object is split up:
Material Properties: array of <nowiki>[Material Count]</nowiki> elements
+
 
   12b - FLOAT[3] - material color (red/green/blue)
+
  CHAR[32]    textureNames[numMaterials]
 +
CHAR[32]   textureMasks[numMaterials]
 +
  FLOAT[3]    ambientColors[numMaterials]
  
 
==Tools and Scripts==
 
==Tools and Scripts==
 
* {{GTAF|269717|Breakable Objects Export Script}} by {{U|Deniska}}. A script for 3dsMax which allows to export Breakable model information to seperate files.
 
* {{GTAF|269717|Breakable Objects Export Script}} by {{U|Deniska}}. A script for 3dsMax which allows to export Breakable model information to seperate files.

Revision as of 16:48, 21 June 2015

{{{NAME}}}
RenderWare Stream Section
Vendor {{{VENDORNAME}}}
Module {{{MODULENAME}}}
Module ID 0x{{{MODULEID}}}
Identifier 0x{{{IDENTIFIER}}}
Chunk ID 0x{{{MODULEID}}}{{{IDENTIFIER}}}
Versions All
Hierarchy
Parents:
None
Children:
None
Extensions:
None
File Format

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 typical location in a SA dff section hierarchy is Clump > Geometry List > Geometry > Extension > Breakable model.

Header

There is a 56 byte header which holds information about the amount of data arrays that follow:

UINT32  magicNumber (zero if Breakable model is not used, otherwise any random non-zero value)
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)
Note
^ Impose whether to calculate the position relatively to the collision model or to the clump/atomic RwFrame.

Vertex data

FLOAT[3]    verts[numVertices]
FLOAT[2]    texCoords[numVertices]
BYTE[4]     preLitLum[numVertices] (RGBA)

Triangle data

UINT16[3]   vertIndices[numTriangles]
UINT16      matIndices[numTriangles]

Material data

Each polygon group sharing the same material is treated as a separate fragment when the object is split up:

CHAR[32]    textureNames[numMaterials]
CHAR[32]    textureMasks[numMaterials]
FLOAT[3]    ambientColors[numMaterials]

Tools and Scripts