Difference between revisions of "Bin Mesh PLG (RW Section)"

From GTAMods Wiki
Jump to navigation Jump to search
(reworked the page)
Line 1: Line 1:
 
{{RW Section|Bin Mesh PLG|0x50E}}
 
{{RW Section|Bin Mesh PLG|0x50E}}
The '''Bin Mesh PLG''' section stores face data split according to material indices. It is typically stored inside the [[Extension_(RW_Section)|extension]] of a [[Geometry (RW Section)|geometry section]] and does not hold any child sections.
+
The '''Bin Mesh''' plugin holds an optimized representation of the model topology.
 +
Triangles are grouped together into Meshes by their [[Material (RW Section)|Material]]
 +
and stored as triangle strips when the rpGEOMETRYTRISTRIP flag (0x1) is set in the [[Geometry (RW Section)|Geometry]], otherwise as triangle lists.
 +
 
 +
In [[Native Data PLG (RW Section)|pre-instanced]] files, the chunk looks different according to platform.
  
 
== Structure ==
 
== Structure ==
  
  4b - DWORD  - Face type (Apparently always 1, representing a triangle strip)
+
  uint32      flags (0 = tri list, 1 = tri strip)
  4b - DWORD - Number of material splits
+
  uint32      number of Meshes (numMeshes)
  4b - DWORD - Number of faces
+
  uint32      total number of indices
 
+
   
The number of material splits defines the size of an array which directly follows the structure above. The structure of the array elements (''TMaterialSplitData'') links the material split index to the vertices of the geometry:
+
  #repeat for numMeshes
 +
    uint32  number of indices (numIndices)
 +
    uint32  material index (into the Geometry's material list)
 +
    #if pre-instanced
 +
          #if platform == OpenGL
 +
              uint16  indices[numIndices]
 +
          #endif
 +
    #else
 +
          uint32      indices[numIndices]
 +
    #endif
 +
#endrepeat
  
4b - DWORD  - Number of vertices
+
To decide if the file is an OpenGL file when reading, check the platform of the [[Native Data PLG (RW Section)|Native Data]] chunk.
4b - DWORD  - Material index
+
When no vertex indices are stored here, the pre-instanced geometry uses no indices or they are stored in the Native Data.
Xb -        - Array of DWORDs, each entry representing a vertex index.  
 
              Array size gets defined by the number of vertices
 
  
 
== See also ==
 
== See also ==
* [[RenderWare_binary_stream_file|RW file format specification]]
+
* [[RenderWare|RenderWare]]
 +
* [[Geometry (RW Section)|Geometry]]
 +
* [[Native Data PLG (RW Section)|Native Data]]
  
 
{{N|SA|VC}}
 
{{N|SA|VC}}
 
[[Category:GTA_3]]
 
[[Category:GTA_3]]

Revision as of 10:54, 13 August 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

The Bin Mesh plugin holds an optimized representation of the model topology. Triangles are grouped together into Meshes by their Material and stored as triangle strips when the rpGEOMETRYTRISTRIP flag (0x1) is set in the Geometry, otherwise as triangle lists.

In pre-instanced files, the chunk looks different according to platform.

Structure

uint32       flags (0 = tri list, 1 = tri strip)
uint32       number of Meshes (numMeshes)
uint32       total number of indices

#repeat for numMeshes
    uint32   number of indices (numIndices)
    uint32   material index (into the Geometry's material list)
    #if pre-instanced
         #if platform == OpenGL
             uint16   indices[numIndices]
         #endif
    #else
         uint32       indices[numIndices]
    #endif
#endrepeat

To decide if the file is an OpenGL file when reading, check the platform of the Native Data chunk. When no vertex indices are stored here, the pre-instanced geometry uses no indices or they are stored in the Native Data.

See also