PD4

From wowdev
Jump to navigation Jump to search

PD4 files are the PM4 equivalent for WMOs. There is one file per root WMO. They are not supposed to be shipped to the client and are used by the server only.

MVER

uint32_t version;
enum {
  version_48 = 48,               // seen in WoD (6.0.1.18297), WoD (6.0.1.18443)
};

MCRC

uint32_t _0x00;                  // Always 0 in version_48.

MSHD

struct {
  uint32_t _0x00;
  uint32_t _0x04;
  uint32_t _0x08;
  uint32_t _0x0c[5];             // Always 0 in version_48, likely placeholders.
} header;

MSPV

C3Vector msp_vertices[];

MSPI

uint32_t msp_indices[];          // index into #MSPV

MSCN

Not related to #MSPV and #MSLK: Seen to have one entry while #MSPV and #MSLK has none.

C3Vector mscn[];                // n ≠ normals.

MSLK

struct {
  uint8_t _0x00;                 // earlier documentation has this as bitmask32 flags
  uint8_t _0x01;
  uint16_t _0x02;                // Always 0 in version_48, likely padding.
  uint32_t _0x04;                // An index somewhere.
  int24_t MSPI_first_index;      // -1 if _0x0b is 0
  uint8_t MSPI_index_count;
  uint32_t _0x0c;                // Always 0xffffffff in version_48.
  uint16_t _0x10;
  uint16_t _0x12;                // Always 0x8000 in version_48.
} mslk[];

MSVT

C3Vector msvt[];                // t ≠ tangents. vt = vertices?

For some reason the values are ordered YXZ, and must have the following formulas ran on them to get the ingame coordinates.

worldPos.y = 17066.666 - position.y; 
worldPos.x = 17066.666 - position.x;
worldPos.z = position.z / 36.0f; // Divide by 36 is used to convert the internal inch height to yards 

MSVI

Likely not triangles but quads, or an n-gon described somewhere, possibly #MSUR where _0x01 is count and _0x14 is offset.

uint32_t msv_indices[];          // index into #MSVT

MSUR

struct {
  uint8_t _0x00;                 // earlier documentation has this as bitmask32 flags
  uint8_t _0x01;                 // count of indices in #MSVI
  uint8_t _0x02;
  uint8_t _0x03;                 // Always 0 in version_48, likely padding.
  float _0x04;
  float _0x08;
  float _0x0c;
  float _0x10;
  uint32_t MSVI_first_index;
  uint32_t _0x18;
  uint32_t _0x1c;
} msur[];