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

From GTAMods Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{RW Section|Bin Mesh PLG|0x50E}}
+
{{RW Section
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.
+
| NAME = Bin Mesh PLG
 +
| VENDORNAME = Criterion Games
 +
| MODULENAME = World
 +
| MODULEID = 000005
 +
| IDENTIFIER = 0E
 +
| PARENTS = [[Geometry (RW Section)|Geometry]] ''([[Extension (RW Section)|Extension]])''
 +
}}
 +
 
 +
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
 +
 +
  #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
  
The number of material defines the size of an array directly follows the structure above. The structure of the array elements (''TMaterialSplitData'') links the material split index to the vertices of the geometry:
+
To decide if the file is an OpenGL file when reading, check the platform of the [[Native Data PLG (RW Section)|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.
  
4b - DWORD  - Number of vertices
+
== See also ==
4b - DWORD  - Material index
 
Xb -        - Array of DWORDs, each entry representing an vertex index
 
  
== See also ==
+
* [[Native Data PLG (RW Section)|Native Data]]
* [[RenderWare_binary_stream_file|RW file format specification]]
 
  
{{N|SA|VC}}
+
{{N|SA|VC|3}}
[[Category:GTA_3]]
 

Latest revision as of 12:35, 11 September 2020

Bin Mesh PLG
RenderWare Stream Section
Vendor Criterion Games
Module World
Module ID 0x000005
Identifier 0x0E
Chunk ID 0x0000050E
Versions All
Hierarchy
Parents:
Geometry (Extension)
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