WMO/v14

From wowdev
Jump to: navigation, search

WMO files contain world map objects. They, too, have a chunked structure just like the WDT files.

In version 14, being the first public alpha, WMO files have been one single packed file consisting of both, version 17's WMO root file and WMO group file. The files still are divided into these two sections. There first is one MOMO chunk followed by multiple MOGP chunks.

This data should be correct for / is based on the following WMOs:

  • world/wmo/cameron.wmo

MVER

File structure version.

struct MVER {
 uint32_t version;            // 14
};

MOMO

This is a container for the following general information chunks. It contains all chunks up to the first MOGP chunk.

struct MOMO {
 MOHD header;
 MOTX textures;
 MOMT materials[header.nMaterials];
 MOGN groupNames;
 MOGI groupInformation[header.nGroups];
 MOPV portalVertices;
 MOPT portalInformation;
 MOPR portalRelation;
 MOLT lights;
 MODS doodadSets[header.nDoodadSets];
 MODN doodadNames;
 MODD doodadDefinitions;
 MFOG fog;
};

MOHD

General information about the WMO.

struct MOHD {
 uint32_t nMaterials;
 uint32_t nGroups;
 uint32_t nPortals;
 uint32_t nLights;
 uint32_t nDoodadNames;
 uint32_t nDoodadDefinitions;
 uint32_t nDoodadSets;
 uint32_t ambientColor;
 uint32_t wmoID;              // column 2 in WMOAreaTable.dbc
 float boundingBox[3*2];      // empty
 uint32_t liquidRelated;      // ?, see below in the MLIQ chunk.
};

The 6 floats of bounding box corners seems to be always empty. You can calculate a correct one by taking the lowest and biggest bounding boxes in the MOGI.

MOTX

Zero-terminated filenames to be referenced from MOMT. These are zero-padded to be 4-byte-aligned.

struct MOTX {
 char filenames[chunksize];
};

MOMT

Might be the following ; it's just a WMO/v17 MOMT entry, without the last bytes

struct MOMT {
 /* 0x00 */ uint32_t flags1;
 /* 0x04 */ uint32_t shader;
 /* 0x08 */ uint32_t blend_mode;
 /* 0x0C */ uint32_t texture1_offset;
 /* 0x10 */ uint32_t color1;
 /* 0x14 */ uint32_t flags2;
 /* 0x18 */ uint32_t texture2_offset;
 /* 0x1C */ uint32_t color2;
 /* 0x20 */ uint32_t flags3;
 /* 0x24 */ uint32_t unk1;
 /* 0x28 */ uint32_t unk2;
}; --Gamhea 15:44, 10 March 2013 (UTC)

MOGN

Purely informative names for the WMO group chunks. This is referenced in MOGI. Not by position in this array though but referencing "the n-th name in MOGN".

struct MOGN {
 char groupnames[chunksize];
};

MOGI

Points to the actual group chunks as well as giving some basic information about them. Reference to the chunk is absolute, size includes the chunk header.

enum MOGIflags {
 /// TODO
 // see version 17's information
};
struct MOGI {
 uint32_t offsetToGroupChunk;
 uint32_t sizeOfGroupChunk;
 MOGIflags flags;             // ?
 float boundingBox[3*2];
 int32_t nameIndex;           // -1 for none
};

MOPV

struct MOPV {
 /// TODO
};

MOPT

struct MOPT {
 /// TODO
};

MOPR

struct MOPR {
 /// TODO
};

MOLT

struct MOLT {
 /// TODO
};

MODS

Every set has a purely descriptive name. It then specifies the first doodad as well as the number of doodads in the given set.

struct MODS {
 char name[20];
 uint32_t firstDoodadIndex;
 uint32_t numberOfDoodads;
 uint32_t unknown;            // ?
};

MODN

struct MODN {
 /// TODO
};

MODD

struct MODD {
 /// TODO
};

MFOG

Contains information about fog inside the WMO. The minimum distance is maxDistance * minDistanceMultiplier. The second set of color is unknown where to be used for me.

