Difference between revisions of "Native Data PLG (RW Section)"

From GTAMods Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
{{RW Section|Native Data PLG|0x510}}
 
{{RW Section|Native Data PLG|0x510}}
  
== Structure (X-Box GTA 3, RW version 3.4.0.3) ==
+
Before geometry can be rendered in RW, it has to be ''instanced'' into a form the platform can render easily. Since instancing takes time, instanced geometry can be directly written to a DFF so the step can be skipped and the loading of the file will be optimized. This means however that a pre-instanced DFF can only be used by the same platform that wrote the file.
  
    ('''Section Header''')
+
When an instanced Geometry is streamed out, the [[Geometry_(RW_Section)|Geometry]] chunk will contain no geometry data and the rpGEOMETRYNATIVE flag will be set. What data the [[Bin_Mesh_PLG_(RW_Section)|Bin Mesh]] and a [[Skin_PLG_(RW_Section)|Skin]] chunk will contain depends on the platform.
        4 bytes - int - 5
+
So if the game needs access to this geometric data (e.g. to morph player meshes in San Andreas), a pre-instanced format ''cannot'' be used.
        4 bytes - hex - VertexOffset
 
        2 bytes - int - VertexUnknow
 
        2 bytes - int - MaterialCount
 
        4 bytes - int - 6
 
        4 bytes - int - VertexCount
 
        4 bytes - int - 32
 
        4 bytes - hex - 0x164314
 
  
    ('''Material Header''')
+
Pre-instanced DFFs are used in Vice City and San Andreas for PS2, Xbox and mobile devices. On the Xbox III also uses pre-instanced files.
        4 bytes - int - 0
 
        4 bytes - int - unknow1
 
        4 bytes - int - unknow2
 
  
    ('''Material tristrips info''')
+
For descriptions of the data format for each platform, see the following:
    {ARRAY OF SIZE: MaterialCount*24 bytes}
+
[[PS2_Native_Data|PS2]],
        4 bytes - int - MaterialCount.VertexCountStart
+
[[Xbox_Native_Data|Xbox]],
        4 bytes - int - MaterialCount.VertexCountEnd
+
[[OpenGL_Native_Data|OpenGL]].
        4 bytes - int - MaterialCount.TristripsCount
 
        4 bytes - int - MaterialCount.UnknowCount
 
        4 bytes - hex - Unknow3 (in fist = 0x17AB78)
 
        4 bytes - hex - 0x19ED91
 
        {END ARRAY}
 
 
 
    ('''Padding''')
 
    {ARRAY OF SIZE: 16 - (12+MaterialCount*24 bytes) mod 16}
 
        1 byte - hex - 0xCD
 
        {END ARRAY}
 
 
 
    ('''Tristrips''')
 
    {ARRAY OF SIZE: MaterialCount.TristripsCount*2 bytes}
 
        2 bytes - int - Vertex
 
        {END ARRAY}
 
 
 
    ('''Padding''')
 
    {ARRAY OF SIZE: unknow}
 
        1 byte - hex - 0xCD
 
        {END ARRAY}
 
 
 
    ('''Verticles''')
 
    {ARRAY OF SIZE: Vertex Count*(24 or 32) bytes}
 
        4 bytes - float - Coordinate X
 
        4 bytes - float - Coordinate Y
 
        4 bytes - float - Coordinate Z
 
        1 byte - int - Color R
 
        1 byte - int - Color G
 
        1 byte - int - Color B
 
        1 byte - int - Color Alpha
 
        4 bytes - float - U
 
        4 bytes - float - V
 
        {IF Textured_2=1 in flags THEN}
 
            4 bytes - float - U
 
            4 bytes - float - V
 
        {END IF}
 
    {END ARRAY}
 
 
 
    ('''Padding''')
 
    {ARRAY OF SIZE: unknow}
 
        1 byte - hex - 0xCD
 
        {END ARRAY}
 
 
 
    ('''Normals''')
 
    {IF Normals=1 in Flags THEN}
 
        {ARRAY OF SIZE: Vertex Count*12 bytes}
 
            4 bytes - float - Coordinate X
 
            4 bytes - float - Coordinate Y
 
            4 bytes - float - Coordinate Z
 
        {END ARRAY}
 
    {END IF}
 
 
 
    ('''Padding''')
 
    {ARRAY OF SIZE: unknow}
 
        1 byte - hex - 0xCD
 
        {END ARRAY}
 
 
 
== See also ==
 
* [[RenderWare_binary_stream_file|RW file format specification]]
 
 
 
{{N|SA|VC|3}}
 
[[Category:GTA_3]]
 

Revision as of 09:10, 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

Before geometry can be rendered in RW, it has to be instanced into a form the platform can render easily. Since instancing takes time, instanced geometry can be directly written to a DFF so the step can be skipped and the loading of the file will be optimized. This means however that a pre-instanced DFF can only be used by the same platform that wrote the file.

When an instanced Geometry is streamed out, the Geometry chunk will contain no geometry data and the rpGEOMETRYNATIVE flag will be set. What data the Bin Mesh and a Skin chunk will contain depends on the platform. So if the game needs access to this geometric data (e.g. to morph player meshes in San Andreas), a pre-instanced format cannot be used.

Pre-instanced DFFs are used in Vice City and San Andreas for PS2, Xbox and mobile devices. On the Xbox III also uses pre-instanced files.

For descriptions of the data format for each platform, see the following: PS2, Xbox, OpenGL.