Collision PLG (RW Section)

From GTAMods Wiki
Jump to navigation Jump to search
Collision PLG
RenderWare Stream Section
Vendor Criterion Games
Module Toolkit
Module ID 0x000001
Identifier 0x1D
Chunk ID 0x0000011D
Versions All
Hierarchy
Parents:
Geometry (Extension)
Children:
Coll Tree
Extensions:
None
File Format

Structure

A Collision PLG either contains data itself if the version is older than 3.6 or stores a Coll Tree child structure if it's 3.6 or newer. The version in the chunk header is ignored. RenderWare reads the first uint32, which is restricted to uint16 in the older format (numLeafNodes). If the value is 0x36001 or greater, the new format is read. If it's smaller, the old format is read.

#if version < 0x36001
    uint32  numLeafNodes
    uint32  numTriangles

    #repeat for numLeafNodes - 1
        uint8   rightType, leftType (1 = Leaf, 2 = Branch)
        uint16  type (Axis: 0 = X, 4 = Y, 8 = Z)
        uint16  rightNode
        uint16  leftNode
        float32 leftValue
        float32 rightValue
    #endrepeat

    #repeat for numLeafNodes
        uint16 firstPolygon
        uint16 numPolygons
    #endrepeat

    uint16 triangleMap[numTriangles]
#else
    uint32 version
#endif