struct MFOG {
 uint32_t unknown[6];
 float maxDistance;
 float minDistanceMultiplier;
 uint32_t color;
 float unknown2[2];
 uint32_t color2;
};

MOGP

enum MOGPFlags {
 /// TODO
};
struct MOGP {
 uint32_t groupName;         // Actually the index in the char-array.
 uint32_t groupDescription;  // Index into MOGN as well.
 uint32_t flags;
 float boundingBox[3*2];
 uint16_t unknown1;
 uint16_t unknown2;
 uint16_t portals_index;
 uint16_t portals_used;
 uint8_t fog[4];
 uint32_t liquidType;
 uint32_t batchinfo[16];     // [5] in /v17
 uint32_t wmoGroupID;        // column 4 in WMOAreaTable.dbc
 uint32_t unknown[2];
 MOPY polygonInformation;
 MOVT vertices[nTriangles*3];
 MONR normals[nTriangles*3];
 MOTV textureCoordinates[nTriangles*3];
 MOLV unknown[nTriangles*3];
 MOIN indices[nTriangles*3]; // ntriangles = 12
 MOBA moba[]; // x18 12*
 MOBN moba[]; // x10 8*
 MOBR mobr[]; // x18 12*
 MOCV colors[nTriangles*3];
 MOLM molm[]; // x30 48
 MOLD mold[];
};

MOPY

struct MOPY {
 uint8_t flags;
 int8_t materialID;          // -1 for invisible collision detection mesh
};

bullshit. its

struct MOPY {
 u8 flags;
 u8 unk;	// dont know, sometimes 1 or 2 .. 
 u8 materialID;
 u8 zero;	// padding
}
--Tharo 10:35, 29 July 2011 (UTC)

MOVT

struct MOVT {
 float vertex[3];
};

MONR

struct MONR {
 float normal[3];
};

MOTV

struct MOTV {
 float uv_coords[2];            // Ranging von 0 to 1.
};

These coords can be out of the [0, 1] range.

MOLV

struct MOLV {
 float vector[2];
} lightmapVertexList;

What is this ? MOTV size identical

MOIN

Looks like a list of indices in MOVT

struct MOIN {
 uint16_t index;
};

It's most of the time only a list incrementing from 0 to (nFaces * 3) or less, not always up to nPolygons (calculated with MOPY).

Unlike in WMO/v17 where the faces indices (MOVI) point to a vertex in MOVT, here there are exactly (nFaces * 3) vertices in MOVT, and the client just read them straightforward. If you want to read them, just make nPolygons faces going incrementing, like (0, 1, 2), (3, 4, 5), etc. --Gamhea 15:44, 10 March 2013 (UTC)

MOBA

struct MOBA {
 uint16_t index;
};
public final static int SIZE 		= 0x18;
public final static int ofsTextIndex	= 0x1;	// byte
public final static int ofsStart 	= 0x0C;	// int
public final static int ofsIndCount	= 0x10;	// short
public final static int ofsVertStart	= 0x12; // short
public final static int ofsVertEnd	= 0x14; // short
--Tharo 10:31, 29 July 2011 (UTC)

ofsStart seems to be on 16 bits only :

struct MOBAentry
{
  /* 0x00 */ uint8_t lightMap;
  /* 0x01 */ uint8_t material;
  /* 0x02 */ int16_t bounding_box[6];
  /* 0x0E */ uint16_t face_start;
  /* 0x10 */ uint16_t face_count;
  /* 0x12 */ uint16_t vertex_start;
  /* 0x14 */ uint16_t vertex_end;
  /* 0x16 */ uint8_t flags;
  /* 0x17 */ uint8_t pad;
}; --Gamhea 15:44, 10 March 2013 (UTC)

MOBN

struct MOBN {
 uint16_t index;
};

MOBR

struct MOBR {
 uint16_t index;
};

MOCV

struct MOCV {
 uint32_t color;
};

MOLM

struct MOLM {
 char unk;
};

MOLD

struct MOLD {
 char unk;
};