Difference between revisions of "Breakable (RW Section)"

From GTAMods Wiki
Jump to navigation Jump to search
m
(reworked, fixed)
Line 1: Line 1:
 
{{RW Section|Mesh Extension|0x0253F2FD}}
 
{{RW Section|Mesh Extension|0x0253F2FD}}
  
'''Mesh Extension''' is one of Rockstar's [[List of RW section IDs#Rockstar.27s_Custom_Sections|custom sections]] used in [[:Category:GTA SA|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|Object.dat]] file which is locatet in the data folder of the game.
+
'''Mesh Extension''' is one of Rockstar's [[List of RW section IDs#Rockstar.27s_Custom_Sections|custom sections]] used in [[:Category:GTA SA|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 [[model file|dff]] section hierarchy is ''[[Clump (RW Section)|Clump]] > [[Geometry List (RW Section)|Geometry List]] > [[Geometry (RW Section)|Geometry]] > [[Extension (RW Section)|Extension]] > Mesh Extension.
 
The typical location in a SA [[model file|dff]] section hierarchy is ''[[Clump (RW Section)|Clump]] > [[Geometry List (RW Section)|Geometry List]] > [[Geometry (RW Section)|Geometry]] > [[Extension (RW Section)|Extension]] > Mesh Extension.
 
=Binary structure=
 
  
 
==Header==
 
==Header==
  
The header includes 4 bytes. Those bytes are the same as in the [[Night_Vertex_Colors_%28RW_Section%29|Night Vertex Color]] Section.
+
There is a ''56 byte'' header which holds information about the amount of data arrays that follow.
 
 
  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 - BYTE[4] - unknown, same as in the [[Night Vertex Colors (RW Section)|Night Vertex Colors]] section
 
+
   4b - UINT32  - Always 1
   4b - UINT32  - Allways 1
+
   4b - UINT32  - Vertex Count
   4b - UINT32  - VertexCount
 
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
   4b - UINT32  - FacesCount
+
   4b - UINT32  - Face Count
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
   4b - UINT32  - ObjectsCount
+
   4b - UINT32  - Material Count (= Fragment Count)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   4b - UINT32  - Unknown (usually 0)
 
   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
+
==Geometry Data==
 
 
==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 [[Vertex Color|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)
+
Vertices: array of <nowiki>[Vertex Count]</nowiki> elements
  4b - FLOAT   - Unknown (Mostly 1.0)
+
  12b - FLOAT[3]  - XYZ
   4b - FLOAT   - Unknown (Mostly 1.0)
+
 +
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
  
=Object.dat entry=
+
==Material Data==
  
You have to define the object in the object.dat to get it work.
+
Each polygon group sharing the same material is treated as a separate fragment when the object is split up.
  
=Tools and Scripts=
+
Texture Names: array of <nowiki>[Material Count]</nowiki> elements
 +
  32b - CHAR[32]  - Texture Name
 +
 +
Alpha Names: array of <nowiki>[Material Count]</nowiki> elements
 +
  32b - CHAR[32]  - Alpha Texture Name
 +
 +
Material Properties: array of <nowiki>[Material Count]</nowiki> elements
 +
    4b - FLOAT[3]  - Unknown, possibly ambient/diffuse/specular, often 1.0
  
 +
==Tools and Scripts==
 
* [http://www.gtaforums.com/index.php?showtopic=269717 Breakable Objects Export Script] by [[User:Deniska|Deniska]]. A script for 3dsMax which allows to export MeshExtension information to seperate files.
 
* [http://www.gtaforums.com/index.php?showtopic=269717 Breakable Objects Export Script] by [[User:Deniska|Deniska]]. A script for 3dsMax which allows to export MeshExtension information to seperate files.

Revision as of 20:59, 1 October 2007

{{{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

Mesh Extension 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 > Mesh Extension.

Header

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

 4b - BYTE[4] - unknown, same as in the Night Vertex Colors section
 4b - UINT32  - Always 1
 4b - UINT32  - Vertex Count
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Face Count
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Material Count (= Fragment Count)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)
 4b - UINT32  - Unknown (usually 0)

Geometry Data

Vertices: array of [Vertex Count] elements
  12b - FLOAT[3]  - XYZ

UV Coords: array of [Vertex Count] elements
   8b - FLOAT[2]  - UV

Vertex Colors: array of [Vertex Count] elements
   4b - BYTE[4]   - RGBA

Faces: array of [Face Count] elements
   6b - UINT16[3] - 3 indices into vertex array

Material Assignments: array of [Face Count] elements
   2b - UINT16    - Material ID

Material Data

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

Texture Names: array of [Material Count] elements
  32b - CHAR[32]  - Texture Name

Alpha Names: array of [Material Count] elements
  32b - CHAR[32]  - Alpha Texture Name

Material Properties: array of [Material Count] elements
   4b - FLOAT[3]  - Unknown, possibly ambient/diffuse/specular, often 1.0

Tools and Scripts