<?xml version="1.0"?>
<rss version="2.0"><channel><title>Wiki: Wiki</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/?d=4</link><description>Wiki: Wiki</description><language>en</language><item><title>ADT File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/adt-file-r20028/</link><description><![CDATA[<h2>
	Introduction
</h2>

<p>
	ADT Files contain the actual terrain information (height maps, texturing, WMOs, doodads, etc) required by the client to render the static parts of the terrain.<br>
	They use a chunked file structure like WDT Files. Each ADT File contains 256 (16x16) map tiles (or map chunks).<br>
	Each map tile is 33.3333 yards on each side, making the size of the map block in an ADT file 533.3333 yards on each side in total.<br>
	As every WDT File can reference 64x64 ADT map blocks, the whole map is approximately 34133.33 yards on each side. So there will be a few initial data chunks to specify textures, objects, models, etc. followed by 256 MCNK (mapchunk) chunks.<br>
	Each MCNK chunk has a small header of its own, and additional chunks within its data block
</p>

<h2>
	ADT files and blocks
</h2>

<p>
	There is an .adt file for each existing block. If a block is unused it won't have an .adt file. The file will be:<span> </span><strong style="font-weight:bold;margin-bottom:0px;">World/Maps/{InternalMapName}/&lt;{InternalMapName}<em style="font-style:italic;margin-bottom:0px;">{BlockY}</em>{BlockX}.adt.</strong>
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">{InternalMapName} - The second field in Map.dbc
{BlockY} - obtained with the following formula: floor((32 - (y / 533.33333)))
{BlockX} - obtained with the following formula: floor((32 - (x / 533.33333)))</span></pre>

<h2>
	Chunk Definitions
</h2>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MVER
			</td>
			<td style="text-align:center;">
				4 bytes
			</td>
			<td style="text-align:left;">
				Version
			</td>
			<td style="text-align:left;">
				This chunk specifies the format version. All ADT Files in 1.12.X have Version 18.
			</td>
		</tr><tr><td style="text-align:center;">
				MHDR
			</td>
			<td style="text-align:center;">
				64 bytes
			</td>
			<td style="text-align:left;">
				Header
			</td>
			<td style="text-align:left;">
				The Header chunk contains offsets to various other chunks. All offsets are relative to the start of the MHDR data block
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32 flags;    //Known Values: 1 = contains MFBO
04h uint32 offsMCIN;
08h uint32 offsMTEX;
0Ch uint32 offsMMDX;
10h uint32 offsMMID;
14h uint32 offsMWMO;
18h uint32 offsMWID;
1Ch uint32 offsMDDF;
20h uint32 offsMODF;
24h uint32 offsMFBO; // this is only set if flags &amp;1.
28h uint32 offsMH2O;
2Ch uint32 offsMTFX;
30h uint32[4] unused;</span></pre>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td>
				MCIN
			</td>
			<td>
				4096 bytes
			</td>
			<td>
				Chunk Index
			</td>
			<td>
				This is a lookup table containing absolute offsets and sizes for every map tile in the file. There are 16x16 = 256 entries of 16 bytes each:
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32 offsMCNK // absolute offset.
04h uint32 size     // the size of the MCNK chunk, this is refering to.
08h uint32 flags    // these two are always 0. only set in the client.
0Ch uint32 asyncId</span></pre>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MTEX
			</td>
			<td style="text-align:center;">
				Variable
			</td>
			<td style="text-align:left;">
				Texture File Names
			</td>
			<td style="text-align:left;">
				A list of zero-terminated file names for the textures used in this map.
			</td>
		</tr><tr><td style="text-align:center;">
				MMDX
			</td>
			<td style="text-align:center;">
				Variable
			</td>
			<td style="text-align:left;">
				Doodad File Names
			</td>
			<td style="text-align:left;">
				A list of zero-terminated file names for the doodads / models used in this map.
			</td>
		</tr><tr><td style="text-align:center;">
				MMID
			</td>
			<td style="text-align:center;">
				Variable
			</td>
			<td style="text-align:left;">
				Doodad File Name Lookup
			</td>
			<td style="text-align:left;">
				uint32 offsets into the MMDX chunk for every doodad.
			</td>
		</tr><tr><td style="text-align:center;">
				MWMO
			</td>
			<td style="text-align:center;">
				Variable
			</td>
			<td style="text-align:left;">
				WMO File Names
			</td>
			<td style="text-align:left;">
				A list of zero-terminated file names for the WMOs used in this map.
			</td>
		</tr><tr><td style="text-align:center;">
				MWID
			</td>
			<td style="text-align:center;">
				Variable
			</td>
			<td style="text-align:left;">
				WMO File Name Lookup
			</td>
			<td style="text-align:left;">
				uint32 offsets into the MWMO chunk for every doodad.
			</td>
		</tr><tr><td style="text-align:center;">
				MDDF
			</td>
			<td style="text-align:center;">
				nDoodad * 36 bytes
			</td>
			<td style="text-align:left;">
				Doodad Definition
			</td>
			<td style="text-align:left;">
				Placement Information for Doodads.
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32   mmidEntry; // references an entry in the MMID chunk, specifying the model to use.
04h uint32   uniqueId;  // this ID should be unique for all ADTs currently loaded. 
                        // Blizzard has these unique for the whole game.
08h float[3] position;
14h float[3] rotation;  // degrees.
20h uint16   scale;     // 1024 is the default size equaling 1.0f.
22h uint16   flags;     // values from enum MDDFFlags.</span></pre>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MODF
			</td>
			<td style="text-align:center;">
				nWMO * 64 bytes
			</td>
			<td style="text-align:left;">
				WMO Definition
			</td>
			<td style="text-align:left;">
				Placement Information for World Map Objects
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32   mwidEntry;   // references an entry in the MWID chunk, specifying the model to use.
04h uint32   uniqueId;    // unique ID for the whole map.
08h float[3] position;
14h float[3] rotation;    // same as in MDDF.
20h float[3] lowerBounds; // these two are position plus the wmo bounding box.
2Ch float[3] upperBounds; // they are used for defining when if they are rendered as well as collision.
38h uint16   flags;
3Ah uint16   doodadSet;   // which WMO doodad set is used.
3Ch uint16   nameSet;     // which WMO name set is used. 
                          // Used for renaming goldshire inn to northshire inn while using the same model.
3Eh uint16   padding;</span></pre>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MCNK
			</td>
			<td style="text-align:center;">
				128 byte header + variable data
			</td>
			<td style="text-align:left;">
				Map Chunk Data
			</td>
			<td style="text-align:left;">
				After the general information above 256 MCNK chunks follow. Each of these has a header followed by subchunks. Subchunks mostly behave like normal file chunks, except for some flakyness in their chunk size values.
			</td>
		</tr></tbody></table><p>
	The header looks like this:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32      flags;         // 1h=has MCSH, 2h=impassible, 4h=River, 8h=Ocean, 10h=Magma, 
                               // 20h=Slime, 40h=has MCCV
04h uint32      IndexX;
08h uint32      IndexY;
0Ch uint32      nLayers;       // maximum 4
10h uint32      nDoodadRefs;
14h uint32      ofsMCVT;       // offsets to various chunks. Relative to the beginning of the MCNK Chunk
18h uint32      ofsMCNR;
1Ch uint32      ofsMCLY;
20h uint32      ofsMCRF;
24h uint32      ofsMCAL;
28h uint32      sizeAlpha;
2Ch uint32      ofsMCSH;        // only with flags &amp; 0x1
30h uint32      sizeShadow;
34h uint32      areaid;
38h uint32      nMapObjRefs;
3Ch uint32      holes;
40h uint2[8][8] ReallyLowQualityTextureingMap; // the content is the layer being on top, I guess.
50h uint32      predTex;         // ???
54h uint32      noEffectDoodad;  // ???
58h uint32      ofsMCSE;
5Ch uint32      nSndEmitters;    // will be set to 0 in the client if ofsSndEmitters doesn't point to MCSE!
60h uint32      ofsMCLQ;
64h uint32      sizeLiquid;      // 8 when not used; only read if &gt;8.
68h float[3]    position;
74h uint32      ofsMCCV;         // only with flags &amp; 0x20, had uint32 textureId;
78h uint32      ofsMCLV;         // introduced in Cataclysm
7Ch uint32      unused;          // currently unused</span></pre>

<p>
	About the holes in the terrain: This is a bitmapped field, the least significant 16 bits are used row-wise in the following arrangement with a 1 bit meaning that the map chunk has a hole in that part of its area: 0x1 0x2 0x4 0x8 0x10 0x20 0x40 0x80 0x100 0x200 0x400 0x800 0x1000 0x2000 0x4000 0x8000
</p>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MCVT
			</td>
			<td style="text-align:center;">
				580 bytes
			</td>
			<td style="text-align:left;">
				Subchunk
			</td>
			<td style="text-align:left;">
				These are the actual height values for the 9x9+8x8 vertices. 145 floats in the following order/arrangement:. The values in here are only relative to the position given in the corresponding MCNK chunk.
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">  1   2   3   4   5   6   7   8   9
   10  11  12  13  14  15  16  17
 18  19  20  21  22  23  24  25  26
   27  28  29  30  31  32  33  34
 35  36  37  38  39  40  41  42  43
   44  45  46  47  48  49  50  51
 52  53  54  55  56  57  58  59  60
   61  62  63  64  65  66  67  68
 69  70  71  72  73  74  75  76  77
   78  79  80  81  82  83  84  85
 86  87  88  89  90  91  92  93  94
   95  96  97  98  99 100 101 102
103 104 105 106 107 108 109 110 111
  112 113 114 115 116 117 118 119
120 121 122 123 124 125 126 127 128
  129 130 131 132 133 134 135 136
137 138 139 140 141 142 143 144 145</span></pre>

<p>
	WoW uses Squares out of 4 of the Outer(called NoLoD)-Vertices with one of the Inner(called LoD)-Vertices in the Center:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln"> 1  2
  10
18 19</span></pre>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MCNR
			</td>
			<td style="text-align:center;">
				435 bytes + 13 bytes of unknown data
			</td>
			<td style="text-align:left;">
				Subchunk - Normals
			</td>
			<td style="text-align:left;">
				9x9 + 8x8 surface normals, laid out as in the MCVT chunk.<br>
				int8[3] normal; // normalized. X, Y, Z. 127 == 1.0, -127 == -1.0.<br>
				This chunk has 13 bytes of unknown data at the end. The chunk size only covers the normals, though.
			</td>
		</tr></tbody></table><p>
	 
</p>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MCLY
			</td>
			<td style="text-align:center;">
				1-4 layers * 16 bytes
			</td>
			<td style="text-align:left;">
				Subchunk - Texture Layers
			</td>
			<td style="text-align:left;">
				See Below.
			</td>
		</tr></tbody></table><p>
	These are texture layer definitions for this map chunk. 16 bytes per layer, up to 4 layers. Every texture layer other than the first will have an alpha map to specify blending amounts. The first layer is rendered with full opacity. To know which alphamap is used, there is an offset into the MCAL chunk. That one is relative to MCAL. You can animate these by setting the flags. Only simple linear animations are possible. You can specify the direction in 45° steps and the speed. The textureId is just the array index of the filename array in the MTEX chunk. The effectId links to GroundEffectTexture.dbc. It defines the little detaildoodads as well as the footstep sounds and if footprints are visible.
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32 textureId;
04h uint32 flags;
08h uint32 offsetInMCAL;
0Ch int32  effectId;    // (actually int16 and padding)</span></pre>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	Flags
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Flag  Description
------------------------------------------------------------------------------
0x001 Animation: Rotate 45° clockwise.
0x002 Animation: Rotate 90° clockwise.
0x004 Animation: Rotate 180° clockwise.
0x008 Animation: Make this faster.
0x010 Animation: Faster!!
0x020 Animation: Even Faster!!
0x040 Animation: Animate this texture as told in the other bits.
0x080 This will make the texture way brighter. Used for lava to make it "glow".
0x100 Use alpha map - set for every layer after the first
0x200 Alpha map is compressed</span></pre>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MCRF
			</td>
			<td style="text-align:center;">
				Variable
			</td>
			<td style="text-align:left;">
				Subchunk
			</td>
			<td style="text-align:left;">
				See #1 Below.
			</td>
		</tr><tr><td style="text-align:center;">
				MCSH
			</td>
			<td style="text-align:center;">
				512 bytes
			</td>
			<td style="text-align:left;">
				Subchunk
			</td>
			<td style="text-align:left;">
				See #2 Below.
			</td>
		</tr><tr><td style="text-align:center;">
				MCAL
			</td>
			<td style="text-align:center;">
				0-3 layers * 2048 bytes
			</td>
			<td style="text-align:left;">
				Subchunk - Alpha maps
			</td>
			<td style="text-align:left;">
				See #3 Below.
			</td>
		</tr><tr><td style="text-align:center;">
				MCLQ
			</td>
			<td style="text-align:center;">
				???? Unknown
			</td>
			<td style="text-align:left;">
				Subchunk - Liquids
			</td>
			<td style="text-align:left;">
				See #4 Below.
			</td>
		</tr></tbody></table><p>
	#1. A uint32 list of with MCNK.nDoodadRefs + MCNK.nMapObjRefs indices into the file's MDDF and MODF chunks, saying which MCNK subchunk those particular doodads and objects are drawn within. This MCRF list contains duplicates for map doodads that overlap areas. As both, WMOs and M2s are referenced here, they get doodad indices first, then WMOs. If you have a doodad and a WMO in the ADT as well as the MCNK, you will have a {0,0} in MCRF with nDoodadRefs and MCNK.nMapObjRefs being 1.
</p>

<p>
	#2. Shadow map for static shadows on the terrain. Can be left out with the chunk&amp;1 flag not set. The shadow maps work as follows: the shadows are stored per bit as 0 or 1 (off or on) so we have 8 bytes (which equates to 64 values) X 64 bytes (64 values in this case) which ends up as a square 64x64 shadowmap with either white or black. Note that the shadow values come LSB first.
</p>

<p>
	#3. These are alpha maps for additional texture layers beside the base layer. Each layer contains a 64x64 alpha map. There are 2 alpha values per byte, first 4 bits and second 4 bits. Results in 2048 bytes per layer.
</p>

<p>
	#4. The size of the chunk is in the mapchunk header. The type of liquid is given in the mapchunk flags, also in the header.<span> </span><strong style="font-weight:bold;margin-bottom:0px;">This information is old and incomplete as well as maybe wrong.</strong><span> </span>The first two floats specify the minimum and maximum liquid height level. After them comes a 9x9 height map for the water with the following format per vertex:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">0x00 int16 ?
0x02 int16 ?
0x04 float height value</span></pre>

<p>
	The unknown int values might be color or transparency info, or something entirely different... Most frequently they are 0. Followed by 8x8 bytes of flags for every liquid "tile" between the 9x9 vertex grid. The value 0x0F means do not render. (the specific flag for this seems to be 8 but I'm not sure - but it fixes some places where there was extra "water" sticking into the rest of the scenery) Finally, 0x54 bytes of additional data, no idea what it's used for.
</p>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MCSE
			</td>
			<td style="text-align:center;">
				???? Unknown, See Below.
			</td>
			<td style="text-align:left;">
				Subchunk - Sound Emitters
			</td>
			<td style="text-align:left;">
				This is not well understood. Struct from WoWDev Wiki below.
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32 soundPointID;
04h uint32 soundNameID;
08h float[3] pos;
0Ch
10h
14h float minDistance;
18h float maxDistance;
1Ch float cutoffDistance;
20h uint16 startTime;
22h uint16 endTime;
24h uint16 groupSilenceMin;
26h uint16 groupSilenceMax;
28h uint16 playInstancesMin;
2Ah uint16 playInstancesMax;
2Ch uint16 loopCountMin;
2Eh uint16 loopCountMax;
30h uint16 interSoundGapMin;
32h uint16 interSoundGapMax;</span></pre>
]]></description><guid isPermaLink="false">20028</guid><pubDate>Mon, 01 Aug 2016 12:09:01 +0000</pubDate></item><item><title>BLP File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/blp-file-r20040/</link><description><![CDATA[<h2>
	Introduction
</h2>

<p>
	BLP files are used as texture storage. The textures can be stored with a 256 color palette or full 24bit RGB colors. The format supports 1, 4 and 8-bit alpha transparency and DXT compression. The file format is NOT chunked. Wikipedia has a nice overview over the format:<span> </span><a href="http://en.wikipedia.org/wiki/.BLP" rel="external nofollow" style="color:rgb(0,104,222);text-decoration:none;margin-bottom:0px;">http://en.wikipedia.org/wiki/.BLP</a>
</p>

<h2>
	Header
</h2>

<p>
	From<span> </span><a href="http://www.pxr.dk/wowdev/wiki/index.php?title=BLP" rel="external nofollow" style="color:rgb(0,104,222);text-decoration:none;margin-bottom:0px;">http://www.pxr.dk/wowdev/wiki/index.php?title=BLP</a>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset Type        Description
------------------------------------------------------------------------------------------
0x00   char[4]     always 'BLP2'
0x04   uint32      Type, always 1
0x08   uint8       Compression: 1 for uncompressed, 2 for DXTC
0x09   uint8       Alpha channel bit depth: 0, 1 or 8
0x0A   uint8       Alpha encoding 0x0B uint8 Has MipMaps? 
0x0C   uint32      X resolution (power of 2)
0x10   uint32      Y resolution (power of 2)
0x14   uint32[16]  offsets for every mipmap level (or 0 when there is no more mipmap level)
0x54   uint32[16]  sizes for every mipmap level (or 0 when there is no more mipmap level)
0x94   uint32[256] palette of 256 BGRA Values</span></pre>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	 
</p>

<p>
	If HasMipMaps is 0, there is only 1 mipmap level. The palette is always present, even if it is not used. In that case all values are 0.
</p>

<h2>
	Encoding Schemes
</h2>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Type 1 Compression 1 AlphaDepth 0 (uncompressed paletted image with no alpha)</strong>
</p>

<p>
	Each byte of the image data is an index into Palette which contains the actual RGB value for the pixel. Although the palette entries are 32-bits, the alpha value of each Palette entry may contain garbage and should be discarded.
</p>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Type 1 Compression 1 AlphaDepth 1 (uncompressed paletted image with 1-bit alpha)</strong>
</p>

<p>
	This is the same as Type 1 Encoding 1 AlphaDepth 0 except that immediately following the index array is a second image array containing 1-bit alpha values for each pixel. The first byte of the array is for pixels 0 through 7, the second byte for pixels 8 through 15 and so on. Bit 0 of each byte corresponds to the first pixel (leftmost) in the group, bit 7 to the rightmost. A set bit indicates the pixel is opaque while a zero bit indicates a transparent pixel.
</p>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Type 1 Compression 1 AlphaDepth 8 (uncompressed paletted image with 8-bit alpha)</strong>
</p>

<p>
	This is the same as Type 1 Encoding 1 AlphaDepth 0 except that immediately following the index array is a second image array containing the actual 8-bit alpha values for each pixel. This second array starts at<span> </span><strong style="font-weight:bold;margin-bottom:0px;">BLP2Header.Offset[0] + BLP2Header.Width * BLP2Header.Height</strong>.
</p>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Type 1 Compression 2 AlphaDepth 0 (DXT1 no alpha)</strong>
</p>

<p>
	The image data are formatted using DXT1 compression with no alpha channel.
</p>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Type 1 Compression 2 AlphaDepth 1 (DXT1 one bit alpha)</strong>
</p>

<p>
	The image data are formatted using DXT1 compression with a one-bit alpha channel.
</p>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Type 1 Compression 2 AlphaDepth 4 AlphaEncoding 1 (DXT3 four bits alpha)</strong>
</p>

<p>
	The image data are formatted using DXT3 compression.
</p>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Type 1 Compression 2 AlphaDepth 8 AlphaEncoding 1 (DXT3 eight bits alpha)</strong>
</p>

<p>
	The image data are formatted using DXT3 compression.
</p>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Type 1 Compression 2 AlphaDepth 8 AlphaEncoding 7 (DXT5)</strong>
</p>

<p>
	The image data are formatted using DXT5 compression.
</p>

<h2>
	DXT Compression
</h2>

<p>
	BLP only uses DXT 1,3 and 5. From:<span> </span><a href="http://en.wikipedia.org/wiki/DXTn" rel="external nofollow" style="color:rgb(0,104,222);text-decoration:none;margin-bottom:0px;">http://en.wikipedia.org/wiki/DXTn</a>
</p>

<h3>
	DXT1
</h3>

<p>
	DXT1 (also known as Block Compression 1 or BC1) is the smallest variation of S3TC, storing 16 input pixels in 64 bits of output, consisting of two 16-bit RGB 5:6:5 colour values and a 4x4 two bit lookup table.
</p>

<p>
	If the first colour value (c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;">0</sub>) is numerically greater than the second colour value (c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;">1</sub>), then two other colours are calculated, such that
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	<span class="pln" style="color:rgb(72,72,76);">c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">2</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">2</span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="lit" style="color:rgb(25,95,145);">3</span><span class="pln" style="color:rgb(72,72,76);"> c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">1</span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="lit" style="color:rgb(25,95,145);">3</span><span class="pln" style="color:rgb(72,72,76);"> c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">1</span></sub></p>

<p>
	and
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	<span class="pln" style="color:rgb(72,72,76);">c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">3</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">1</span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="lit" style="color:rgb(25,95,145);">3</span><span class="pln" style="color:rgb(72,72,76);"> c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">2</span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="lit" style="color:rgb(25,95,145);">3</span><span class="pln" style="color:rgb(72,72,76);"> c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">1</span></sub></p>

<p>
	Otherwise, if c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;">0</sub><span> </span>&lt;= c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;">1</sub>, then
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	<span class="pln" style="color:rgb(72,72,76);">c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">2</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">1</span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="lit" style="color:rgb(25,95,145);">2</span><span class="pln" style="color:rgb(72,72,76);"> c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">1</span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="lit" style="color:rgb(25,95,145);">2</span><span class="pln" style="color:rgb(72,72,76);"> c</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;"><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">1</span></sub></p>

<p>
	and c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;">3</sub><span> </span>is transparent black corresponding to a pre-multiplied alpha format.
</p>

<p>
	The lookup table is then consulted to determine the colour value for each pixel, with a value of 0 corresponding to c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;">0</sub><span> </span>and a value of 3 corresponding to c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;">3</sub><span> </span>. DXT1 does not store alpha data enabling higher compression ratios.
</p>

<h3>
	DXT3
</h3>

<p>
	DXT3 (also known as Block Compression 2 or BC2) converts 16 input pixels (corresponding to a 4x4 pixel block) into 128 bits of output, consisting of 64 bits of alpha channel data (4 bits for each pixel) followed by 64 bits of colour data, encoded the same way as DXT1 (with the exception that the 4 colour version of the DXT1 algorithm is always used instead of deciding which version to use based on the relative values of c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;">0</sub><span> </span>and c<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;">1</sub><span> </span>).
</p>

<p>
	In DXT3, the colour data is interpreted as not having been pre-multiplied by alpha. Typically DXT2/3 are well suited to images with sharp alpha transitions, between translucent and opaque areas.
</p>

<h3>
	DXT5
</h3>

<p>
	DXT5 (also known as Block Compression 3 or BC3) converts 16 input pixels into 128 bits of output, consisting of 64 bits of alpha channel data (two 8 bit alpha values and a 4x4 3 bit lookup table) followed by 64 bits of colour data (encoded the same way as DXT2 and DXT3).
</p>

<p>
	If α<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;">0</sub><span> </span>&gt; α<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;">1</sub>, then six other alpha values are calculated, such that
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">2</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">6</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">1</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">7</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">3</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">5</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">2</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">7</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">,</span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">4</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">4</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">3</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">7</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">5</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">3</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">4</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">7</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">6</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">2</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">5</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">7</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">7</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">1</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">6</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">7</span>
</p>

<p>
	Otherwise, if α<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;">0</sub><span> </span>&lt;= α<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;">1</sub>, four other alpha values are calculated such that
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">2</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">4</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">1</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">5</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">3</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">3</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">2</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">5</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">4</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">2</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">3</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">5</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">5</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">1</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">0</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">+</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">4</span><span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">1</span></sub><span class="pun" style="color:rgb(147,161,161);">)</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">/</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">5</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">,</span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">6</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">0</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">,</span>
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	<span class="pun" style="color:rgb(147,161,161);">α</span><sub style="font-size:9.75px;line-height:0;vertical-align:baseline;"><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">7</span></sub><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);margin-bottom:0px;">255</span>
</p>

<p>
	The lookup table is then consulted to determine the alpha value for each pixel, with a value of 0 corresponding to α<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;">0</sub><span> </span>and a value of 7 corresponding to α<sub style="font-size:9.75px;line-height:0;vertical-align:baseline;margin-bottom:0px;">7</sub>. DXT5's colour data is not pre-multiplied by alpha. Because DXT4/5 use an interpolated alpha scheme, they generally produce superior results for alpha (transparency) gradients than DXT2/3.
</p>
]]></description><guid isPermaLink="false">20040</guid><pubDate>Mon, 01 Aug 2016 20:21:40 +0000</pubDate></item><item><title>BLS</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/bls-r20039/</link><description><![CDATA[<p>
	BLS specify specific instructions to the video card as to how to render parts of the world and how to do certain effects.
</p>

<p>
	There are two major types of shaders: fragment shaders (also known as pixel shaders) and vertex shaders. Fragment shaders are executed on a per-pixel basis, thus can influence texture fetching and combining operations, whereas vertex shaders are executed on a per-vertex basis. These can change vertex positions to achieve mesh animation, particle systems, and texture animation.
</p>

<p>
	BLS files can be found under Shaders\Pixel as well as Shaders\Vertex. They are refernced from [[WFX]] files as well as directly from WoW.exe, so there is no client database pointing to them.
</p>

<p>
	There are different types of shaders.
</p>

<ul><li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">*</span><span style="color:#008080;">Vertex</span><span class="pln" style="color:rgb(72,72,76);"> shaders</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">:</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">arbvp1</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">arbvp1_cg12</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">vs_1_1</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">vs_2_0</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">vs_3_0</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">*</span><span style="color:#008080;">Pixel</span><span class="pln" style="color:rgb(72,72,76);"> shaders</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">:</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">arbfp1</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">nvrc</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">nvts</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">ps_1_1</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">ps_1_4</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">ps_2_0</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">**</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;">ps_3_0</span></code>
	</li>
</ul><p>
	They are sorted in folders as of 3.*. Previously, there were no different folders but an additional header in the files defining the type.
</p>

<h3>
	Header
</h3>

<ul><li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">*</span><span style="color:#008080;">Main</span><span class="pln" style="color:rgb(72,72,76);"> header </span><span class="pun" style="color:rgb(147,161,161);">(</span><span class="lit" style="color:rgb(25,95,145);">0xC</span><span class="pln" style="color:rgb(72,72,76);"> bytes</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">)</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span style="color:#008080;">This</span><span class="pln" style="color:rgb(72,72,76);"> header </span><span class="kwd" style="color:rgb(30,52,123);">is</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="kwd" style="color:rgb(30,52,123);">in</span><span class="pln" style="color:rgb(72,72,76);"> all files </span><span class="pun" style="color:rgb(147,161,161);">-</span><span class="pln" style="color:rgb(72,72,76);"> pixel </span><span class="kwd" style="color:rgb(30,52,123);">and</span><span class="pln" style="color:rgb(72,72,76);"> vertex shaders </span><span class="kwd" style="color:rgb(30,52,123);">in</span><span class="pln" style="color:rgb(72,72,76);"> all profiles</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">.</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="kwd" style="color:rgb(30,52,123);">struct</span><span class="pln" style="color:rgb(72,72,76);"> </span><span style="color:#008080;">BLSHeader</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">{</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x00*/</span><span class="str" style="color:rgb(221,17,68);">''</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="kwd" style="color:rgb(30,52,123);">char</span><span class="pun" style="color:rgb(147,161,161);">[</span><span class="lit" style="color:rgb(25,95,145);">4</span><span class="pun" style="color:rgb(147,161,161);">]</span><span class="pln" style="color:rgb(72,72,76);"> magix</span><span class="pun" style="color:rgb(147,161,161);">;</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="com" style="color:rgb(147,161,161);margin-bottom:0px;">// in reverse character order: "SVXG" in case of a vertex shader, "SPXG" in case of a fragment shader</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x04*/</span><span class="str" style="color:rgb(221,17,68);">''</span><span class="pln" style="color:rgb(72,72,76);"> uint32 version</span><span class="pun" style="color:rgb(147,161,161);">;</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="com" style="color:rgb(147,161,161);margin-bottom:0px;">// Always 0x10003 - version 1.3 of format</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x08*/</span><span class="str" style="color:rgb(221,17,68);">''</span><span class="pln" style="color:rgb(72,72,76);"> uint32 permutationCount</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">;</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x0C*/</span><span class="str" style="color:rgb(221,17,68);margin-bottom:0px;">''</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">};</span></code>
	</li>
</ul><h3>
	Blocks
</h3>

<ul><li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span style="color:#008080;">There</span><span class="pln" style="color:rgb(72,72,76);"> are permutationCount blocks of the following structure</span><span class="pun" style="color:rgb(147,161,161);">.</span><span class="pln" style="color:rgb(72,72,76);"> </span><span style="color:#008080;">They</span><span class="pln" style="color:rgb(72,72,76);"> are padded to </span><span class="lit" style="color:rgb(25,95,145);">0x</span><span class="pun" style="color:rgb(147,161,161);">*</span><span class="lit" style="color:rgb(25,95,145);">0</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">0x</span><span class="pun" style="color:rgb(147,161,161);">*</span><span class="lit" style="color:rgb(25,95,145);">4</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">0x</span><span class="pun" style="color:rgb(147,161,161);">*</span><span class="lit" style="color:rgb(25,95,145);">8</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="kwd" style="color:rgb(30,52,123);">and</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">0x</span><span class="pun" style="color:rgb(147,161,161);">*</span><span class="pln" style="color:rgb(72,72,76);">C</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">.</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="kwd" style="color:rgb(30,52,123);">struct</span><span class="pln" style="color:rgb(72,72,76);"> </span><span style="color:#008080;">BLSBlock</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">{</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x00*/</span><span class="str" style="color:rgb(221,17,68);">''</span><span class="pln" style="color:rgb(72,72,76);"> DWORD flags0</span><span class="pun" style="color:rgb(147,161,161);">;</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="com" style="color:rgb(147,161,161);margin-bottom:0px;">// seen: 0x3FE80 in pixel shaders; 0x1A0F in vertex shaders. there may be more ..</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x04*/</span><span class="str" style="color:rgb(221,17,68);">''</span><span class="pln" style="color:rgb(72,72,76);"> DWORD flags4</span><span class="pun" style="color:rgb(147,161,161);">;</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="com" style="color:rgb(147,161,161);margin-bottom:0px;">// seen: 0x200 in pixel shaders; 0x3FEC1 in vertex shaders (there may be more ..)</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x08*/</span><span class="str" style="color:rgb(221,17,68);">''</span><span class="pln" style="color:rgb(72,72,76);"> DWORD unk8</span><span class="pun" style="color:rgb(147,161,161);">;</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="com" style="color:rgb(147,161,161);margin-bottom:0px;">// Never seen anything in here.</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x0C*/</span><span class="str" style="color:rgb(221,17,68);">''</span><span class="pln" style="color:rgb(72,72,76);"> uint32 size</span><span class="pun" style="color:rgb(147,161,161);">;</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="com" style="color:rgb(147,161,161);margin-bottom:0px;">// Tells you how large the block actually is.</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*0x10*/</span><span class="str" style="color:rgb(221,17,68);">''</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="kwd" style="color:rgb(30,52,123);">char</span><span class="pln" style="color:rgb(72,72,76);"> data</span><span class="pun" style="color:rgb(147,161,161);">[</span><span class="pln" style="color:rgb(72,72,76);">size</span><span class="pun" style="color:rgb(147,161,161);">];</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="com" style="color:rgb(147,161,161);margin-bottom:0px;">// In whatever format defined.</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);">''</span><span class="com" style="color:rgb(147,161,161);">/*----*/</span><span class="str" style="color:rgb(221,17,68);margin-bottom:0px;">''</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">};</span></code>
	</li>
</ul>]]></description><guid isPermaLink="false">20039</guid><pubDate>Mon, 01 Aug 2016 20:21:18 +0000</pubDate></item><item><title>Client File Formats Summary</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/client-file-formats-summary-r20026/</link><description><![CDATA[<h3>
	Archive and compression
</h3>

<p>
	MPQ Files: archive format.
</p>

<p>
	Chunked Format Data Files
</p>

<p>
	DBC Files: DBC/DB2 files content layouts.
</p>

<p>
	DNC.db: Day-Night cycle specification.
</p>

<p>
	LIT Files: lighting information.
</p>

<p>
	SBT Files: cinematic subtitles.
</p>

<p>
	TRS Files: minimap hash translation.
</p>

<p>
	WDB Files: client data cache.
</p>

<h3>
	Graphics
</h3>

<p>
	BLP Files: texture format, supporting texture compression, and multiple resolutions.
</p>

<p>
	BLS Files: instructions for pixel and vertex shaders.
</p>

<p>
	M2 Files: Blizzard Entertainment's own model format, also known as '''.mdx'''.
</p>

<p>
	WFX Files: assigns shaders to surfaces.
</p>

<p>
	WMO Files: World Map Object file, containing either a group definition or a single world map object.
</p>

<h3>
	Map Data
</h3>

<p>
	ADT Files: terrain and object information for map tiles.
</p>

<p>
	WDL Files: low-resolution height maps.
</p>

<p>
	<a href="wdt-file-r20027/" rel="external">WDT</a> Files: map and object placement information.
</p>

<p>
	<a href="zmp-files-r20025/" rel="external">ZMP</a> Files: map tile reference.
</p>
]]></description><guid isPermaLink="false">20026</guid><pubDate>Mon, 01 Aug 2016 10:29:12 +0000</pubDate></item><item><title>Dnc.db File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/dncdb-file-r20038/</link><description><![CDATA[<h2>
	Introduction
</h2>

<p>
	dnc.db specifies the day-night cycle. It hasn't changed in any way from 1.0 or even 0.*.<br>
	This looks like info for outdoor lighting with respect to the day-night cycle.<br>
	The colors for the different light types are self-explanatory.<br>
	The XYZ coordinates specify a directional light source.
</p>

<h2>
	Header
</h2>

<p>
	8 bytes at the beginning of the file specify the number of rows (including head row) and columns
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32 Number of Rows
04h uint32 Number of Columns</span></pre>

<h2>
	Data
</h2>

<p>
	Each data field has exactly 8 bytes.
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h uint32 Field Type (0x53=S for String, 0x46=F for Float)
04h uint32 Field Value</span></pre>

<p>
	String value types are offsets into a Block of Zero-Terminated strings at the end of the file.
</p>

<h2>
	File contents
</h2>

<p>
	Extracted and Formatted for a better overview.
</p>

<table cellpadding="5" cellspacing="5" width="100%"><tbody style="margin-bottom:0px;"><tr><th style="text-align:left;">
				Hour
			</th>
			<th style="text-align:left;">
				Minute
			</th>
			<th style="text-align:left;">
				DayIntensity
			</th>
			<th style="text-align:left;">
				DayR
			</th>
			<th style="text-align:left;">
				DayG
			</th>
			<th style="text-align:left;">
				DayB
			</th>
			<th style="text-align:left;">
				DayX
			</th>
			<th style="text-align:left;">
				DayY
			</th>
			<th style="text-align:left;margin-bottom:0px;">
				DayZ
			</th>
		</tr><tr><td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				1.0
			</td>
		</tr><tr><td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.3
			</td>
			<td style="margin-bottom:0px;">
				1.0
			</td>
		</tr><tr><td>
				2.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.5
			</td>
			<td style="margin-bottom:0px;">
				0.9
			</td>
		</tr><tr><td>
				3.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.7
			</td>
			<td style="margin-bottom:0px;">
				0.7
			</td>
		</tr><tr><td>
				4.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.9
			</td>
			<td style="margin-bottom:0px;">
				0.5
			</td>
		</tr><tr><td>
				5.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-1.0
			</td>
			<td style="margin-bottom:0px;">
				0.3
			</td>
		</tr><tr><td>
				6.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.5
			</td>
			<td>
				0.5
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				-1.0
			</td>
			<td style="margin-bottom:0px;">
				0.0
			</td>
		</tr><tr><td>
				7.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.5
			</td>
			<td>
				0.5
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				-1.0
			</td>
			<td style="margin-bottom:0px;">
				-0.3
			</td>
		</tr><tr><td>
				8.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.6
			</td>
			<td>
				0.6
			</td>
			<td>
				0.6
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.9
			</td>
			<td style="margin-bottom:0px;">
				-0.5
			</td>
		</tr><tr><td>
				9.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.6
			</td>
			<td>
				0.6
			</td>
			<td>
				0.6
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.7
			</td>
			<td style="margin-bottom:0px;">
				-0.7
			</td>
		</tr><tr><td>
				10.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.5
			</td>
			<td style="margin-bottom:0px;">
				-0.9
			</td>
		</tr><tr><td>
				11.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.3
			</td>
			<td style="margin-bottom:0px;">
				-1.0
			</td>
		</tr><tr><td>
				12.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				-1.0
			</td>
		</tr><tr><td>
				13.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.3
			</td>
			<td style="margin-bottom:0px;">
				-1.0
			</td>
		</tr><tr><td>
				14.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.5
			</td>
			<td style="margin-bottom:0px;">
				-0.9
			</td>
		</tr><tr><td>
				15.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td style="margin-bottom:0px;">
				-0.7
			</td>
		</tr><tr><td>
				16.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.9
			</td>
			<td style="margin-bottom:0px;">
				-0.5
			</td>
		</tr><tr><td>
				17.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.8
			</td>
			<td>
				0.5
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				1.0
			</td>
			<td style="margin-bottom:0px;">
				-0.3
			</td>
		</tr><tr><td>
				18.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.6
			</td>
			<td>
				0.3
			</td>
			<td>
				0.3
			</td>
			<td>
				0.7
			</td>
			<td>
				1.0
			</td>
			<td style="margin-bottom:0px;">
				0.0
			</td>
		</tr><tr><td>
				19.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.4
			</td>
			<td>
				0.1
			</td>
			<td>
				0.1
			</td>
			<td>
				0.7
			</td>
			<td>
				1.0
			</td>
			<td style="margin-bottom:0px;">
				0.3
			</td>
		</tr><tr><td>
				20.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.2
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.9
			</td>
			<td style="margin-bottom:0px;">
				0.5
			</td>
		</tr><tr><td>
				21.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td style="margin-bottom:0px;">
				0.7
			</td>
		</tr><tr><td>
				22.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.5
			</td>
			<td style="margin-bottom:0px;">
				0.9
			</td>
		</tr><tr style="margin-bottom:0px;"><td>
				23.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.3
			</td>
			<td style="margin-bottom:0px;">
				1.0
			</td>
		</tr></tbody></table><p>
	 
</p>

<table cellpadding="5" cellspacing="5" width="100%"><tbody style="margin-bottom:0px;"><tr><th style="text-align:left;">
				Hour
			</th>
			<th style="text-align:left;">
				Minute
			</th>
			<th style="text-align:left;">
				NightIntensity
			</th>
			<th style="text-align:left;">
				NightR
			</th>
			<th style="text-align:left;">
				NightG
			</th>
			<th style="text-align:left;">
				NightB
			</th>
			<th style="text-align:left;">
				NightX
			</th>
			<th style="text-align:left;">
				NightY
			</th>
			<th style="text-align:left;">
				NightZ
			</th>
		</tr><tr><td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				-1.0
			</td>
		</tr><tr><td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				0.3
			</td>
			<td style="margin-bottom:0px;">
				-1.0
			</td>
		</tr><tr><td>
				2.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				0.5
			</td>
			<td style="margin-bottom:0px;">
				-0.9
			</td>
		</tr><tr><td>
				3.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td style="margin-bottom:0px;">
				-0.7
			</td>
		</tr><tr><td>
				4.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				0.9
			</td>
			<td style="margin-bottom:0px;">
				-0.5
			</td>
		</tr><tr><td>
				5.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				1.0
			</td>
			<td style="margin-bottom:0px;">
				-0.3
			</td>
		</tr><tr><td>
				6.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				1.0
			</td>
			<td style="margin-bottom:0px;">
				0.0
			</td>
		</tr><tr><td>
				7.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				1.0
			</td>
			<td style="margin-bottom:0px;">
				0.3
			</td>
		</tr><tr><td>
				8.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.9
			</td>
			<td style="margin-bottom:0px;">
				0.5
			</td>
		</tr><tr><td>
				9.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td style="margin-bottom:0px;">
				0.7
			</td>
		</tr><tr><td>
				10.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.5
			</td>
			<td style="margin-bottom:0px;">
				0.9
			</td>
		</tr><tr><td>
				11.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.3
			</td>
			<td style="margin-bottom:0px;">
				1.0
			</td>
		</tr><tr><td>
				12.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				1.0
			</td>
		</tr><tr><td>
				13.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.3
			</td>
			<td style="margin-bottom:0px;">
				1.0
			</td>
		</tr><tr><td>
				14.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.5
			</td>
			<td style="margin-bottom:0px;">
				0.9
			</td>
		</tr><tr><td>
				15.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.7
			</td>
			<td style="margin-bottom:0px;">
				0.7
			</td>
		</tr><tr><td>
				16.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.9
			</td>
			<td style="margin-bottom:0px;">
				0.5
			</td>
		</tr><tr><td>
				17.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-1.0
			</td>
			<td style="margin-bottom:0px;">
				0.3
			</td>
		</tr><tr><td>
				18.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-1.0
			</td>
			<td style="margin-bottom:0px;">
				0.0
			</td>
		</tr><tr><td>
				19.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-1.0
			</td>
			<td style="margin-bottom:0px;">
				-0.3
			</td>
		</tr><tr><td>
				20.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.9
			</td>
			<td style="margin-bottom:0px;">
				-0.5
			</td>
		</tr><tr><td>
				21.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.7
			</td>
			<td style="margin-bottom:0px;">
				-0.7
			</td>
		</tr><tr><td>
				22.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.5
			</td>
			<td style="margin-bottom:0px;">
				-0.9
			</td>
		</tr><tr style="margin-bottom:0px;"><td>
				23.0
			</td>
			<td>
				0.0
			</td>
			<td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.7
			</td>
			<td>
				-0.3
			</td>
			<td style="margin-bottom:0px;">
				-1.0
			</td>
		</tr></tbody></table><p>
	 
</p>

<table cellpadding="5" cellspacing="5" width="100%"><tbody><tr><th style="text-align:left;">
				Hour
			</th>
			<th style="text-align:left;">
				Minute
			</th>
			<th style="text-align:left;">
				Ambient<br style="margin-bottom:0px;">
				Intensity
			</th>
			<th style="text-align:left;">
				AmbientR
			</th>
			<th style="text-align:left;">
				AmbientG
			</th>
			<th style="text-align:left;">
				AmbientB
			</th>
			<th style="text-align:left;">
				FogDepth
			</th>
			<th style="text-align:left;">
				FogIntensity
			</th>
			<th style="text-align:left;">
				FogR
			</th>
			<th style="text-align:left;">
				FogG
			</th>
			<th style="text-align:left;">
				FogB
			</th>
		</tr><tr><td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.3
			</td>
			<td>
				0.3
			</td>
			<td>
				0.6
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				1.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.3
			</td>
			<td>
				0.3
			</td>
			<td>
				0.6
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				2.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.3
			</td>
			<td>
				0.3
			</td>
			<td>
				0.6
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				3.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.3
			</td>
			<td>
				0.4
			</td>
			<td>
				0.6
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				4.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.4
			</td>
			<td>
				0.4
			</td>
			<td>
				0.7
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				5.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.4
			</td>
			<td>
				0.4
			</td>
			<td>
				0.7
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				6.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.6
			</td>
			<td>
				0.6
			</td>
			<td>
				0.8
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.1
			</td>
			<td>
				0.1
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				7.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.6
			</td>
			<td>
				0.6
			</td>
			<td>
				0.8
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.2
			</td>
			<td>
				0.2
			</td>
			<td style="margin-bottom:0px;">
				0.2
			</td>
		</tr><tr><td>
				8.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.6
			</td>
			<td>
				0.6
			</td>
			<td>
				0.8
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.2
			</td>
			<td>
				0.2
			</td>
			<td style="margin-bottom:0px;">
				0.2
			</td>
		</tr><tr><td>
				9.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.9
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.2
			</td>
			<td>
				0.2
			</td>
			<td style="margin-bottom:0px;">
				0.2
			</td>
		</tr><tr><td>
				10.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.8
			</td>
			<td>
				0.8
			</td>
			<td>
				0.9
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.2
			</td>
			<td>
				0.2
			</td>
			<td style="margin-bottom:0px;">
				0.2
			</td>
		</tr><tr><td>
				11.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.9
			</td>
			<td>
				0.9
			</td>
			<td>
				0.9
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.2
			</td>
			<td>
				0.2
			</td>
			<td style="margin-bottom:0px;">
				0.2
			</td>
		</tr><tr><td>
				12.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				1.0
			</td>
			<td>
				1.0
			</td>
			<td>
				1.0
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.2
			</td>
			<td>
				0.2
			</td>
			<td style="margin-bottom:0px;">
				0.2
			</td>
		</tr><tr><td>
				13.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.9
			</td>
			<td>
				0.9
			</td>
			<td>
				0.9
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.2
			</td>
			<td>
				0.2
			</td>
			<td style="margin-bottom:0px;">
				0.2
			</td>
		</tr><tr><td>
				14.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.8
			</td>
			<td>
				0.8
			</td>
			<td>
				0.9
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.2
			</td>
			<td>
				0.2
			</td>
			<td style="margin-bottom:0px;">
				0.2
			</td>
		</tr><tr><td>
				15.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.9
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.1
			</td>
			<td>
				0.1
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				16.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.7
			</td>
			<td>
				0.7
			</td>
			<td>
				0.9
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.1
			</td>
			<td>
				0.1
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				17.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.6
			</td>
			<td>
				0.6
			</td>
			<td>
				0.8
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.3
			</td>
			<td>
				0.1
			</td>
			<td>
				0.1
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				18.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.4
			</td>
			<td>
				0.4
			</td>
			<td>
				0.8
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.5
			</td>
			<td>
				0.1
			</td>
			<td>
				0.1
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				19.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.4
			</td>
			<td>
				0.4
			</td>
			<td>
				0.7
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				20.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.4
			</td>
			<td>
				0.4
			</td>
			<td>
				0.7
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				21.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.4
			</td>
			<td>
				0.3
			</td>
			<td>
				0.7
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.7
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr><td>
				22.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.3
			</td>
			<td>
				0.3
			</td>
			<td>
				0.7
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr><tr style="margin-bottom:0px;"><td>
				23.0
			</td>
			<td>
				0.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.3
			</td>
			<td>
				0.3
			</td>
			<td>
				0.6
			</td>
			<td>
				3700.0
			</td>
			<td>
				0.8
			</td>
			<td>
				0.0
			</td>
			<td>
				0.0
			</td>
			<td style="margin-bottom:0px;">
				0.1
			</td>
		</tr></tbody></table>]]></description><guid isPermaLink="false">20038</guid><pubDate>Mon, 01 Aug 2016 20:20:49 +0000</pubDate></item><item><title>LIT Files</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/lit-files-r20037/</link><description><![CDATA[<h3>
	These files are obsolete!
</h3>

<p>
	LIT files have stored lighting-information until some patch. Today, lightning is stored in the following DBC files:
</p>

<p style="line-height:20px;">
	<a href="./../dbcfiles/mangoszerodbc/Light-r1570/" rel="external">Light.dbc</a>
</p>

<p style="line-height:20px;">
	<a href="./../dbcfiles/mangoszerodbc/LightFloatBand-r1571/" rel="external">LightFloatBand.dbc</a>
</p>

<p style="line-height:20px;">
	<a href="./../dbcfiles/mangoszerodbc/LightIntBand-r1572/" rel="external">LightIntBand.dbc</a>
</p>

<p style="line-height:20px;">
	<a rel="external">LightParams.dbc</a>
</p>

<p style="line-height:20px;margin-bottom:0px;">
	<a href="./../dbcfiles/mangoszerodbc/LightSkybox-r1574/" rel="external">LightSkybox.dbc</a>
</p>

<p>
	For worlds that have terrain data, a corresponding LIT file includes information about the sky color, and possibly lighting conditions. They are stored in World\name\lights.lit
</p>

<h2>
	Header
</h2>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset  Type  Description
0x00   uint32 Always 05 00 00 80
0x04   uint32 nSkies - number of skies defined in this file</span></pre>

<p>
	64 bytes per sky:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset Type      Description
0x00   3 * int32 (-1,-1,-1) for the 'default' first record, (0,0,0) otherwise
0x0C   3 * float Coordinates (X,Y,Z)
0x18   float     Smaller radius for area (?)
0x1C   float     Larger radius
0x20   char[32]  Sky name</span></pre>

<p>
	The float values seem to be multiplied by 36. Dividing by 36 gives back the original scale (I think) In the case of "I think", I think that the game client uses the floats to perform some kind of Cube-Mapped LightMapping (hence the X, Y, Z, -X, -Y, -Z values). -DG
</p>

<h2>
	Sky data
</h2>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">4 * 0x15F0 bytes per sky.</span></pre>

<p>
	The first block of the four seems to have the sky colors, the second and fourth are usually all black, the third might be lighting colors or something else entirely.
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset Type            Description 
0x0000 18 * int32      Lengths 
0x0048 18 * 64 * int32 Color + time records 
0x1248 32 * float      Float values A 
0x12C8 32 * float      Float values B 
0x1348 uint32          Int value I 
0x134C 32 * float      Float values C 
0x13CC 32 * float      Float values D 
0x144C 32 * float      Float values E 
0x14CC 32 * float      Float values F 
0x154C uint32          Int value J 
0x1550 32 * float      Float values G 
0x15D0 8 * uint32      Padding (all 0)</span></pre>

<p>
	The color and time records are in the following format:
</p>

<p>
	Each row of 64 integers contains 32 pairs of integers: the first value is the time in half-minutes (on a scale of 0 to 2880 from midnight to midnight), the second value is a BGRX color. The i-th row contains Lengths[ i ] records like that. I think the color values for intermediate times are interpolated based on the times given in this list.
</p>

<p>
	So there are 18 time-based color rows described here, for the first block these are always the sky colors (well, the first 8 at least). WoWmapview is currently only drawing a very crude, fake sky globe - the colors may or may not match up <img alt=";)" data-emoticon="" height="20" src="https://www.getmangos.eu/uploads/emoticons/wink.png" srcset="https://www.getmangos.eu/uploads/emoticons/wink@2x.png 2x" title=";)" width="20"></p>

<p>
	The 7 sets of floating-point values have to describe the arrangement of the sky colors somehow, but they're pretty difficult to interpret. They usually contain at most 8 values, the rest being 0.
</p>

<p>
	So today I experimented with a custom .LIT file (red and blue skies are hilarious), so here are the meanings for the various color tracks:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Number Description
  0    Global diffuse light
  1    Global ambient light
  2    Sky color 0 (top)
  3    Sky color 1 (middle)
  4    Sky color 2 (middle to horizon)
  5    Sky color 3 (above horizon)
  6    Sky color 4 (horizon)
  7    Fog color / background mountains color
  8    ?
  9    Sun color + sun halo color
  10   Sun larger halo color
  11   ?
  12   Cloud color
  13   ?
  14   ?
  15   Ground shadow color
  16   Water color [light]
  17   Water color [dark]</span></pre>

<p>
	The different skies are interpolated based on distance.
</p>

<p>
	The four sets of data are completely different.
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Number  Description
   0    The default look. 
1 and 3 are usually all black. 
   2    might be the 'ghost view' lighting for when you're dead.</span></pre>
]]></description><guid isPermaLink="false">20037</guid><pubDate>Mon, 01 Aug 2016 20:20:20 +0000</pubDate></item><item><title>M2  MDX Files</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/m2-mdx-files-r20036/</link><description><![CDATA[<h2>
	Introduction
</h2>

<p>
	M2 or MDX files are used to store polygon models along with their animations and other information. The file format is plain binary - no chunks. Information is mainly from <a href="http://www.pxr.dk/wowdev/wiki/index.php?title=M2" rel="external nofollow" style="color:rgb(0,104,222);text-decoration:none;margin-bottom:0px;">http://www.pxr.dk/wowdev/wiki/index.php?title=M2</a><span> </span>as well as from PseuWoW source.
</p>

<h2>
	A note on coordinates
</h2>

<p>
	Blizzard uses an left-handed (?) Z-up coordinate system for the models. When loading, coordinate conversions must be applied for other coordinate systems. This also must be done for all animation data.
</p>

<h2>
	File Structure
</h2>

<p>
	M2 files start with a header block which contains an index of number-offset pairs for all other data blocks. All other blocks follow after that one. Blocks are not delimited, but seem to be aligned to 16 byte boundaries.
</p>

<h2>
	Header
</h2>

<table><tbody style="margin-bottom:0px;"><tr><th>
				Position
			</th>
			<td style="margin-bottom:0px;">
				0
			</td>
		</tr><tr style="margin-bottom:0px;"><th>
				Length
			</th>
			<td style="margin-bottom:0px;">
				324 bytes
			</td>
		</tr></tbody></table><p>
	The file format is identified by the magic string "MD20". Pairs of uint32 are given for every data block. nXXX describes the number of elements (not necessarily bytes) in this block while ofsXXX gives the offset to the beginning of the block. If a block does not exists, n and ofs are 0.
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset Type      Description
--------------------------------------------------------------------
0x000  char[4]   Magic Bytes =&gt; "MD20"
0x004  uint32    Version (0x100 before Burning Crusade, 0x104 after BC)
0x008  uint32    nName - model name length (including \0)
0x00C  uint32    ofsName - model name offset
0x010  uint32    GlobalModelFlags (0,1,3 seen)
0x014  uint32    nGlobalSequences - number of global sequences
0x018  uint32    ofsGlobalSequences - offset to global sequences
0x01C  uint32    nAnimations - number of animation sequences
0x020  uint32    ofsAnimations - offset to animation sequences
0x024  uint32    nAnimationLookup
0x028  uint32    ofsAnimationLookup
0x02C  uint32    nD - always 201 or 203 depending on client version
0x030  uint32    ofsD
0x034  uint32    nBones - number of bones
0x038  uint32    ofsBones - offset to bones
0x03C  uint32    nSkelBoneLookup - skeletal bone lookup table
0x040  uint32    ofsSkelBoneLookup
0x044  uint32    nVertices - number of vertices
0x048  uint32    ofsVertices - offset to vertices
0x04C  uint32    nViews - number of views (LOD versions?) 4 for every model
0x050  uint32    ofsViews - offset to views
0x054  uint32    nColors - number of color definitions
0x058  uint32    ofsColors - offset to color definitions
0x05C  uint32    nTextures - number of textures
0x060  uint32    ofsTextures - offset to texture definitions
0x064  uint32    nTransparency - number of transparency definitions
0x068  uint32    ofsTransparency - offset to transparency definitions
0x06C  uint32    nI - always 0
0x070  uint32    ofsI
0x074  uint32    nTexAnims - number of texture animations
0x078  uint32    ofsTexAnims - offset to texture animations
0x07C  uint32    nTexReplace
0x080  uint32    ofsTexReplace
0x084  uint32    nRenderFlags - number of blending mode definitions
0x088  uint32    ofsRenderFlags - offset to blending mode definitions
0x08C  uint32    nBoneLookupTable - bone lookup table
0x090  uint32    ofsBoneLookupTable
0x094  uint32    nTexLookup - number of texture lookup table entries
0x098  uint32    ofsTexLookup - offset to texture lookup table
0x09C  uint32    nTexUnits - texture unit definitions?
0x0A0  uint32    ofsTexUnits
0x0A4  uint32    nTransLookup - number of transparency lookup table entries
0x0A8  uint32    ofsTransLookup - offset to transparency lookup table
0x0AC  uint32    nTexAnimLookup - number of texture animation lookup table entries
0x0B0  uint32    ofsTexAnimLookup - offset to texture animation lookup table
0x0B4  float[14] float values ... ? (in range -1000...1000, mostly in -20...30)
0x0EC  uint32    nBoundingTriangles
0x0F0  uint32    ofsBoundingTriangles
0x0F4  uint32    nBoundingVertices
0x0F8  uint32    ofsBoundingVertices
0x0FC  uint32    nBoundingNormals
0x100  uint32    ofsBoundingNormals
0x104  uint32    nAttachments
0x108  uint32    ofsAttachments
0x10C  uint32    nAttachLookup
0x110  uint32    ofsAttachLookup
0x114  uint32    nAttachments_2
0x118  uint32    ofsAttachments_2
0x11C  uint32    nLights - number of lights
0x120  uint32    ofsLights - offset to lights
0x124  uint32    nCameras - number of cameras
0x128  uint32    ofsCameras - offset to cameras
0x12C  uint32    nCameraLookup
0x130  uint32    ofsCameraLookup
0x134  uint32    nRibbonEmitters - number of ribbon emitters
0x138  uint32    ofsRibbonEmitters - offset to ribbon emitters
0x13C  uint32    nParticleEmitters - number of particle emitters
0x140  uint32    ofsParticleEmitters - offset to particle emitters</span></pre>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	 
</p>

<h2>
	Vertices
</h2>

<table><tbody style="margin-bottom:0px;"><tr><th>
				Position
			</th>
			<td style="margin-bottom:0px;">
				header.ofsVertices
			</td>
		</tr><tr style="margin-bottom:0px;"><th>
				Element size
			</th>
			<td style="margin-bottom:0px;">
				48 bytes
			</td>
		</tr></tbody></table><p>
	Vertices are global for all submeshes and views.
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset Type     Description
--------------------------------------------------------------------
0x00   float[3] Position (X,Y,Z)
0x0C   uint8[4] Bone weights (0 to 255)
0x10   uint8[4] Bone indices (0 to nBones-1)
0x14   float[3] Normal vector (nX, nY, nZ)
0x20   float[2] Texture coordinates (U, V)
0x28   float[2] unknown, mostly 0.0f</span></pre>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	 
</p>

<h2>
	Views
</h2>

<table><tbody style="margin-bottom:0px;"><tr><th>
				Position
			</th>
			<td style="margin-bottom:0px;">
				header.ofsViews
			</td>
		</tr><tr style="margin-bottom:0px;"><th>
				Element size
			</th>
			<td style="margin-bottom:0px;">
				44 bytes
			</td>
		</tr></tbody></table><p>
	It is not clear what Views are for. But there are always 4 of them.
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset Type   Description
--------------------------------------------------------------------
 0x00  uint32 nIndex      - number of elements in the index list
 0x04  uint32 ofsIndex    - offset to the index list
 0x08  uint32 nTriangle   - number of elements in the triangle list
                            (this is 3* the number of triangles to be drawn)
 0x0C  uint32 ofsTriangle - offset to the triangle list
 0x10  uint32 nProps      - number of elements in the vertex property list
 0x14  uint32 ofsProps    - offset to the vertex property list
 0x18  uint32 nSubmesh    - number of elements in the submesh list
 0x1C  uint32 ofsSubmesh  - offset to the submesh list
 0x20  uint32 nTexture    - number of elements in the texture list
 0x24  uint32 ofsTexture  - offset to the texture list
 0x28  uint32 LOD distance or something?</span></pre>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	 
</p>

<h3>
	Indices
</h3>

<p>
	nIndex uint16 values - referencing vertices from the global Vertex list.
</p>

<h3>
	Triangles
</h3>

<p>
	3 uint16 values per triangle - referencing the Index list
</p>

<h3>
	Properties
</h3>

<p>
	4 bytes per Vertex. Those are indices into the BoneLookupTable for each Vertex.
</p>

<h3>
	Submeshes
</h3>

<p>
	32 bytes per Submesh definition.
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset Type     Description
--------------------------------------------------------------------
 0x00  uint32   Mesh part ID
 0x04  uint16   ofsVertex     - Starting vertex number, offset into the Vertex array
 0x06  uint16   nVertex       - Number of vertices
 0x08  uint16   ofsTriangle   - Starting triangle index
 0x0A  uint16   nTriangle     - Number of triangle indices
 0x0C  uint16   nBoneLookup   - Number of elements in the bone lookup table
 0x0E  uint16   ofsBoneLookup - Starting index in the bone lookup table
 0x10  uint16   unknown 
 0x12  uint16   unsure        - maybe root bone?
 0x14  float[3] Vector (3d)   - mass center?</span></pre>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	 
</p>

<p>
	<strong style="font-weight:bold;margin-bottom:0px;">Mesh part ID</strong>
</p>

<p>
	These IDs are referenced for Geosets and such. For character models, each hairstyle/thick armor/etc is present in the mesh, so to render a character with a specific set of looks, some of the submeshes should be omitted based on this ID.The submeshes are sorted into groups. Groups are like this for character models. They can be different for other models.
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00**: Hairstyles
01**: Facial1
02**: Facial2
03**: Facial3
04**: Braces
05**: Boots
06**: Unknown
07**: Ears
08**: Wristbands
09**: Kneepads?
10**:
11**: Related to pants
12**: Tabard
13**: Trousers / kilts
14**:
15**: Cape
16**:
17**: Eyeglows (including the deathknight ones)
18**: Belt / bellypack</span></pre>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	 
</p>

<p>
	These are referenced in CreatureDisplayInfo.dbc-&gt;creatureGeosetData.
</p>
]]></description><guid isPermaLink="false">20036</guid><pubDate>Mon, 01 Aug 2016 20:19:37 +0000</pubDate></item><item><title>MPQ File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/mpq-file-r20035/</link><description><![CDATA[<h2>
	MPQ File Format
</h2>

<h3>
	Introduction
</h3>

<p>
	All of the game data for WoW are stored in MPQ Archives. The format's capabilities include compression, encryption, file segmentation, extensible file metadata, cryptographic signature and the ability to store multiple versions of the same file for internationalization and platform-specific differences. MPQ archives can use a variety of compression algorithms which may also be combined.
</p>

<p>
	The definitive source for information on MPQ Files is<span> </span><a href="http://wiki.devklog.net/index.php?title=The_MoPaQ_Archive_Format" rel="external nofollow" style="color:rgb(0,104,222);text-decoration:none;margin-bottom:0px;">http://wiki.devklog.net/index.php?title=The_MoPaQ_Archive_Format</a>.
</p>

<p>
	The following summary only includes facts relevant for 1.12.X Client versions
</p>

<h3>
	Technical overview
</h3>

<p>
	All numbers in the MPQ format are in little endian byte order; signed numbers use the two's complement system. Data types are listed either as int (integer, the number of bits specified), byte (8 bits), or char (bytes which contain ASCII characters). All sizes and offsets are in bytes, unless specified otherwise. Structure members are listed in the following general form:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">offset from the beginning of the structure: data type(array size) member name : member description</span></pre>

<h3>
	General Archive Layout
</h3>

<p>
	The physical layout of the files looks like this
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Archive
HeaderFile
DataHash
TableBlock
Table</span></pre>

<p>
	In the following the components are discussed in the logical order of processing required to read and extract files from MPQ Archives
</p>

<h3>
	Archive Header
</h3>

<p>
	Header size is 32 bytes, maximum archive size is 4 GB.
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h: char(4) Magic Indicates that the file is a MPQ archive. Must be ASCII "MPQ" 1Ah.
04h: int32 HeaderSize Size of the archive header.
08h: int32 ArchiveSize Size of the whole archive, including the header. 
0Ch: int16 FormatVersion MPQ format version. 0000h for Classic WoW.
0Eh: int8  SectorSizeShift Power of two exponent specifying the number of 512-byte disk sectors in each
           logical sector in the archive.
           The size of each logical sector in the archive is 512 * 2^SectorSizeShift.
           Bugs in the Storm library dictate that this should always be 3 (4096 byte sectors).
10h: int32 HashTableOffset Offset to the beginning of the hash table,
           relative to the beginning of the archive.
14h: int32 BlockTableOffset Offset to the beginning of the block table,
           relative to the beginning of the archive.
18h: int32 HashTableEntries Number of entries in the hash table. Must be a power of two, 
           and must be less than 2^16
1Ch: int32 BlockTableEntries Number of entries in the block table.</span></pre>

<h3>
	Hash Table
</h3>

<p>
	The Hash Table serves as a quick means of filename lookup without having to go through string comparisons. For each file in the archive, the full path is hashed using a proprietary algorithm (for source see<span> </span><a href="http://wiki.devklog.net/index.php?title=The_MoPaQ_Archive_Format#Algorithm_Source_Code" rel="external nofollow" style="color:rgb(0,104,222);text-decoration:none;margin-bottom:0px;">http://wiki.devklog.net/index.php?title=The_MoPaQ_Archive_Format#Algorithm_Source_Code</a>) resulting in three 32bit integers. The first of those hashes serves as primary lookup key for the Hash Table, the others are used for verification in case of a hash collision. In the case that two files have the same lookup key (hash collision), the first file is stored under that hash, and the second file is stored under the next free hash. So during lookup, if the second and third hash don't match, the algorithm goes down the list until it either finds a match of an empty entry. Each entry in the Hash Table looks like this:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h: int32 FilePathHashA The hash of the file path, using method A.
04h: int32 FilePathHashB The hash of the file path, using method B.
08h: int16 Language The language of the file. This is a Windows LANGID data type, and uses the same values.
           0 indicates the default language (American English), or that the file is language-neutral.
0Ah: int8  Platform The platform the file is used for. 0 indicates the default platform. 
           No other values have been observed.
0Ch: int32 FileBlockIndex If the hash table entry is valid, this is the index into the block table of the file.

           Otherwise, one of the following two values:
           FFFFFFFFh Hash table entry is empty, and has always been empty.
                     Terminates searches for a given file.
           FFFFFFFEh Hash table entry is empty, but was valid at some point
                     (in other words, the file was deleted).
                     Does not terminate searches for a given file.</span></pre>

<p>
	The Hash Table is encrypted using a proprietary encryption algorithm using "(hash table)" as key. The encryption algorithm is also documented at<span> </span><a href="http://wiki.devklog.net/index.php?title=The_MoPaQ_Archive_Format#Algorithm_Source_Code" rel="external nofollow" style="color:rgb(0,104,222);text-decoration:none;margin-bottom:0px;">http://wiki.devklog.net/index.php?title=The_MoPaQ_Archive_Format#Algorithm_Source_Code</a>
</p>

<h3>
	Block Table
</h3>

<p>
	The Block Table contains offsets into the File Data block for each File in the Archive. It also stores file attributes like compression or encryption. Hash Table FileBlockIndex points to entries in the Block Table. Like the Hash Table it is encrypted, using "(block table)" as key. Each Block Table entry looks like this:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h: int32 BlockOffset Offset of the beginning of the block, relative to the beginning of the archive.
04h: int32 BlockSize Size of the block in the archive.
08h: int32 FileSize Size of the file data stored in the block.
           If the file is compressed, this is the size of the uncompressed file data.
0Ch: int32 Flags Bit mask of the flags for the block. </span></pre>

<p>
	Known flags are:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">   Flag name           Value    Meaning
-----------------------------------------------------------------------------------------------------
MPQ_FILE_IMPLODE       0x00000100 File is compressed using PKWARE Data compression library
MPQ_FILE_COMPRESS      0x00000200 File is compressed using combination of compression methods
MPQ_FILE_ENCRYPTED     0x00010000 The file is encrypted
MPQ_FILE_FIX_KEY       0x00020000 The decryption key for the file is altered according to the position of
                                  the file in the archive
MPQ_FILE_PATCH_FILE    0x00100000 The file contains incremental patch for an existing file in base MPQ
MPQ_FILE_SINGLE_UNIT   0x01000000 Instead of being divided to 0x1000-bytes blocks, the file is stored as
                                  single unit
MPQ_FILE_DELETE_MARKER 0x02000000 File is a deletion marker, indicating that the file no longer exists.
                                  This is used to allow patch archives to delete files present in lower-
                                  priority archives in the search chain.
                                  The file usually has length of 0 or 1 byte and its name is a hash
MPQ_FILE_SECTOR_CRC    0x04000000 File has checksums for each sector (explained in the File Data section).
                                  Ignored if file is not compressed or imploded.
MPQ_FILE_EXISTS        0x80000000 Set if file exists, reset when the file was deleted</span></pre>

<h3>
	File Data
</h3>

<p>
	Block Table BlockOffset points to the beginning of a file data block. Each file data block has a header of nSectors+1 int32 values, indicating offsets to each sector start (relative to the beginning of the file data block). The final value of this list is the total (compressed) file size, including the header. The size of each block can easily be calculated from the difference between two offsets. If the block is compressed, the first byte of every sector indicates the compression method used
</p>

<h3>
	Extracting a file
</h3>

<p>
	This is a step-by-step instruction.
</p>

<ul><li style="line-height:20px;">
		Read the File Header, find the offsets to the Hash Table and Block Table
	</li>
	<li style="line-height:20px;">
		Read and Decrypt Hash Table and Block Table
	</li>
	<li style="line-height:20px;">
		Compute Hashes for the file (Full Path, all Slashes converted to Backslashes) =&gt;<span> </span><strong style="font-weight:bold;margin-bottom:0px;">Hash0, Hash1, Hash2</strong>
	</li>
	<li style="line-height:20px;">
		<strong style="font-weight:bold;">HashTableOffset</strong><span> </span>=<span> </span><strong style="font-weight:bold;">Hash0</strong><span> </span>&amp; (<strong style="font-weight:bold;margin-bottom:0px;">Header.HashTableEntries</strong><span> </span>-1)
	</li>
	<li style="line-height:20px;">
		Starting from<span> </span><strong style="font-weight:bold;">HashTableOffset</strong>, go through the Hash Table and compare<span> </span><strong style="font-weight:bold;">Hash1</strong><span> </span>and<span> </span><strong style="font-weight:bold;">Hash2</strong><span> </span>to<span> </span><strong style="font-weight:bold;">HashTable.FilePathHashA</strong><span> </span>and<span> </span><strong style="font-weight:bold;margin-bottom:0px;">HashTable.FilePathHashB</strong><span> </span>respectively until either a match or an empty entry is found. In the latter case the file you are looking for does not exist.
	</li>
	<li style="line-height:20px;">
		Find the Block Table entry which corresponds to<span> </span><strong style="font-weight:bold;margin-bottom:0px;">HashTable.FileBlockIndex</strong>
	</li>
	<li style="line-height:20px;">
		Go to the file offset specified in<span> </span><strong style="font-weight:bold;margin-bottom:0px;">BlockTable.BlockOffset</strong>
	</li>
	<li style="line-height:20px;">
		Read int32 values until you reach a value that is equal to<span> </span><strong style="font-weight:bold;">BlockTable.BlockSize</strong><span> </span>=&gt;<span> </span><strong style="font-weight:bold;margin-bottom:0px;">SectorOffset[0] ... SectorOffset[n]</strong>
	</li>
	<li style="line-height:20px;">
		For every entry of<span> </span><strong style="font-weight:bold;">SectorOffset[0]...SectorOffset[n-1]</strong>, seek to<span> </span><strong style="font-weight:bold;margin-bottom:0px;">BlockTable.BlockOffset+SectorOffset[x]</strong>
	</li>
	<li style="line-height:20px;">
		Read<span> </span><strong style="font-weight:bold;margin-bottom:0px;">SectorOffset[x+1]-SectorOffset[x]</strong><span> </span>bytes of data.
	</li>
	<li style="line-height:20px;">
		If<span> </span><strong style="font-weight:bold;margin-bottom:0px;">BlockTable.Flags</strong><span> </span>has a compressed flag set, the first byte of each sector indicates the compression method applied.
	</li>
	<li style="line-height:20px;margin-bottom:0px;">
		Decrypt and or decompress each sector as necessary, stitch them together, et voila, there is your file
	</li>
</ul><h3>
	The Listfile
</h3>

<p>
	Each MPQ in WoW 1.12.X contains a "(listfile)". This file lists the full archive contents, one file path per line, in clear text. Hashing the file paths provides lookup keys into Hash Table. The file is provided for convenience, as it seems. It is not used by the client
</p>
]]></description><guid isPermaLink="false">20035</guid><pubDate>Mon, 01 Aug 2016 20:18:46 +0000</pubDate></item><item><title>SBT File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/sbt-file-r20034/</link><description><![CDATA[<h3>
	Introduction
</h3>

<p>
	For each cinematic there is one SBT (<strong style="font-weight:bold;">S</strong>u<strong style="font-weight:bold;margin-bottom:0px;">BT</strong>itle) file found in Interface\Cinematics (interface.MPQ). It contains localized subtitles for movies.
</p>

<h3>
	File Structure
</h3>

<p>
	At the beginning are 3 bytes 0xEF BB BF. Some kind of ID/Magic bytes/unknown stuff.
</p>

<p>
	Each entry is made of a timestamp and a text. The entries are divided by an empty line.
</p>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
	 
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00:00:04:06 - 00:00:13:01 Four years have passed since the mortal races banded together and stood
                          united against the might of the Burning Legion.
00:00:14:00 - 00:00:22:05 Though Azeroth was saved, the tenuous pact between the Horde and the Alliance
                          has all but evaporated.
00:00:24:06 - 00:00:28:21 The drums of war thunder once again. </span></pre>

<p style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
	 
</p>

<p>
	The timestamp is hr:min:sec:msec.
</p>
]]></description><guid isPermaLink="false">20034</guid><pubDate>Mon, 01 Aug 2016 20:14:26 +0000</pubDate></item><item><title>TRS File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/trs-file-r20033/</link><description><![CDATA[<h3>
	Introduction
</h3>

<p>
	The filenames of Minimap textures stored in MPQ Archives are hashed using MD5. The TRS file provides an easy lookup from real pathnames like <strong>Azeroth\map00_00.blp</strong> to the corresponding hashed filename <strong>f16354735dad4e22e175a398a01992ba.blp</strong>
</p>

<h3>
	File Structure
</h3>

<p>
	TRS is a plain human-readable text file. Every directory is started by a line that looks like
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">dir: Azeroth</span></pre>

<p>
	after which a table with two columns (tab-separated) lists the corresponding clear-text filenames and hash filenames like this:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Azeroth\map00_00.blp f16354735dad4e22e175a398a01992ba.blp
Azeroth\map00_01.blp 3f6b258da2fe615b620d34eaa26bb0cc.blp
Azeroth\map00_02.blp 6e2e4a333dc88a8581c727d3207d04f8.blp
Azeroth\map01_00.blp 1c415ef6183e799c137c959596e34c40.blp
Azeroth\map01_01.blp 8abbe680628429c4c6e6abf286bfed68.blp
Azeroth\map01_02.blp 018be401f83b315df7abc887324cc1e2.blp
...</span></pre>
]]></description><guid isPermaLink="false">20033</guid><pubDate>Mon, 01 Aug 2016 20:12:06 +0000</pubDate></item><item><title>WDB File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/wdb-file-r20032/</link><description><![CDATA[<h3>
	Header
</h3>

<p>
	The header is of 16 bytes for pre-1.6 files, and 20 bytes for post-BC files:
</p>

<table><tbody style="margin-bottom:0px;"><tr><td align="center" valign="middle">
				<b style="margin-bottom:0px;">FieldName</b>
			</td>
			<td align="center" valign="middle">
				<b style="margin-bottom:0px;">Length</b>
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				<b style="margin-bottom:0px;">Description</b>
			</td>
		</tr><tr><td align="center" valign="middle">
				Signature
			</td>
			<td align="center" valign="middle">
				4-bytes char
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				File Signature
			</td>
		</tr><tr><td align="center" valign="middle">
				Build
			</td>
			<td align="center" valign="middle">
				4-bytes int
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Build Identifier
			</td>
		</tr><tr><td align="center" valign="middle">
				Locale
			</td>
			<td align="center" valign="middle">
				4-bytes char
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Locale Identifier, reversed (ie. SUne for enUS)
			</td>
		</tr><tr><td align="center" valign="middle">
				Unknown
			</td>
			<td align="center" valign="middle">
				4-bytes int
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Added in 1.6 (May be first compatible client build for this db version. not verified)
			</td>
		</tr><tr><td align="center" valign="middle">
				Unknown
			</td>
			<td align="center" valign="middle">
				4-bytes int
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Added in 1.6 (Region code. not verified)
			</td>
		</tr><tr style="margin-bottom:0px;"><td align="center" valign="middle">
				Unknown
			</td>
			<td align="center" valign="middle">
				4-bytes int
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Added in 3.0.8.9464, always null
			</td>
		</tr></tbody></table><h3>
	Signatures
</h3>

<p>
	Signatures, just like locales, are reversed in the header.
</p>

<table><tbody style="margin-bottom:0px;"><tr><td align="center" valign="middle">
				<b style="margin-bottom:0px;">Signature</b>
			</td>
			<td align="center" valign="middle">
				<b style="margin-bottom:0px;">Filename</b>
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				<b style="margin-bottom:0px;">Description</b>
			</td>
		</tr><tr><td align="center" valign="middle">
				BDIW
			</td>
			<td align="center" valign="middle">
				Itemcache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warcraft Item Database
			</td>
		</tr><tr><td align="center" valign="middle">
				BDNW
			</td>
			<td align="center" valign="middle">
				Itemnamecache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warcraft Item Name Database
			</td>
		</tr><tr><td align="center" valign="middle">
				BOGW
			</td>
			<td align="center" valign="middle">
				Gameobjectcache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warcraft Game Object Database
			</td>
		</tr><tr><td align="center" valign="middle">
				BOMW
			</td>
			<td align="center" valign="middle">
				Creaturecache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warcraft MOB Database
			</td>
		</tr><tr><td align="center" valign="middle">
				CPNW
			</td>
			<td align="center" valign="middle">
				Npccache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warcraft NPC Database
			</td>
		</tr><tr><td align="center" valign="middle">
				NDRW
			</td>
			<td align="center" valign="middle">
				Wowcache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warden Cache
			</td>
		</tr><tr><td align="center" valign="middle">
				TSQW
			</td>
			<td align="center" valign="middle">
				Questcache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warcraft Quest Database
			</td>
		</tr><tr><td align="center" valign="middle">
				XTIW
			</td>
			<td align="center" valign="middle">
				Itemtextcache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warcraft Item Text Database
			</td>
		</tr><tr style="margin-bottom:0px;"><td align="center" valign="middle">
				BDPW
			</td>
			<td align="center" valign="middle">
				Pagetextcache.wdb
			</td>
			<td align="left" style="margin-bottom:0px;" valign="middle">
				Warcraft Page Text Database
			</td>
		</tr></tbody></table><h3>
	EntryLength
</h3>

<p>
	The EntryLength is the length in bytes of the cached row. It is always found in the second column and helps the game determinate corrupted cache entries as well as optimizing the reading process. Rows with an incorrect EntryLength are cleared on log in.
</p>

<h3>
	EOF (End Of File)
</h3>

<p>
	All WDB files end with 8 times \x00
</p>
]]></description><guid isPermaLink="false">20032</guid><pubDate>Mon, 01 Aug 2016 20:11:41 +0000</pubDate></item><item><title>WDB Files - Mangos 2 (Wotlk)</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/wdb-files-mangos-2-wotlk-r20086/</link><description><![CDATA[<div>
	<div>
		<div dir="ltr" lang="en" xml:lang="en">
			<div>
					<div>
						<div>
							<div>
								<div dir="ltr" lang="en" xml:lang="en">
											<div>
												<div>
													<div dir="ltr" lang="en" xml:lang="en">
														<p>
															<big><b>The following wdb-files have content labelling:</b></big>
														</p>
													</div>
												</div>
											</div>

											<p>
												creaturecache <br>
												gameobjectcache‎ <br>
												itemcache <br>
												itemnamecache <br>
												itemtextcache‎ <br>
												npccache <br>
												pagetextcache‎ <br>
												questcache
											</p>

											<div>
												<div>
													<div dir="ltr" lang="en" xml:lang="en">
														<p>
															<big><b>`creaturecache` wdb</b></big>
														</p>

														<p>
															This wdb contains some information of seen creatures.
														</p>

														<p>
															<span><b>Structure</b></span>
														</p>

														<table align="center" border="1" cellpadding="1" cellspacing="1" style="width:100%;background-color:#2b2b2b;color:#c0c0c0;"><thead><tr><th scope="col" style="border:1px solid #999999;padding:3px 10px;background-color:#5b5b5b;text-align:center;">
																		<b>Name</b>
																	</th>
																	<th scope="col" style="border:1px solid #999999;padding:3px 10px;background-color:#5b5b5b;text-align:center;">
																		<b>Type</b>
																	</th>
																</tr></thead><tbody><tr><td style="border:1px solid #999999;padding:3px 10px;">
																		entry
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		name
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		Sitring
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		subbame
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		String
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		IconName
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		String
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		type_flags
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		type
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		family
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		rank
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		KillCredit1
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		KillCredit2
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		modelid_1
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		modelid_2
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		modelid_3
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		modelid_4
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		unk16/HealthModifier
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		float
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		unk17/PowerModifier
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		float
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		RacialLeader
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		TINYINT
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		questItem1
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		questItem3
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		questItem3
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		questItem4
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		questItem5
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		questItem6
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr><tr><td style="border:1px solid #999999;padding:3px 10px;text-align:left;">
																		MovementId
																	</td>
																	<td style="border:1px solid #999999;padding:3px 10px;text-align:center;">
																		UInteger
																	</td>
																</tr></tbody></table></div>
												</div>
											</div>

											<p>
												 
											</p>
										</div>
									</div>
						</div>
					</div>
				</div>
			</div>
	</div>
</div>]]></description><guid isPermaLink="false">20086</guid><pubDate>Fri, 28 Jul 2017 08:58:51 +0000</pubDate></item><item><title>WDL File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/wdl-file-r20031/</link><description><![CDATA[<p>
	WDL files contain a low-resolution heightmap for a world. This is probably what the WoW client uses to draw the solid-colored mountain ranges in the background ('in front of' the sky, but 'behind' the fog and the rest of the scenery). It can also be conveniently used to construct a minimap - however, since no water level information is present, the best guess is 0 (sea level) - this results in some lower-than-sea-level areas being blue on the WoWmapview minimap. Oh well. <img alt=":)" data-emoticon="" height="20" src="https://www.getmangos.eu/uploads/emoticons/smile.png" srcset="https://www.getmangos.eu/uploads/emoticons/smile@2x.png 2x" title=":)" width="20"></p>

<ul style="padding:0px;margin:0px 0px 10px 25px;color:rgb(51,51,51);font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;font-style:normal;font-weight:normal;letter-spacing:normal;line-height:20px;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);"><li style="line-height:20px;margin-bottom:0px;">
		''Someone told me that the use of WDL files was actually to determine pathing (especially for NPCs). We still need a confirmation on what they're for though. -DG''
	</li>
</ul><p>
	*Chunked structure.
</p>

<h2>
	MWMO, MWID and MODF chunk
</h2>

<p>
	These chunks seem to have been added to every WDL and contain information about low resolution [[WMO]] used to create a silhouette.
</p>

<h3>
	MWMO
</h3>

<ul><li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">*</span><span class="str" style="color:rgb(221,17,68);">'''Filenames for [[WMO]] that appear in the low resolution map.'''</span><span class="pln" style="color:rgb(72,72,76);"> </span><span style="color:#008080;">Zero</span><span class="pln" style="color:rgb(72,72,76);"> terminated strings</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">.</span></code>
	</li>
</ul><h3>
	MWID
</h3>

<ul><li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">*</span><span class="str" style="color:rgb(221,17,68);margin-bottom:0px;">'''List of indexes into the MWMO chunk.'''</span></code>
	</li>
</ul><h3>
	MODF
</h3>

<ul><li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">*</span><span class="str" style="color:rgb(221,17,68);">'''Placement information for the [[WMO]].'''</span><span class="pln" style="color:rgb(72,72,76);"> </span><span style="color:#008080;">Appears</span><span class="pln" style="color:rgb(72,72,76);"> to be the same </span><span class="lit" style="color:rgb(25,95,145);">64</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="kwd" style="color:rgb(30,52,123);">byte</span><span class="pln" style="color:rgb(72,72,76);"> structure used </span><span class="kwd" style="color:rgb(30,52,123);">in</span><span class="pln" style="color:rgb(72,72,76);"> the </span><span class="pun" style="color:rgb(147,161,161);">[[</span><span class="pln" style="color:rgb(72,72,76);">WDT</span><span class="pun" style="color:rgb(147,161,161);">]]</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="kwd" style="color:rgb(30,52,123);">and</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">[[</span><span class="pln" style="color:rgb(72,72,76);">ADT</span><span class="pun" style="color:rgb(147,161,161);">]]</span><span class="pln" style="color:rgb(72,72,76);"> MODF chunks</span><span class="pun" style="color:rgb(147,161,161);margin-bottom:0px;">.</span></code>
	</li>
</ul><h3>
	MAOF chunk
</h3>

<ul><li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">*</span><span class="str" style="color:rgb(221,17,68);">'''Map Area Offset.'''</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		 
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span style="color:#008080;">Contains</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">64</span><span class="pun" style="color:rgb(147,161,161);">*</span><span class="lit" style="color:rgb(25,95,145);">64</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="pun" style="color:rgb(147,161,161);">=</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">4096</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="kwd" style="color:rgb(30,52,123);">unsigned</span><span class="pln" style="color:rgb(72,72,76);"> </span><span class="lit" style="color:rgb(25,95,145);">32</span><span class="pun" style="color:rgb(147,161,161);">-</span><span class="pln" style="color:rgb(72,72,76);">bit integers</span><span class="pun" style="color:rgb(147,161,161);">,</span><span class="pln" style="color:rgb(72,72,76);"> these are absolute offsets </span><span class="kwd" style="color:rgb(30,52,123);">in</span><span class="pln" style="color:rgb(72,72,76);"> the file to each map tile</span><span class="str" style="color:rgb(221,17,68);margin-bottom:0px;">'s MapAreaLow-array-entry. For unused tiles the value is 0.</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		 
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);margin-bottom:0px;">/*000h*/ UINT32 areaLowOffsets[4096];</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);margin-bottom:0px;">''or''</span></code>
	</li>
	<li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="str" style="color:rgb(221,17,68);margin-bottom:0px;">/*000h*/ UINT32 areaLowOffsets[64][64];</span></code>
	</li>
</ul><h2>
	MapAreaLow array
</h2>

<h3>
	MARE chunks
</h3>

<ul><li style="line-height:20px;padding-left:12px;color:rgb(190,190,197);margin-bottom:0px;">
		<code style="padding:0px;font-family:monospace;font-size:12px;color:inherit;border:0px;white-space:pre-wrap;margin-bottom:0px;background-color:transparent;"><span class="pun" style="color:rgb(147,161,161);">*</span><span class="str" style="color:rgb(221,17,68);">'''Map Area'''</span><span class="pln" style="color:rgb(72,72,76);margin-bottom:0px;"> </span></code>
	</li>
</ul><p>
	Heightmap for one map tile. Contains 17<em style="font-style:italic;margin-bottom:0px;">17 + 16</em>16 = 545 signed 16-bit integers. So a 17 by 17 grid of height values is given, with additional height values in between grid points. Here, the "outer" 17x17 points are listed (in the usual row major order), followed by 16x16 "inner" points. The height values are on the same scale as those used in the regular height maps.
</p>

<h3>
	MAHO chunks
</h3>

<p>
	After each MARE chunk there follows a MAHO (MapAreaHOles) chunk. It may be left out if the data is supposed to be 0 all the time.
</p>

<p>
	It's an array of 16 shorts. Each short is a bitmask. If the bit is not set, there is a hole at this position.
</p>
]]></description><guid isPermaLink="false">20031</guid><pubDate>Mon, 01 Aug 2016 20:11:16 +0000</pubDate></item><item><title>WDT File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/wdt-file-r20027/</link><description><![CDATA[<h3>
	Introduction
</h3>

<p>
	WDT files specify exactly which map tiles are present in a world, if any, and can also reference a "global" WMO. They have a Chunked File Structure.
</p>

<h3>
	Chunks
</h3>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MVER
			</td>
			<td style="text-align:center;">
				4 bytes
			</td>
			<td style="text-align:left;">
				Map Version
			</td>
			<td style="text-align:left;">
				This chunk specifies the format version. All WDT Files in 1.12.X have Version 18.
			</td>
		</tr><tr><td style="text-align:center;">
				MPHD
			</td>
			<td style="text-align:center;">
				32 bytes
			</td>
			<td style="text-align:left;">
				Map Header
			</td>
			<td style="text-align:left;">
				This chunk is the Map header. It contains 8 int32 Values.
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h      uint32          flags;
04h      uint32          something;
08h      uint32          unused[6]</span></pre>

<p>
	Flags values are not well understood. From Wowdev:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Flag Description
------------------------------------------------------------------------------------------------------
0x01 Use global map object definition.
0x02 CMapRenderChunk::SetVertexFormat(2); (else: 1) -- Use vertex shading (ADT.MCNK.MCCV)
0x04 Decides whether to use _env terrain shaders or not: funky and if MCAL has 4096 instead of 2048(?)
0x08 Disables something. No idea what. Another rendering thing. Someone may check all them in wild life..
0x10 if (flags &amp; 0x02 &amp;&amp; CMap::enableTerrainShaderVertex) CMapRenderChunk::SetVertexFormat(16); // cataclysm?</span></pre>

<p>
	The second integer is not ignored but stores something too. This is even less well understood.
</p>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="15%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="60%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MAIN
			</td>
			<td style="text-align:center;">
				32768 bytes
			</td>
			<td style="text-align:left;">
				Main Chunk
			</td>
			<td style="text-align:left;">
				This is the map table data. It contains 64x64 8 byte entries.
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">00h      uint32          m_flags;
04h      void*           m_area;       // only set during runtime.</span></pre>

<p>
	Flags:
</p>

<pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Flag     Description
-----------------------------------------------------------------
0x01     There is an ADT File for this position
0x02     Set by the client during runtime if the chunk was loaded</span></pre>

<p>
	We just need to know the 0x01 flag. The corresponding ADT File is found in World\Maps\\_XX_YY.adt
</p>

<table><tbody><tr><td style="text-align:center;" width="10%">
				<strong>Identifier</strong>
			</td>
			<td style="text-align:center;" width="10%">
				<strong>Length</strong>
			</td>
			<td style="text-align:left;" width="20%">
				<strong>Description</strong>
			</td>
			<td style="text-align:left;" width="65%">
				<strong>Notes</strong>
			</td>
		</tr><tr><td style="text-align:center;">
				MWMO
			</td>
			<td style="text-align:center;">
				varies
			</td>
			<td style="text-align:left;">
				Map World Map Object
			</td>
			<td style="text-align:left;">
				If there is no terrain in a map (e.g. Deeprun Tram), all entries in the MAIN Chunk are 0. In this, and ONLY in this case, the MWMO Chunk contains exactly one WMO File Name (Zero Terminated).
			</td>
		</tr><tr><td style="text-align:center;">
				MODF
			</td>
			<td style="text-align:center;">
				64 bytes
			</td>
			<td style="text-align:left;">
				MODF Chunk
			</td>
			<td style="text-align:left;">
				If the MWMO Chunk is not empty, MODF contains placement information for the WMO.
			</td>
		</tr></tbody></table><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">Offset Type     Description
--------------------------------------------------------------
 00h   uint32   ID (index in the MWID list)
 04h   uint32   unique identifier for this instance
 08h   float[3] Position (X,Y,Z)
 14h   float[3] Orientation (A,B,C)
 20h   float[6] Bounding Box
 38h   uint16   Flags
 3Ah   uint16   Doodad set index
 3Ch   uint16   Name set?
 3Eh   uint16   Padding</span></pre>
]]></description><guid isPermaLink="false">20027</guid><pubDate>Mon, 01 Aug 2016 11:53:41 +0000</pubDate></item><item><title>WMO File</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/wmo-file-r20030/</link><description><![CDATA[<p>
	WMO files contain world map objects. They, too, have a chunked structure just like the WDT files.
</p>

<p>
	There are two types of WMO/v17 files, actually:
</p>

<p>
	WMO root file - lists textures (BLP Files), doodads (M2 or MDX Files), etc., and orientation for the WMO/v17 groups
</p>

<p>
	WMO group file - 3d model data for one unit in the world map object
</p>

<p>
	The root file and the groups are stored with the following filenames:
</p>

<p>
	World\wmo\path\WMOName.wmo
</p>

<p>
	World\wmo\path\WMOName_NNN.wmo
</p>

<p>
	There is a hardcoded maximum of 512 group files per root object.
</p>

<h1>
	<span>WMO root file</span>
</h1>

<p>
	The root file lists the following:
</p>

<ul><li>
		textures (<a href="https://wowdev.wiki/BLP" rel="external nofollow" title="BLP"><u><font color="#0066cc">BLP</font></u></a> File references)
	</li>
	<li>
		materials
	</li>
	<li>
		models (<a href="https://wowdev.wiki/M2" rel="external nofollow" title="M2"><u><font color="#0066cc">MDX / M2</font></u></a> File references)
	</li>
	<li>
		groups
	</li>
	<li>
		visibility information
	</li>
	<li>
		more data
	</li>
</ul><h2>
	<span>MOHD chunk</span>
</h2>

<ul><li>
		<b>Header for the map object. 64 bytes.</b>
	</li>
</ul><pre class="ipsCode prettyprint lang-html prettyprinted">
<span class="pln">struct SMOHeader{
/*000h*/  uint32_t nTextures;   
/*004h*/  uint32_t nGroups;   
/*008h*/  uint32_t nPortals;  
/*00Ch*/  uint32_t nLights;   
/*010h*/  uint32_t nDoodadNames;
/*014h*/  uint32_t nDoodadDefs;
/*018h*/  uint32_t nDoodadSets;   
/*01Ch*/  CArgb color; // Color settings for base (ambient) color. See the flag at /*03Ch*/.  
/*020h*/  foreign_key</span><span class="tag">&lt;uint32_t</span><span class="pln">, &amp;::</span><span class="atn">m_WMOID</span><span class="tag">&gt;</span><span class="pln"> wmoID;
/*024h*/  CAaBox bounding_box;
/*03Ch*/  uint16_t flag_attenuate_vertices_based_on_distance_to_portal : 1;
/*03Ch*/  uint16_t flag_skip_base_color : 1;        // do not add base (ambient) color (of MOHD) to MOCVs.
                                                    // apparently does more, e.g. required for multiple MOCVs
/*03Ch*/  uint16_t flag_liquid_related : 1;         // fills the whole WMO with water (used for underwater WMOs).
                                                    // (possibly - LiquidType related, see below in the MLIQ).
/*03Ch*/  uint16_t flag_has_some_outdoor_group : 1; // possibly - has some group that is outdoors
/*03Ch*/  uint16_t Flag_Lod : 1;                    // ≥  (20740) 
/*03Ch*/  uint16_t : 11;                            // unused as of  (20994)
/*03Eh*/  uint16_t numLod;                          // ≥  (21108)  includes base lod header;
                                                    // (→ numLod = 3 means '.wmo', 'lod0.wmo' and 'lod1.wmo')}</span></pre>

<h2>
	<span>MOTX chunk</span>
</h2>

<ul><li>
		<b>List of textures (<a href="https://wowdev.wiki/BLP" rel="external nofollow" title="BLP"><u><font color="#0066cc">BLP</font></u></a> Files) used in this map object. <del>There are nTextures entries in this chunk.</del></b>
	</li>
</ul><p>
	A block of <del>zero-padded, zero-terminated strings,</del> that are complete filenames with paths. There will be further material information for each texture in the next chunk. The gaps between the filenames are padded with extra zeroes, but the material chunk does have some positional information for these strings.
</p>

<pre>
char texture_filenames[];
</pre>

<p>
	The beginning of a string is always aligned to a 4Byte Adress. (0, 4, 8, C). The end of the string is Zero terminated and filled with zeros until the next aligment. Sometimes there also empty aligtments for no (it seems like no) real reason.
</p>

<h2>
	<span>MOMT chunk</span>
</h2>

<ul><li>
		<b>Materials used in this map object, 64 bytes per texture (<a href="https://wowdev.wiki/BLP" rel="external nofollow" title="BLP"><u><font color="#0066cc">BLP</font></u></a> file), nMaterials entries.</b>
	</li>
</ul><pre>
struct SMOMaterial
{
  uint32_t flag_0x1 : 1;                   // ? (I'm not sure atm I tend to use lightmap or something like this)
  uint32_t flag_0x2 : 1;
  uint32_t flag_no_backface_culling : 1;   // two-sided
  uint32_t flag_darkened : 1;              // ?, the intern face of windows are flagged 0x08
  uint32_t flag_bright_at_night : 1;       // (unshaded) (used on windows and lamps in Stormwind, for example)
  uint32_t flag_0x20 : 1;
  uint32_t flag_clamp : 1;                 // ?, looks like GL_CLAMP
  uint32_t flag_repeat : 1;                // ?, looks like GL_REPEAT
  uint32_t flag_0x100 : 1;
  uint32_t : 23;                           // unused as of 7.0.1.20994
/*004h*/  uint32_t shader;                 // Index into CMapObj::s_wmoShaderMetaData. See below (shader types).
/*008h*/  uint32_t blendMode;              // Blending: 0 for opaque, 1 for transparent
/*00Ch*/  uint32_t texture_0;              // offset into MOTX
/*010h*/  uint32_t color_0;                // rgba8 (four uint8s)
/*014h*/  uint32_t flags_0;
/*018h*/  uint32_t texture_1;
/*01Ch*/  uint32_t color_1;
/*020h*/  foreign_key&lt;uint32_t, &amp;::m_ID&gt; ground_type;            // according to CMapObjDef::GetGroundType
/*024h*/  uint32_t texture_2;
/*028h*/  uint32_t color_2;
/*02Ch*/  uint32_t flags_2;
/*030h*/  uint32_t runTimeData[4];         // This data is explicitly nulled upon loading. Contains textures or similar stuff.
/*034h*/
/*038h*/
/*03Ch*/
/*040h*/
} materials[];
</pre>

<p>
	texture_1, 2 and 3 are start positions for texture filenames in the <a href="https://wowdev.wiki/WMO/v17#MOTX_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOTX</font></u></a> data block ; texture_1 for the first texture, texture_2 for the second (see shaders), etc. texture_1 defaults to "createcrappygreentexture.blp".
</p>

<p>
	color_2 is diffuse color : <tt>CWorldView::GatherMapObjDefGroupLiquids(): geomFactory-&gt;SetDiffuseColor((CImVector<a href="https://wowdev.wiki/Common_Types#CImVector" rel="external nofollow" title="Common Types"><u><font color="#0066cc">ⁱ</font></u></a>*)(smo+7));</tt>
</p>

<p>
	The flags might used to tweak alpha testing values, I'm not sure about it, but some grates and flags in IF seem to require an alpha testing threshold of 0, at other places this is greater than 0.
</p>

<h3>
	<span>Shader types</span>
</h3>

<p>
	Depending on the shader, a different amount of textures is required. If there aren't enough filenames given, it defaults to Opaque (with one filename). More filenames than required are just ignored.
</p>

<p>
	Data is from 15464.
</p>

<table cellpadding="5" cellspacing="5"><tbody><tr><th>
				value
			</th>
			<th>
				name
			</th>
			<th>
				textures without shader
			</th>
			<th>
				textures with shader
			</th>
			<th>
				texcoord count
			</th>
			<th>
				color count
			</th>
		</tr><tr><td>
				0
			</td>
			<td>
				Diffuse
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				1
			</td>
			<td>
				Specular
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				2
			</td>
			<td>
				Metal
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				3
			</td>
			<td>
				Env
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				4
			</td>
			<td>
				Opaque
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				5
			</td>
			<td>
				EnvMetal
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				6
			</td>
			<td>
				TwoLayerDiffuse
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				7
			</td>
			<td>
				TwoLayerEnvMetal
			</td>
			<td>
				1
			</td>
			<td>
				3
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				8
			</td>
			<td>
				TwoLayerTerrain
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				automatically adds _s in the filename of the second texture
			</td>
		</tr><tr><td>
				9
			</td>
			<td>
				DiffuseEmissive
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				10
			</td>
			<td>
				 
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				Seems to be invalid. Does something with MOTA (tangents).
			</td>
		</tr><tr><td>
				11
			</td>
			<td>
				MaskedEnvMetal
			</td>
			<td>
				1
			</td>
			<td>
				3
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				12
			</td>
			<td>
				EnvMetalEmissive
			</td>
			<td>
				1
			</td>
			<td>
				3
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				13
			</td>
			<td>
				TwoLayerDiffuseOpaque
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				14
			</td>
			<td>
				TwoLayerDiffuseEmissive
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				Seems to be invalid. Does something with MOTA (tangents).
			</td>
		</tr><tr><td>
				15
			</td>
			<td>
				 
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				16
			</td>
			<td>
				Diffuse
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				SMOMaterial::SH_DIFFUSE_TERRAIN -- "Blend Material": used for blending WMO with terrain (dynamic blend batches)
			</td>
		</tr></tbody></table><p>
	tex coord and color count decide vertex buffer format: EGxVertexBufferFormat_PNC<i>2</i>T<i>2</i>
</p>

<h3>
	<span>Shader types (18179)</span>
</h3>

<table cellpadding="5" cellspacing="5"><tbody><tr><th>
				value
			</th>
			<th>
				#textures without shader
			</th>
			<th>
				#textures with shader
			</th>
			<th>
				texcoord count
			</th>
			<th>
				color count
			</th>
		</tr><tr><td>
				0 - Diffuse
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				1 - Specular
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				2 - Metal
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				3 - Env
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				4 - Opaque
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				5 - EnvMetal
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
		</tr><tr><td>
				6 - TwoLayerDiffuse
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				7 - TwoLayerEnvMetal
			</td>
			<td>
				1
			</td>
			<td>
				3
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				8 - TwoLayerTerrain
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				automatically adds _s in the filename of the second texture
			</td>
		</tr><tr><td>
				9 - DiffuseEmissive
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				10 - waterWindow
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				automatically generates MOTA
			</td>
		</tr><tr><td>
				11 - MaskedEnvMetal
			</td>
			<td>
				1
			</td>
			<td>
				3
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				12 - EnvMetalEmissive
			</td>
			<td>
				1
			</td>
			<td>
				3
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				13 - TwoLayerDiffuseOpaque
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				14 - submarineWindow
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				automatically generates MOTA
			</td>
		</tr><tr><td>
				15 - TwoLayerDiffuseEmissive
			</td>
			<td>
				1
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr><tr><td>
				16 - DiffuseTerrain
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				1
			</td>
			<td>
				SMOMaterial::SH_DIFFUSE_TERRAIN -- "Blend Material": used for blending WMO with terrain (dynamic blend batches)
			</td>
		</tr><tr><td>
				17 - AdditiveMaskedEnvMetal
			</td>
			<td>
				1
			</td>
			<td>
				3
			</td>
			<td>
				2
			</td>
			<td>
				2
			</td>
		</tr></tbody></table><h3>
	<span>void CMapObj::CreateMaterial (unsigned int materialId)</span>
</h3>

<pre>
void CMapObj::CreateMaterial (unsigned int materialId)
{
  assert (m_materialCount);
  assert (m_materialTexturesList);
  assert (materialId &lt; m_materialCount);

  if (++m_materialTexturesList[materialId].refcount &lt;= 1)
  {
    SMOMaterial* material = &amp;m_smoMaterials[materialId];

    const char* texNames[3];
    texNames[0] = &amp;m_textureFilenamesRaw[material-&gt;firstTextureOffset];
    texNames[1] = &amp;m_textureFilenamesRaw[material-&gt;secondTextureOffset];
    texNames[2] = &amp;m_textureFilenamesRaw[material-&gt;thirdTextureOffset];
    if ( *texNames[0] )
      texNames[0] = "createcrappygreentexture.blp";

    assert (material-&gt;shader &lt; SMOMaterial::SH_COUNT);

    int const textureCount
      ( CShaderEffect::s_enableShaders
      ? s_wmoShaderMetaData[material-&gt;shader].texturesWithShader
      : s_wmoShaderMetaData[material-&gt;shader].texturesWithoutShader
      );

    int textures_set (0);

    for (; textures_set &lt; textureCount; ++textures_set)
    {
      if (!texNames[textures_set])
      {
        material-&gt;shader = MapObjOpaque;
        textures_set = 1;
        break;
      }
    }

    for (; textures_set &lt; 3; ++textures_set)
    {
      texNames[textures_set] = nullptr;
    }

    if (material-&gt;shader == MapObjTwoLayerTerrain &amp;&amp; texNames[1])
    {
      texNames[1] = insert_specular_suffix (texNames[1]);
    }

    int flags (std::max (m_field_2C, 12));

    const char* parent_name (m_field_9E8 &amp; 1 ? m_filename : nullptr);

    m_materialTexturesList[materialId]-&gt;textures[0] = texNames[0] ? CMap::CreateTexture (texNames[0], parent_name, flags) : nullptr;
    m_materialTexturesList[materialId]-&gt;textures[1] = texNames[1] ? CMap::CreateTexture (texNames[1], parent_name, flags) : nullptr;
    m_materialTexturesList[materialId]-&gt;textures[2] = texNames[2] ? CMap::CreateTexture (texNames[2], parent_name, flags) : nullptr;
  }
}
</pre>

<h2>
	<span>MOGN chunk</span>
</h2>

<ul><li>
		<b>List of group names for the groups in this map object.</b>
	</li>
</ul><pre>
char group_names[];
</pre>

<p>
	A contiguous block of zero-terminated strings. The names are purely informational except for "antiportal". The names are referenced from MOGI and MOGP.
</p>

<p>
	There are <b>not</b> always nGroups entries in this chunk as it contains extra empty strings and descriptive names. It (always ?) begins with two empty strings, so 0x00 0x00, and is 4-byte padded at the end of the chunk only. The names are indeed referenced in MOGI, and both the name and a descriptive name are referenced in the group file header (2 firsts uint16 of MOGP).
</p>

<h2>
	<span>MOGI chunk</span>
</h2>

<ul><li>
		<b>Group information for WMO groups, 32 bytes per group, nGroups entries.</b>
	</li>
</ul><pre>
struct SMOGroupInfo
{
#if version &lt; ? 
  uint32_t offset;
  uint32_t size;
#endif
/*000h*/  uint32_t flags;      //  see , they are equivalent
/*004h*/  CAaBox bounding_box;
/*01Ch*/  int32_t nameoffset;  // name in  chunk (-1 for no name)
} groups[];
</pre>

<p>
	Groups don't have placement or orientation information, because the coordinates for the vertices in the additional .<strong>WMO/v17</strong> files are already correctly transformed relative to (0,0,0) which is the entire <strong>WMO/v17</strong>'s base position in model space.
</p>

<p>
	The name offsets point to the position in the file relative to the MOGN header.
</p>

<h2>
	<span>MOSB chunk</span>
</h2>

<ul><li>
		<b>Skybox.</b> Contains an zero-terminated filename for a skybox. (padded to 4 byte alignment if "empty"). If the first byte is 0, the skybox flag in all MOGI entries are cleared and there is no skybox.
	</li>
</ul><pre>
char skybox_filename[];
</pre>

<h2>
	<span>MOPV chunk</span>
</h2>

<ul><li>
		<b>Portal vertices, one entry is a float[3], </b>usually<b> 4 * 3 * float per portal</b> (actual number of vertices given in portal entry)
	</li>
</ul><pre>
C3Vector portal_vertices[];
</pre>

<p>
	Portals are polygon planes (usually quads, but they can have more complex shapes) that specify where separation points between groups in a <strong>WMO/v17</strong> are - these are usually doors or entrances, but can be placed elsewhere. Portals are used for occlusion culling, and is a known rendering technique used in many games (among them <i>Unreal Tournament 2004</i> and <i>Descent</i>. See <a href="https://en.wikipedia.org/wiki/Portal_rendering" rel="external nofollow"><u><font color="#0066cc">Portal Rendering on Wikipeda</font></u></a> and <a href="https://en.wikipedia.org/wiki/Antiportal" rel="external nofollow"><u><font color="#0066cc">Antiportal on Wikipedia</font></u></a> for more information.
</p>

<p>
	Since when "playing" WoW, you're confined to the ground, checking for passing through these portals would be enough to toggle visibility for indoors or outdoors areas, however, when randomly flying around, this is not necessarily the case.
</p>

<p>
	So.... What happens when you're flying around on a gryphon, and you fly into that arch-shaped portal into Ironforge? How is that portal calculated? It's all cool as long as you're inside "legal" areas, I suppose.
</p>

<p>
	It's fun, you can actually map out the topology of the <strong>WMO/v17</strong> using this and the <a href="https://wowdev.wiki/WMO/v17#MOPR_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOPR</font></u></a> chunk. This could be used to speed up the rendering once/if I figure out how.
</p>

<h2>
	<span>MOPT chunk</span>
</h2>

<ul><li>
		<b>Portal information. 20 bytes per portal, nPortals entries.</b> There is a hardcoded maximum of 128 portals in a single WMO.
	</li>
</ul><pre>
struct SMOPortal
{
  uint16_t base_index;
  uint16_t index_count;
  C4Plane  plane;
} portals[];
</pre>

<p>
	This structure describes one portal separating two WMO groups. A single portal is usually made up of four vertices in a quad (starting at base_index and going to base_index + index_count). However, portals support more complex shapes, and can fully encompass holes such as the archway leading into Ironforge and parts of the Caverns of Time.
</p>

<p>
	It is likely that portals are drawn as GL_TRIANGLE_STRIP in WoW's occlusion pipeline, since some portals have a vertex count that is not evenly divisible by four. One example of this is portal #21 in CavernsOfTime.wmo from Build #5875 (WoW 1.12.1), which has 10 vertices.
</p>

<h2>
	<span>MOPR chunk</span>
</h2>

<ul><li>
		Map Object Portal References from groups. Mostly twice the number of portals. Actual count defined by sum (MOGP.portals_used).
	</li>
</ul><pre>
struct SMOPortalRef<i> // 04-29-2005 By ObscuR</i>
{
  uint16_t portal_index;  // into MOPR
  uint16_t group_index;   // the other one
  int16_t side;           // positive or negative.
  uint16_t unk;
} portal_references[];
</pre>

<h2>
	<span>MOVV chunk</span>
</h2>

<ul><li>
		<b>Visible block vertices</b>, 0xC byte per entry.
	</li>
</ul><p>
	Just a list of vertices that corresponds to the visible block list.
</p>

<pre>
C3Vector visible_block_vertices[];
</pre>

<h2>
	<span>MOVB chunk</span>
</h2>

<ul><li>
		<b>Visible block list</b>
	</li>
</ul><pre>
struct
{
  uint16_t firstVertex;
  uint16_t count;
) visible_blocks[];
</pre>

<h2>
	<span>MOLT chunk</span>
</h2>

<ul><li>
		<b>Lighting information. 48 bytes per light, nLights entries</b>
	</li>
</ul><pre>
struct SMOLight
{
  enum LightType
  {
    OMNI_LGT = 0,
    SPOT_LGT = 1,
    DIRECT_LGT = 2,
    AMBIENT_LGT = 3,
  };
  /*000h*/  uint8_t type;
  /*001h*/  uint8_t useAtten;
  /*002h*/  uint8_t pad[2];
  /*004h*/  CImVector color;
  /*008h*/  C3Vector position;
  /*014h*/  float intensity;
  /*018h*/  float attenStart;
  /*01Ch*/  float attenEnd;
  /*020h*/  float unk[4];
} lights[];
</pre>

<p>
	First 4 uint8_t are probably flags, mostly with the values (0,1,1,1).
</p>

<p>
	I haven't quite figured out how WoW actually does lighting, as it seems much smoother than the regular vertex lighting in my screenshots. The light paramters might be range or attenuation information, or something else entirely. Some <strong>WMO/v17</strong> groups reference a lot of lights at once.
</p>

<p>
	The WoW client (at least on my system) uses only one light, which is always directional. Attenuation is always (0, 0.7, 0.03). So I suppose for models/doodads (both are <a href="https://wowdev.wiki/M2" rel="external nofollow" title="M2"><u><font color="#0066cc">M2</font></u></a> files anyway) it selects an appropriate light to turn on. Global light is handled similarly. Some <strong>WMO/v17</strong> textures (<a href="https://wowdev.wiki/BLP" rel="external nofollow" title="BLP"><u><font color="#0066cc">BLP</font></u></a> files) have specular maps in the alpha channel, the pixel shader renderpath uses these. Still don't know how to determine direction/color for either the outdoor light or <strong>WMO/v17</strong> local lights... :)
</p>

<p>
	The entire MOLT and related chunks seem to be unused at least in 3.3.5a. Changing light colors and other settings on original WMOs leads to no effect. Removing the light leads to no effect either. I assume that MOLT rendering is disabled somewhere in the WoW.exe, as it might use the same principle as the M2 light emitters which are not properly supported up to WoD. However, when you explore the WMOs in 3D editors you can clearly see that MOCV layer is different under those lamps. So, I assume they are used for baking MOCV colors and also written to the actual file in case the renderer will ever get updated, or just because you can easily import the WMO back and rebake the colors. --- <a href="https://wowdev.wiki/index.php?title=User:Skarn&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Skarn (page does not exist)"><u><font color="#0066cc">Skarn</font></u></a> (<a href="https://wowdev.wiki/index.php?title=User_talk:Skarn&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User talk:Skarn (page does not exist)"><u><font color="#0066cc">talk</font></u></a>)
</p>

<h2>
	<span>MODS chunk</span>
</h2>

<ul><li>
		<b>This chunk defines doodad sets.</b>
	</li>
</ul><p>
	Doodads in WoW are <a href="https://wowdev.wiki/M2" rel="external nofollow" title="M2"><u><font color="#0066cc">M2</font></u></a> model files. There are 32 bytes per doodad set, and nSets entries. Doodad sets specify several versions of "interior decoration" for a <strong>WMO/v17</strong>. Like, a small house might have tables and a bed laid out neatly in one set called "Set_$DefaultGlobal", and have a horrible mess of abandoned broken things in another set called "Set_Abandoned01". The names are only informative.
</p>

<p>
	The doodad set number for every WMO instance is specified in the <a href="https://wowdev.wiki/ADT" rel="external nofollow" title="ADT"><u><font color="#0066cc">ADT</font></u></a> files.
</p>

<pre>
struct SMODoodadSet
{
/*000h*/  char     name[20];            // set name
/*014h*/  uint32_t firstinstanceindex;  // index of first doodad instance in this set
/*018h*/  uint32_t numDoodads;          // number of doodad instances in this set
/*01Ch*/  uint32_t unused;
} doodad_sets[];
</pre>

<p>
	firstinstanceindex is not the name index, but the actual order the doodads come in the MODD chunk in the WMO -MaiN
</p>

<h2>
	<span>MODN chunk</span>
</h2>

<ul><li>
		<b>List of filenames for <a href="https://wowdev.wiki/M2" rel="external nofollow" title="M2"><u><font color="#0066cc">M2</font></u></a> (<a href="https://wowdev.wiki/MDX" rel="external nofollow" title="MDX"><u><font color="#0066cc">mdx</font></u></a>) models that appear in this <strong>WMO/v17</strong>.</b>
	</li>
</ul><p>
	A block of zero-padded, zero-terminated strings. There are nModels file names in this list. They have to be .<a href="https://wowdev.wiki/MDX" rel="external nofollow" title="MDX"><u><font color="#0066cc">MDX</font></u></a>!
</p>

<pre>
char doodad_filenames[];
</pre>

<h2>
	<span>MODD chunk</span>
</h2>

<ul><li>
		<b>Information for doodad instances. 40 bytes per doodad instance, nDoodads entries.</b>
	</li>
</ul><p>
	-- There are not nDoodads entries here! Divide the chunk length by 40 to get the correct amount.
</p>

<p>
	While <strong>WMO/v17s</strong> and models (<a href="https://wowdev.wiki/M2" rel="external nofollow" title="M2"><u><font color="#0066cc">M2s</font></u></a>) in a map tile are rotated along the axes, doodads within a <strong>WMO/v17</strong> are oriented using quaternions! Hooray for consistency!
</p>

<p>
	I had to do some tinkering and mirroring to orient the doodads correctly using the quaternion, see model.cpp in the WoWmapview source code for the exact transform matrix. It's probably because I'm using another coordinate system, as a lot of other coordinates in <strong>WMO/v17s</strong> and models also have to be read as (X,Z,-Y) to work in my system. But then again, the <a href="https://wowdev.wiki/ADT" rel="external nofollow" title="ADT"><u><font color="#0066cc">ADT</font></u></a> files have the "correct" order of coordinates. Weird.
</p>

<pre>
struct SMODoodadDef
{
  /*000h*/  uint32_t name_offset : 24;        // reference offset into 
  /*003h*/  uint32_t flag_AcceptProjTex : 1;
  /*003h*/  uint32_t flag_0x2 : 1;            // MapStaticEntity::field_34 |= 1
  /*003h*/  uint32_t flag_0x4 : 1;
  /*003h*/  uint32_t flag_0x8 : 1;
  /*003h*/  uint32_t : 4;                     // unused as of 7.0.1.20994
  /*004h*/  C3Vector position;                // (X,Z,-Y)
  /*010h*/  C4Quaternion orientation;         // (X, Y, Z, W)
  /*020h*/  float scale;                      // scale factor
  /*024h*/  CImVector color;                 // (B,G,R,A) lightning color
} doodad_definitions[];
</pre>

<p>
	It looks like in order to get correct picture the color from SMODoodadDef should be applied only to opaque submeshes of M2. <a href="https://wowdev.wiki/index.php?title=User:Deamon&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Deamon (page does not exist)"><u><font color="#0066cc">Deamon</font></u></a> (<a href="https://wowdev.wiki/index.php?title=User_talk:Deamon&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User talk:Deamon (page does not exist)"><u><font color="#0066cc">talk</font></u></a>)
</p>

<p>
	 
</p>

<ul><li>
		How to compute a matrix to map WMO's M2 to world coordinates
	</li>
</ul><p>
	The coordinate system here is WMO's local coordinate system. It's Z-up already, that differs it from Y-up in <b><a href="https://wowdev.wiki/ADT#MODF_chunk" rel="external nofollow" title="ADT"><u><font color="#0066cc">MODF(ADT)</font></u></a></b>, <b><a href="https://wowdev.wiki/WDT#MODF_chunk" rel="external nofollow" title="WDT"><u><font color="#0066cc">MODF(WDT)</font></u></a></b> and <b><a href="https://wowdev.wiki/ADT#MDDF_chunk" rel="external nofollow" title="ADT"><u><font color="#0066cc">MDDF</font></u></a></b> chunks. To compute the whole placement matrix for doodad you would need take positionMatrix of WMO from <b><a href="https://wowdev.wiki/ADT#MODF_chunk" rel="external nofollow" title="ADT"><u><font color="#0066cc">MODF(ADT)</font></u></a></b> or <b><a href="https://wowdev.wiki/WDT#MODF_chunk" rel="external nofollow" title="WDT"><u><font color="#0066cc">MODF(WDT)</font></u></a></b> and multiply it by positionMatrix calculated here.
</p>

<p>
	Example implementation in js with gl-matrix library:
</p>

<pre>
function createPlacementMatrix(modd, wmoPlacementMatrix){
    var placementMatrix = mat4.create();
    mat4.identity(placementMatrix);
    mat4.multiply(placementMatrix, placementMatrix, wmoPlacementMatrix);

    mat4.translate(placementMatrix, placementMatrix, [modd.pos[0],modd.pos[1], modd.pos[2]]);

    var orientMatrix = mat4.create();
    mat4.fromQuat(orientMatrix,
        [modd.rotation[0], //imag.x
        modd.rotation[1],  //imag.y,
        modd.rotation[2],  //imag.z,
        modd.rotation[3]   //real
        ]
    );
    mat4.multiply(placementMatrix, placementMatrix, orientMatrix);

    mat4.scale(placementMatrix, placementMatrix, [modd.scale, modd.scale, modd.scale]);
    return placementMatrix;
}
</pre>

<h2>
	<span>MFOG chunk</span>
</h2>

<ul><li>
		<b>Fog information. Made up of blocks of 48 bytes.</b>
	</li>
</ul><pre>
struct SMOFog
{
  /*000h*/  uint32_t flag_infinite_radius : 1; // F_IEBLEND: Ignore radius in CWorldView::QueryCameraFog
  /*000h*/  uint32_t : 3;                      // unused as of 7.0.1.20994
  /*000h*/  uint32_t flag_0x10 : 1;
  /*000h*/  uint32_t : 27;                     // unused as of 7.0.1.20994
  /*004h*/  C3Vector pos;
  /*010h*/  float smaller_radius;              // start
  /*014h*/  float larger_radius;               // end
            struct
            {
  /*018h*/    float end;
  /*01Ch*/    float start_scalar;              // (0..1)
  /*020h*/    CImVector color;                // The back buffer is also cleared to this colour
            } fog;
            struct
            {
  /*024h*/    float end;
  /*028h*/    float start_scalar;              // (0..1)
  /*02Ch*/    CImVector color;
            } underwater_fog;
} fogs[];
</pre>

<ul><li>
		Fog end: This is the distance at which all visibility ceases, and you see no objects or terrain except for the fog color.
	</li>
	<li>
		Fog start: This is where the fog starts. Obtained by multiplying the fog end value by the fog start multiplier.
	</li>
</ul><h2>
	<span>MCVP chunk (optional)</span>
</h2>

<ul><li>
		<b>Convex Volume Planes. Contains blocks of floating-point numbers.</b> 0x10 bytes (4 floats) per entry.
	</li>
</ul><pre>
C4Plane convex_volume_planes[];   // normal points out
</pre>

<p>
	These are used to define the volume of when you are inside this WMO. Important for transports. If a point is behind all planes (i.e. point-plane distance is negative for all planes), it is inside.
</p>

<h2>
	<span>GFID (Legion+)</span>
</h2>

<ul><li>
		required when WMO is load from fileID (e.g. game objects)
	</li>
</ul><pre>
struct {
    uint32 id[MOHD.nGroups];
} groupFileDataIDs[ !MOHD.Flag_Lod ? 1
                  : MOHD.numLod ? MOHD.numLod : 3   // fallback for missing numLod: assume numLod=2+1base
                  ];
</pre>

<h1>
	<span>WMO group file</span>
</h1>

<p>
	WMO group files contain the actual polygon soup for a particular section of the entire <strong>WMO/v17</strong>.
</p>

<p>
	Every group file has one top-level <a href="https://wowdev.wiki/WMO/v17#MOGP_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOGP</font></u></a> chunk, that has a 68-byte header followed by more subchunks. So it can be effectively treated as a file with a header at 0x14 and chunks starting at 0x58.
</p>

<p>
	The subchunks are not always present. Some are fixed and needed while others are only checked for if some flags in the header are set. The chunks <b>need</b> to be in the right order if you want WoW to read it.
</p>

<p>
	The following chunks are always present in the following order:
</p>

<ul><li>
		<a href="https://wowdev.wiki/WMO/v17#MOGP_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOGP</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOPY_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOPY</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOVI_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOVI</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOVT_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOVT</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MONR_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MONR</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOTV_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOTV</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOBA_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOBA</font></u></a>
	</li>
</ul><p>
	These chunks are only present if a flag in the header is set. See the list below for the flags.
</p>

<ul><li>
		Cataclysm introduced a new optional MOBS chunk, I guess it's related to <a href="https://wowdev.wiki/WMO/v17#MOBA_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOBA</font></u></a>. ---<a href="https://wowdev.wiki/index.php?title=User:Bananenbrot&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Bananenbrot (page does not exist)"><u><font color="#0066cc">Bananenbrot</font></u></a>, 12-18-2010
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOLR_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOLR</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MODR_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MODR</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOBN_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOBN</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOBR_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOBR</font></u></a>
	</li>
	<li>
		MPBV
	</li>
	<li>
		MPBP
	</li>
	<li>
		MPBI
	</li>
	<li>
		MPBG
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOCV_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOCV</font></u></a>
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MLIQ_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MLIQ</font></u></a>
	</li>
	<li>
		MORI
	</li>
	<li>
		MORB
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOTV_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOTV</font></u></a> 2
	</li>
	<li>
		<a href="https://wowdev.wiki/WMO/v17#MOCV_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOCV</font></u></a> 2
	</li>
</ul><h2>
	<span>MOGP chunk</span>
</h2>

<p>
	Note: In its header is given a wrong size. Just use 0x44. -eLaps
</p>

<ul><li>
		Actually, the size is correct, the other chunks are just subchunks of MOGP :) ---<a href="https://wowdev.wiki/index.php?title=User:Tigurius&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Tigurius (page does not exist)"><u><font color="#0066cc">Tigurius</font></u></a>
	</li>
</ul><pre>
<b>Offset	Type		Description</b>
0x00 	uint32 		Group name (offset into  chunk)
0x04 	uint32 		Descriptive group name (offset into  chunk)
0x08 	uint32 		Flags
0x0C 	float[3] 	Bounding box corner 1 (same as in )
0x18 	float[3] 	Bounding box corner 2
0x24 	uint16 		Index into the  chunk
0x26 	uint16 		Number of items used from the  chunk
0x28 	uint16 		Number of batches A
0x2A 	uint16 		Number of batches interior
0x2C 	uint16 		Number of batches exterior
0x2E 	uint16 		unk(padding?) 
0x30 	uint8[4] 	Up to four indices into the WMO fog list
0x34 	uint32 		LiquidType, not always directly used: see below in the MLIQ chunk.
0x38 	foreign_key&lt;uint32_t, &amp;::m_WMOGroupID&gt; 		WMO group ID
0x3C 	uint32 		&amp;1: WoD(?)+ CanCutTerrain (by MOPL planes), others (UNUSED: 20740)
0x40 	uint32 		(UNUSED: 20740)
</pre>

<p>
	The fields referenced from the <a href="https://wowdev.wiki/WMO/v17#MOPR_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOPR</font></u></a> chunk indicate portals leading out of the <strong>WMO/v17</strong> group in question.
</p>

<p>
	For the "Number of batches" fields, A + batches_interior + batches_exterior == the total number of batches in the <strong>WMO/v17</strong> group (in the <a href="https://wowdev.wiki/WMO/v17#MOBA_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOBA</font></u></a> chunk). This might be some kind of LOD thing, or just separating the batches into different types/groups...?
</p>

<p>
	Flags: always contain more information than flags in <a href="https://wowdev.wiki/WMO/v17#MOGI_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOGI</font></u></a>. I suppose <a href="https://wowdev.wiki/WMO/v17#MOGI_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOGI</font></u></a> only deals with topology/culling, while flags here also include rendering info.
</p>

<h3>
	<span>group flags</span>
</h3>

<pre>
<b>Flag		Meaning</b>
0x1		Has  and  chunk.
0x2		(UNUSED: 20740) possibly: subtract mohd.color in mocv fixing 
0x4 		Has vertex colors ( chunk).
0x8 		SMOGroup::EXTERIOR -- Outdoor
0x10		(UNUSED: 20740)
0x20		(UNUSED: 20740)
0x40            "Do not use local diffuse lightning". Applicable for both doodads from this wmo group(color from MODD) and water(CWorldView::GatherMapObjDefGroupLiquids). 
0x80 		SMOGroup::UNREACHABLE
0x100
0x200 		Has lights  ( chunk)
0x400		&lt;= Cataclysm: Has MPBV, MPBP, MPBI, MPBG chunks, neither 3.3.5a nor Cataclysm alpha actually use them though, but just skips them. Legion+(?): Also load for LoD != 0 (_lod* groups)
0x800 		Has doodads ( chunk)
0x1000		SMOGroup::LIQUIDSURFACE -- Has water   ( chunk)
0x2000		SMOGroup::INTERIOR -- Indoor
0x4000		(UNUSED: 20740)
0x8000
0x10000         SMOGroup::ALWAYSDRAW -- clear 0x8 after CMapObjGroup::Create() in MOGP and MOGI
0x20000		(UNUSED: 20740) Has MORI and MORB chunks.
0x40000		Show skybox -- automatically unset if MOSB not present.
0x80000		is_not_water_but_ocean, LiquidType related, see below in the MLIQ chunk.
0x100000
0x200000
0x400000	(UNUSED: 20740)
0x800000
0x1000000	SMOGroup::CVERTS2: Has two MOCV chunks: Just add two or don't set 0x4 to only use cverts2.
0x2000000	SMOGroup::TVERTS2: Has two MOTV chunks: Just add two.
0x4000000     Just call CMapObjGroup::CreateOccluders() independent of groupname being "antiportal". requires intBatchCount == 0, extBatchCount == 0, UNREACHABLE.
0x8000000     unk. requires intBatchCount == 0, extBatchCount == 0, UNREACHABLE.
0x10000000	(UNUSED: 20740)
0x20000000	(UNUSED: 20740)
0x40000000	SMOGroup::TVERTS3: Has three MOTV chunks, eg. for MOMT with shader 18.
0x80000000
</pre>

<h3>
	<span>"antiportal"</span>
</h3>

<p>
	If a group wmo is named "antiportal", CMapObjGroup::CreateOccluders() is called and group flags 0x4000000 and 0x80 are set automatically in both, MOGP and MOGI. Also, the BSP tree is cleared and batch_count[interior] and [exterior] is set to 0. If flags &amp; 0x4000000 is set, just CMapObjGroup::CreateOccluders() is called, without setting flags or clearing bsp.
</p>

<pre>
void CMapObjGroup::CreateOccluders()
{
  for ( unsigned int mopy_index (0), movi_index (0)
      ; mopy_index &lt; this-&gt;mopy_count
      ; ++mopy_index, ++movi_index
      ) 
  {
    C3Vector* points[3] = 
      { &amp;this-&gt;m_vertices[this-&gt;movi[movi_index].points[0]]
      , &amp;this-&gt;m_vertices[this-&gt;movi[movi_index].points[1]]
      , &amp;this-&gt;m_vertices[this-&gt;movi[movi_index].points[2]]
      };

    float avg ((points[0]-&gt;z + points[1]-&gt;z + points[2]-&gt;z) / 3.0); 

    unsigned int two_points[2];
    unsigned int two_points_index (0);

    for (unsigned int i (0); i &lt; 3; ++i)
    {
      if (points[i]-&gt;z &gt; avg)
      {
        two_points[two_points_index++] = i;
      }
    }

    if (two_points_index &gt; 1)
    {
      CMapObjOccluder* occluder (CMapObj::AllocOccluder());
      occluder-&gt;p1 = points[two_points[0]];
      occluder-&gt;p2 = points[two_points[1]];

      append (this-&gt;occluders, occluder);
    }
  }
}
</pre>

<h2>
	<span>MOPY chunk</span>
</h2>

<ul><li>
		<b>Material info for triangles, two bytes per triangle. So size of this chunk in bytes is twice the number of triangles in the WMO group.</b>
	</li>
</ul><pre>
struct SMOPoly
{
  struct
  {
    uint8_t F_UNK_0x01: 1;
    uint8_t F_NOCAMCOLLIDE : 1;
    uint8_t F_DETAIL : 1;
    uint8_t F_COLLISION : 1;
    uint8_t F_HINT : 1;
    uint8_t F_RENDER : 1;
    uint8_t F_UNK_0x40 : 1;
    uint8_t F_COLLIDE_HIT : 1;

    bool isTransFace() { return F_UNK_0x01 &amp;&amp; (F_DETAIL || F_RENDER); }
    bool isColor() { return !F_COLLISION; }
    bool isRenderFace() { return F_RENDER &amp;&amp; !F_DETAIL; }
    bool isCollidable() { return F_COLLISION || isRenderFace(); }
  } flags;

#if version &lt; ?
  uint8_t lightmapTex;
#endif
  uint8_t material_id;           // index into , 0xff for collision faces
#if version &lt; ?
  uint8_t padding;
#endif
};
</pre>

<p>
	0xFF is used for collision-only triangles. They aren't rendered but have collision. Problem with it: WoW seems to cast and reflect light on them. Its a bug in the engine. --<a href="https://wowdev.wiki/index.php?title=User:Schlumpf&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Schlumpf (page does not exist)"><u><font color="#0066cc">schlumpf_</font></u></a> 20:40, 7 June 2009 (CEST)
</p>

<p>
	Triangles stored here are more-or-less pre-sorted by texture, so it's ok to draw them sequentially.
</p>

<h2>
	<span>MOVI chunk</span>
</h2>

<ul><li>
		<b>Vertex indices for triangles.</b>, count = size / sizeof(unsigned short). Three 16-bit integers per triangle, that are indices into the vertex list. The numbers specify the 3 vertices for each triangle, their order makes it possible to do backface culling.
	</li>
</ul><h2>
	<span>MOVT chunk</span>
</h2>

<ul><li>
		<b>Vertices chunk.</b>, count = size / (sizeof(float) * 3). 3 floats per vertex, the coordinates are in (X,Z,-Y) order. It's likely that <strong>WMO/v17s</strong> and models (<a href="https://wowdev.wiki/M2" rel="external nofollow" title="M2"><u><font color="#0066cc">M2s</font></u></a>) were created in a coordinate system with the Z axis pointing up and the Y axis into the screen, whereas in OpenGL, the coordinate system used in WoWmapview the Z axis points toward the viewer and the Y axis points up. Hence the juggling around with coordinates.
	</li>
</ul><h2>
	<span>MONR chunk</span>
</h2>

<ul><li>
		<b>Normals.</b> count = size / (sizeof(float) * 3). 3 floats per vertex normal, in (X,Z,-Y) order.
	</li>
</ul><h2>
	<span>MOTV chunk</span>
</h2>

<ul><li>
		<b>Texture coordinates, 2 floats per vertex in (X,Y) order.</b> The values usually range from 0.0 to 1.0, but it's ok to have coordinates out of that range. Vertices, normals and texture coordinates are in corresponding order, of course. Not present in <a href="https://wowdev.wiki/WMO/v17#.22antiportal.22" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">antiportal</font></u></a> WMO groups.
	</li>
</ul><h2>
	<span>MOBA chunk</span>
</h2>

<ul><li>
		<b>Render batches. Records of 24 bytes.</b>
	</li>
</ul><pre>
struct SMOBatch
{
#if version &lt; ?
  uint8_t lightMap;
  uint8_t texture;
#endif
#if  &lt; 
  /*0x00*/ int16_t unknown_box_min[3];              // -2,-2,-1, 2,2,3 in cameron -&gt; seems to be a bounding box for culling
  /*0x06*/ int16_t unknown_box_max[3];
#else
  /*0x00*/ uint8_t unknown[0xA];
  /*0x0A*/ uint16_t material_id_large;              // used if flag_use_uint16_t_material is set.
#endif
#if version &lt; ?
  uint16_t first_index;                             // index of the first face index used in 
#else
  /*0x0C*/ uint32_t first_index;                    // index of the first face index used in 
#endif
  /*0x10*/ uint16_t num_indices;                    // number of indices used
  /*0x12*/ uint16_t first_vertex;                   // index of the first vertex used in 
  /*0x14*/ uint16_t last_vertex;                    // index of the last vertex used (batch includes this one)
  /*0x16*/ uint8_t flag_unknown_1 : 1;
#if ≥  
  /*0x16*/ uint8_t flag_use_material_id_large : 1;  // instead of material_id use material_id_large
#endif
#if version &gt;= ?
  /*0x17*/ uint8_t material_id;                     // index in 
#else
  uint8_t padding;
#endif
};

</pre>

<p>
	Batches are groups of faces with the same material ID in root's MOMT, and they're used to accelerate rendering. Note that the client doesn't use them in the same way while rendering in D3D or OpenGL (only D3D uses all batches information). The vertex buffer containing vertices from first_vertex to last_vertex can contain vertices that aren't used by the batch. On the other hand, if one of the faces used need a vertex, it has to be in the buffer. <del>Concerning the byte at 0x16, as a material ID is coded on a uint8, I guess it is completely unused.</del> --<a href="https://wowdev.wiki/index.php?title=User:Gamhea&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Gamhea (page does not exist)"><u><font color="#0066cc">Gamhea</font></u></a> 12:23, 29 July 2013 (UTC)
</p>

<h3>
	<span>unknown_box</span>
</h3>

<p>
	This seems to be a low resolution bounding box of the contained vertices. The client appears to be using them to do batch-level culling, so if they are set incorrectly, the batch may be randomly disappearing. According to <a href="https://wowdev.wiki/index.php?title=User:Adspartan&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Adspartan (page does not exist)"><u><font color="#0066cc">Adspartan</font></u></a> (<a href="https://wowdev.wiki/index.php?title=User_talk:Adspartan&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User talk:Adspartan (page does not exist)"><u><font color="#0066cc">talk</font></u></a>), the box can be calculated by just iterating over all vertices contained (by following <code>first_vertex</code> and <code>last_vertex</code> to <a href="https://wowdev.wiki/WMO/v17#MOVT" rel="external nofollow"><u><font color="#0066cc">MOVT</font></u></a> and taking the minimum/maximum of those. They should probably be rounded away from zero instead of being truncated on conversion to <code>int16_t</code>.
</p>

<div style="background:rgb(238,238,238);padding:3px;font-size:.8em;border-top-color:rgb(0,0,0);border-bottom-color:rgb(0,0,0);border-top-width:1px;border-bottom-width:1px;border-top-style:dashed;border-bottom-style:dashed;">
	This section only applies to versions ≥ <a href="https://wowdev.wiki/File:Legion-Logo-Small.png" rel="external nofollow"><img alt="Legion" height="15" src="https://wowdev.wiki/images/f/fd/Legion-Logo-Small.png" width="40"></a> .
</div>

<p>
	<code>unknown_box</code> seems no longer used (and nulled). Instead, <code>flag_use_material_id_large</code> can be set to use <code>material_id_large</code> which was the last of <code>unknown_box</code>'s fields. This means that when "retroporting" files, <code>unknown_box</code>'s values need to be calculated (by building minimum and maximum from the corresponding vertices) and <code>material_id</code> should be set, if it can fit a <code>uint8_t</code>. --based on <a href="https://wowdev.wiki/index.php?title=User:Rangorn&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Rangorn (page does not exist)"><u><font color="#0066cc">Rangorn</font></u></a> (<a href="https://wowdev.wiki/index.php?title=User_talk:Rangorn&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User talk:Rangorn (page does not exist)"><u><font color="#0066cc">talk</font></u></a>)
</p>

<h2>
	<span>MOLR chunk</span>
</h2>

<ul><li>
		<b>Light references, one 16-bit integer per light reference.</b>
	</li>
</ul><p>
	This is basically a list of lights used in this <strong>WMO/v17</strong> group, the numbers are indices into the <strong>WMO/v17</strong> root file's <a href="https://wowdev.wiki/WMO/v17#MOLT_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOLT</font></u></a> table.
</p>

<p>
	For some <strong>WMO/v17</strong> groups there is a large number of lights specified here, more than what a typical video card will handle at once. I wonder how they do lighting properly. Currently, I just turn on the first GL_MAX_LIGHTS and hope for the best. :(
</p>

<h2>
	<span>MODR chunk</span>
</h2>

<ul><li>
		<b>Doodad references, one 16-bit integer per doodad.</b>
	</li>
</ul><p>
	The numbers are indices into the doodad instance table (<a href="https://wowdev.wiki/WMO/v17#MODD_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MODD</font></u></a> chunk) of the <strong>WMO/v17</strong> root file. These have to be filtered to the doodad set being used in any given <strong>WMO/v17</strong> instance.
</p>

<h2>
	<span>MOBN chunk</span>
</h2>

<ul><li>
		<b>Nodes of the BSP tree, used for collision (along with bounding boxes ?). Array of t_BSP_NODE. / CAaBspNode.</b> 0x10 bytes.
	</li>
</ul><pre>
struct t_BSP_NODE
{	
  uint16_t planeType;    // 4: leaf, 0 for YZ-plane, 1 for XZ-plane, 2 for XY-plane
  int16_t  children[2];  // index of bsp child node (right in this array)
  uint16_t numFaces;     // num of triangle faces in 
  uint32_t firstFace;    // index of the first triangle index(in )
  float    fDist;
};
</pre>

<p>
	planetype might be 0 for YZ-plane, 1 for XZ-plane, 2 for XY-plane, 4 for BSP leaf. fDist is where split plane locates based on planetype, ex, you have a planetype 0 and fDist 15, so the split plane is located at offset ( 15, 0, 0 ) with Normal as ( 1, 0, 0 ), I think the offset is relative to current node's bounding box center. The BSP root ( ie. node 0 )'s bounding box is the WMO's boundingbox, then you subdivide it with plane and fdist, then you got two children with two bounding box, and so on. you got the whole BSP tree. As the bsp leaf might overlapping the dividing plane, i think you might have two same face exist on two different bsp leaf. I'll make further tests to prove this. --<a href="https://wowdev.wiki/index.php?title=Mobius&amp;action=edit&amp;redlink=1" rel="external nofollow" title="Mobius (page does not exist)"><u><font color="#0066cc">mobius</font></u></a>.
</p>

<p>
	The biggest leaf in terms of number of faces in 3.3.5 contains more than 2100 faces (some ice giant in the Storm Peaks), so it's not advised to use more. (While I haven't investigated properly, there might be a limit at 8192 in 6.0.1.18179 --<a href="https://wowdev.wiki/index.php?title=User:Schlumpf&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Schlumpf (page does not exist)"><u><font color="#0066cc">Schlumpf</font></u></a> (<a href="https://wowdev.wiki/index.php?title=User_talk:Schlumpf&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User talk:Schlumpf (page does not exist)"><u><font color="#0066cc">talk</font></u></a>) 11:18, 3 January 2016 (UTC))
</p>

<p>
	fDist is relative to point (0,0,0) of whole WMO. children[0] is child on negative side of dividing plane, children[1] is on positive side. --<a href="https://wowdev.wiki/index.php?title=User:Deamon&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Deamon (page does not exist)"><u><font color="#0066cc">Deamon</font></u></a> (<a href="https://wowdev.wiki/index.php?title=User_talk:Deamon&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User talk:Deamon (page does not exist)"><u><font color="#0066cc">talk</font></u></a>) 10:01, 15 January 2016 (UTC)
</p>

<p>
	 
</p>

<pre>
#define epsilon 0.01F
void MergeBox(CVect3 (&amp;result)[2], float  *box1, float  *box2)
{
 result[0][0] = box1[0];
 result[0][1] = box1[1];
 result[0][2] = box1[2];
 result[1][0] = box2[0];
 result[1][1] = box2[1];
 result[1][2] = box2[2];
}
void AjustDelta(CVect3 (&amp;src)[2], float *dst, float coef)
{
 float d1 = (src[1][0]- src[0][0]) * coef;// delta x
 float d2 = (src[1][1]- src[0][1]) * coef;// delta y
 float d3 = (src[1][2]- src[0][2]) * coef;// delta z
 dst[1] = d1 + src[0][1];
 dst[0] = d2 + src[0][0];
 dst[2] = d3 + src[0][2];
}
void TraverseBsp(int iNode, CVect3 (&amp;pEyes)[2] , CVect3 (&amp;pBox)[2],void *(pAction)(T_BSP_NODE *,void *param),void *param)
 {
 int plane;
 float eyesmin_boxmin;
 float boxmax_eyesmax;
 float eyesmin_fdist;
 float eyes_max_fdist;
 float eyesmin_div_deltadist;
 CVect3 tBox1[2];
 CVect3 tBox2[2];
 CVect3 newEyes[2];
 CVect3 ajusted;
 T_BSP_NODE *pNode = &amp;m_tNode[iNode];
 if ( pNode)
 {
  if (pNode-&gt;planetype &amp; 4 )
  {
   if(pAction == 0)
   {
    RenderGeometry(GetEngine3DInstance(),pNode);
    return;
   }
   else
   {
    pAction(pNode,param);
   }
  }
  plane =pNode-&gt;planetype  &amp; 3;
  eyesmin_boxmin = pEyes[0][plane] - pBox[0][plane];
  if ( ( -epsilon &lt; eyesmin_boxmin) | (-epsilon == eyesmin_boxmin) || (pEyes[1][plane]- pBox[0][plane])  &gt;= -epsilon )
  {
   boxmax_eyesmax = pBox[1][plane] - pEyes[1][plane];
   if ( (epsilon &lt; boxmax_eyesmax) | (epsilon == boxmax_eyesmax) || (pBox[1][plane] -  pEyes[0][plane]) &gt;= epsilon )
   {
    memmove(tBox1,pBox,sizeof(pBox));
    tBox1[0][plane] = pNode-&gt;fDist;
    memmove(tBox2,pBox,sizeof(pBox));
    tBox2[1][plane] = pNode-&gt;fDist;
    eyesmin_fdist = pEyes[0][plane] - pNode-&gt;fDist;
    eyes_max_fdist = (pEyes[1][plane]) - pNode-&gt;fDist;
    if ( eyesmin_fdist &gt;= -epsilon &amp;&amp; eyesmin_fdist &lt;= epsilon|| (eyes_max_fdist &gt;= -epsilon) &amp;&amp; eyes_max_fdist &lt;= epsilon )
    {
     if ( pNode-&gt;children[1] != (short)-1 ) TraverseBsp(pNode-&gt;children[1],  pEyes,  tBox1,pAction,param);
     if ( pNode-&gt;children[0] != (short)-1 ) TraverseBsp(pNode-&gt;children[0] , pEyes, tBox2,pAction,param);
     return;
    }
    if ( eyesmin_fdist &gt; epsilon &amp;&amp; eyes_max_fdist &lt; epsilon)
    {
      if ( pNode-&gt;children[1] != (short)-1 ) TraverseBsp(pNode-&gt;children[1], pEyes, tBox1,pAction,param);
      return;
    }
    if ( eyesmin_fdist &lt; -epsilon &amp;&amp; eyes_max_fdist &lt; -epsilon)
    {
      if ( pNode-&gt;children[0] != (short)-1 ) TraverseBsp(pNode-&gt;children[0] , pEyes, tBox2,pAction,param);
      return;
    }
    eyesmin_div_deltadist = (float)(eyesmin_fdist / (eyesmin_fdist - eyes_max_fdist));
    AjustDelta(pEyes, ajusted, eyesmin_div_deltadist);
    if ( eyesmin_fdist &lt;= 0.0 )
    {
     if ( pNode-&gt;children[0]  != (short)-1 )
     {
      MergeBox(newEyes, &amp;pEyes[0][0], ajusted);
      TraverseBsp(pNode-&gt;children[0] , newEyes, tBox2,pAction,param);
     }
     if (pNode-&gt;children[1]  != (short)-1 )
     {
      MergeBox(newEyes, ajusted, &amp;pEyes[1][0]);
      TraverseBsp(pNode-&gt;children[1] , newEyes, tBox1,pAction,param);
     }
    }
    else
    {
     if ( pNode-&gt;children[1]  != (short)-1 )
     {
      MergeBox(newEyes, &amp;pEyes[0][0], ajusted);
      TraverseBsp(pNode-&gt;children[1] , newEyes, tBox1,pAction,param);
     }
     if (pNode-&gt;children[0]  != (short)-1 )
     {
      MergeBox(newEyes, ajusted, &amp;pEyes[1][0]);
      TraverseBsp(pNode-&gt;children[0] , newEyes, tBox2,pAction,param);
     }
    }
   }
  }
 }
}
</pre>

<pre>
CheckFromEyes(CVect3 (&amp;pEyes)[2],void *(pAction)(T_BSP_NODE *,void *param),void *param )
{
/*CVect3 eyes[2];
instance_mat.invert();
eyes[0] = _fixCoordSystemInv((instance_mat*p-&gt;m_pCameraViewport-&gt;GetCameraTarget())+CVect3(0,-10,0) );
eyes[1] = _fixCoordSystemInv((instance_mat*p-&gt;m_pCameraViewport-&gt;GetCameraTarget())+CVect3(0,60,0) ); 
 // make vector down
*/
/* eyes[0] = CVect3(-1.474797e+001F, -1.195053e+001F,  5.416779e+000F); // Debug absolute position from WP  Azaroth 1164,58,-10645.83
eyes[1] = CVect3(-1.474797e+001F, -1.195053e+001F, -1.754583e+003F);
*/
TraverseBsp(0,pEyes,m_bbox,pAction);
}
</pre>

<p>
	This BSP seems to be used for collision purpose only.
</p>

<p>
	An object could have has 2 collision system. The first one is encoded in a simplified Geometry (when MOPY. MaterialID=0xFF) the second one is encoded in T_BSP_NODE. Some object has collision method 1 only, some other uses method 2 only. Some object have both collision systems (some polygons are missing in the BSP but are present in the simplified geometry). how to use these 2 system remains unclear.
</p>

<p>
	For the time being, I check first the simplified geometry, and then if there is no collision, I apply a second pass using the BSP. It is sub-optimum, but it seems to work. Probably there is somewhere a flag telling us with which method we should use for the object.
</p>

<p>
	The code attached seems to work fine for BSP method--<a href="https://wowdev.wiki/index.php?title=Peter-pan&amp;action=edit&amp;redlink=1" rel="external nofollow" title="Peter-pan (page does not exist)"><u><font color="#0066cc">peter-pan</font></u></a>.
</p>

<h2>
	<span>MOBR chunk</span>
</h2>

<ul><li>
		<b>Face indices</b> for CAaBsp (MOBN). Unsigned shorts.
	</li>
	<li>
		<b>Triangle indices (in <a href="https://wowdev.wiki/WMO/v17#MOVI_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOVI</font></u></a> which define triangles) to describe polygon planes defined by <a href="https://wowdev.wiki/WMO/v17#MOBN_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOBN</font></u></a> BSP nodes.</b>
	</li>
</ul><p>
	Example code required to get an actual indicies array from MOBR array:
</p>

<pre>
var bpsIndicies = new Array(mobr.length*3);
for (var i = 0; i &lt; mobr.length; i++) {
    bpsIndicies[i*3 + 0] = movi[3*mobr[i]+0];
    bpsIndicies[i*3 + 1] = movi[3*mobr[i]+1];
    bpsIndicies[i*3 + 2] = movi[3*mobr[i]+2];
}
</pre>

<p>
	Example code to get indicies into MOVT for triangles, referenced from BSP node definition:
</p>

<pre>
for (var triangleInd = node.firstFace; triangleInd&lt;node.firstFace+node.numFaces; triangleInd++) {
    //3 vertices per triangle
    movt[bpsIndicies[3*triangleInd + 0]]
    movt[bpsIndicies[3*triangleInd + 1]]
    movt[bpsIndicies[3*triangleInd + 2]]
}
</pre>

<h2>
	<span>MOCV chunk</span>
</h2>

<ul><li>
		<b>Vertex colors, 4 bytes per vertex (BGRA), for <strong>WMO/v17</strong> groups using indoor lighting.</b>
	</li>
</ul><p>
	I don't know if this is supposed to work together with, or replace, the lights referenced in <a href="https://wowdev.wiki/WMO/v17#MOLR_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOLR</font></u></a>. But it sure is the only way for the ground around the goblin smelting pot to turn red in the Deadmines. (but some corridors are, in turn, too dark - how the hell does lighting work anyway, are there lightmaps hidden somewhere?)
</p>

<p>
	- I'm pretty sure WoW does not use lightmaps in it's <strong>WMO/v17s</strong>...
</p>

<p>
	After further inspection, this is it, actual pre-lit vertex colors for <strong>WMO/v17s</strong> - vertex lighting is turned off. This is used if flag 0x2000 in the <a href="https://wowdev.wiki/WMO/v17#MOGI_chunk" rel="external nofollow" title="WMO/v17"><u><font color="#0066cc">MOGI</font></u></a> chunk is on for this group. This pretty much fixes indoor lighting in Ironforge and Undercity. The "light" lights are used only for <a href="https://wowdev.wiki/M2" rel="external nofollow" title="M2"><u><font color="#0066cc">M2</font></u></a> models (doodads and characters). (The "too dark" corridors seemed like that because I was looking at it in a window - in full screen it looks pretty much the same as in the game) Now THAT's progress!!!
</p>

<p>
	<i>Yes, 0x2000 (INDOOR) flagged WMO groups use _only_ MOCV for lighting, however this chunk is also used to light outdoor groups as well like lantern glow on buildings, etc. If 0x8 (OUTDOOR) flag is set, you start out with normal world lighting (like with light db params) and then you multiply these vertex colors by the texture color and add it to the world lighting. This makes many models look much better. See the Forsaken buildings in Howling Fjord for an example of some that make use of this a lot for glowing windows and lamps. <a href="https://wowdev.wiki/index.php?title=User:Relaxok&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Relaxok (page does not exist)"><u><font color="#0066cc">Relaxok</font></u></a> 18:29, 20 March 2013 (UTC)</i>
</p>

<h3>
	<span>CMapObjGroup::FixColorVertexAlpha</span>
</h3>

<p>
	Prior to being passed to the shaders, MOCV values are manipulated by the CMapObj::FixColorVertexAlpha function in the client. This function performs different manipulations depending on the relationship between the vertex and the MOBA it appears in. It's possible that FixColorVertexAlpha did not always exist, or does not exist in later versions of WoW. It appears to have existed in WotLK, Cata, MoP, and WoD.
</p>

<p>
	In client versions that use FixColorVertexAlpha, without applying the function, certain parts of WMOs are noticeably wrong: fireplaces lack a glowing effect; the red light cast from bellows in blacksmith WMOs is undersaturated; etc.
</p>

<h4>
	<span>WMOs with MOHD-&gt;flags &amp; 0x08</span>
</h4>

<p>
	Only one manipulation takes place:
</p>

<p>
	MOCVs matching vertices in MOGP-&gt;batchCounts[1] and MOGP-&gt;batchCounts[2] are modified like so:
</p>

<pre>
1. If MOGP.flags &amp; 0x08, replace MOCV-&gt;color[a] with 255; else replace MOCV-&gt;color[a] with 0
</pre>

<h4>
	<span>All other WMOs</span>
</h4>

<p>
	The following manipulations take place:
</p>

<p>
	MOCVs matching vertices in MOGP-&gt;batchCounts[0] (aka unkBatchCount) are modified like so:
</p>

<pre>
1. Subtract MOHD-&gt;color[r|g|b]
2. Subtract MOCV-&gt;color[r|g|b] * MOCV-&gt;color[a]
3. Divide new MOCV-&gt;color[r|g|b] values by 2.0
</pre>

<p>
	MOCVs matching vertices in MOGP-&gt;batchCounts[1] and MOGP-&gt;batchCounts[2] are modified like so:
</p>

<pre>
1. Subtract MOHD-&gt;color
2. Add (MOCV-&gt;color[r|g|b] * MOCV-&gt;color[a]) &gt;&gt; 6
3. Divide MOCV-&gt;color[r|g|b] values by 2.0
4. If values are &gt;= 0 and  &lt;= 255, keep value as is; else clamp new value to 0, 255.
5. If MOGP.flags &amp; 0x08, replace MOCV-&gt;color[a] with 255; else replace MOCV-&gt;color[a] with 0
</pre>

<h4>
	<span>Decompiled code</span>
</h4>

<p>
	From build 18179, courtesy of schlumpf
</p>

<pre>
void CMapObjGroup::FixColorVertexAlpha(CMapObjGroup *mapObjGroup)
{
  int begin_second_fixup = 0;
  if ( mapObjGroup-&gt;unkBatchCount )
  {
    begin_second_fixup = *((unsigned __int16 *)&amp;mapObjGroup-&gt;moba[(unsigned __int16)mapObjGroup-&gt;unkBatchCount] - 2) + 1;
  }

  if ( mapObjGroup-&gt;m_mapObj-&gt;mohd-&gt;flags &amp; flag_has_some_outdoor_group )
  {
    for (int i (begin_second_fixup); i &lt; mapObjGroup-&gt;mocv_count; ++i)
    {
      mapObjGroup-&gt;mocv[i].w = mapObjGroup-&gt;m_groupFlags &amp; SMOGroup::EXTERIOR ? 0xFF : 0x00;
    }
  }
  else
  {
    if ( mapObjGroup-&gt;m_mapObj-&gt;mohd-&gt;flags &amp; flag_skip_base_color )
    {
      v35 = 0;
      v36 = 0;
      v37 = 0;
    }
    else
    {
      v35 = (mapObjGroup-&gt;m_mapObj-&gt;mohd.color &gt;&gt; 0) &amp; 0xff;
      v37 = (mapObjGroup-&gt;m_mapObj-&gt;mohd.color &gt;&gt; 8) &amp; 0xff;
      v36 = (mapObjGroup-&gt;m_mapObj-&gt;mohd.color &gt;&gt; 16) &amp; 0xff;
    }

    for (int mocv_index (0); mocv_index &lt; begin_second_fixup; ++mocv_index)
    {
      mapObjGroup-&gt;mocv[mocv_index].x -= v36;
      mapObjGroup-&gt;mocv[mocv_index].y -= v37;
      mapObjGroup-&gt;mocv[mocv_index].z -= v35;

      v38 = mapObjGroup-&gt;mocv[mocv_index].w / 255.0f;

      v11 = mapObjGroup-&gt;mocv[mocv_index].x - v38 * mapObjGroup-&gt;mocv[mocv_index].x;
      assert (v11 &gt; -0.5f);
      assert (v11 &lt; 255.5f);
      mapObjGroup-&gt;mocv[mocv_index].x = v11 / 2;
      v13 = mapObjGroup-&gt;mocv[mocv_index].y - v38 * mapObjGroup-&gt;mocv[mocv_index].y;
      assert (v13 &gt; -0.5f);
      assert (v13 &lt; 255.5f);
      mapObjGroup-&gt;mocv[mocv_index].y = v13 / 2;
      v14 = mapObjGroup-&gt;mocv[mocv_index].z - v38 * mapObjGroup-&gt;mocv[mocv_index].z;
      assert (v14 &gt; -0.5f);
      assert (v14 &lt; 255.5f);
      mapObjGroup-&gt;mocv[mocv_index++].z = v14 / 2;
    }

    for (int i (begin_second_fixup); i &lt; mapObjGroup-&gt;mocv_count; ++i)
    {
      v19 = (mapObjGroup-&gt;mocv[i].x * mapObjGroup-&gt;mocv[i].w) / 64 + mapObjGroup-&gt;mocv[i].x - v36;
      mapObjGroup-&gt;mocv[i].x = std::min (255, std::max (v19 / 2, 0));

      v30 = (mapObjGroup-&gt;mocv[i].y * mapObjGroup-&gt;mocv[i].w) / 64 + mapObjGroup-&gt;mocv[i].y - v37;
      mapObjGroup-&gt;mocv[i].y = std::min (255, std::max (v30 / 2, 0));

      v33 = (mapObjGroup-&gt;mocv[i].w * mapObjGroup-&gt;mocv[i].z) / 64 + mapObjGroup-&gt;mocv[i].z - v35;
      mapObjGroup-&gt;mocv[i].z = std::min (255, std::max (v33 / 2, 0));

      mapObjGroup-&gt;mocv[i].w = mapObjGroup-&gt;m_groupFlags &amp; SMOGroup::EXTERIOR ? 0xFF : 0x00;
    }
  }
}
</pre>

<p>
	 
</p>

<h3>
	<span>CMapObj::AttenTransVerts</span>
</h3>

<p>
	Similar to FixColorVertexAlpha above, the client will also run MOCV values through the CMapObj::AttenTransVerts function prior to rendering.
</p>

<p>
	In MoP and WoD, it appears that the client only runs AttenTransVerts in cases where flag 0x01 is NOT set on MOHD.flags.
</p>

<p>
	AttenTransVerts only modifies MOCV values for vertices in MOGP.batchCounts[0] (aka unkBatchCount) batches.
</p>

<p>
	The function iterates over all vertices in MOGP.batchCounts[0], and checks all portals for the group:
</p>

<ul><li>
		If no portals are found that lead to a group with MOGI.flags &amp; (0x08 | 0x40), all MOCV alpha values are set to 0.0.
	</li>
	<li>
		If a portal is found leading to a group with MOGI.flags &amp; (0x08 | 0x40), each MOCV alpha is manipulated to be a range of 0.0 to 1.0 based on the distance of the corresponding vertex to the portal. Additionally, the RGB values for each MOCV are bumped by: (0.0 to 1.0) * (127 - existingRGB)
	</li>
</ul><h4>
	<span>Decompiled code</span>
</h4>

<pre>
void CMapObj::AttenTransVerts (CMapObj *mapObj, CMapObjGroup *mapObjGroup)
{
  mapObjGroup-&gt;field_98 |= 1u;
  if (!mapObjGroup-&gt;unkBatchCount)
  {
    return;
  }

  for ( std::size_t vertex_index (0)
      ; vertex_index &lt; (*((unsigned __int16 *)&amp;mapObjGroup-&gt;moba[(unsigned __int16)mapObjGroup-&gt;unkBatchCount] - 2) + 1)
      ; ++vertex_index
      )
  {
    float opacity_accum (0.0);

    for ( std::size_t portal_ref_index (mapObjGroup-&gt;mogp-&gt;mopr_index)
        ; portal_ref_index &lt; (mapObjGroup-&gt;mogp-&gt;mopr_index + mapObjGroup-&gt;mogp-&gt;mopr_count)
        ; ++portal_ref_index
        )
    {
      SMOPortalRef const&amp; portalRef (mapObj-&gt;mopr[portal_ref_index]);
      SMOPortal const&amp; portal (mapObj-&gt;mopt[portalRef.portalIndex]);
      C3Vector const&amp; vertex (&amp;mapObjGroup-&gt;movt[vertex_index]);

      float const portal_to_vertex (distance (portal.plane, vertex));

      C3Vector vertex_to_use (vertex);

      if (portal_to_vertex &gt; 0.001 || portal_to_vertex &lt; -0.001)
      {
        C3Ray ray ( C3Ray::FromStartEnd
                      ( vertex
                      , vertex
                      + (portal_to_vertex &gt; 0 ? -1 : 1) * portal.plane.normal
                      , 0
                      )
                  );
        NTempest::Intersect
          (ray, &amp;portal.plane, 0LL, &amp;vertex_to_use, 0.0099999998);
      }

      float distance_to_use;

      if ( NTempest::Intersect ( vertex_to_use
                               , &amp;mapObj-&gt;mopv[portal.base_index]
                               , portal.index_count
                               , C3Vector::MajorAxis (portal.plane.normal)
                               )
         )
      {
        distance_to_use = portalRef.side * distance (portal.plane, vertex);
      }
      else
      {
        distance_to_use = NTempest::DistanceFromPolygonEdge
          (vertex, &amp;mapObj-&gt;mopv[portal.base_index], portal.index_count);
      }

      if (mapObj-&gt;mogi[portalRef.group_index].flags &amp; 0x48)
      {
        float v25 (distance_to_use &gt;= 0.0 ? distance_to_use / 6.0f : 0.0f);
        if ((1.0 - v25) &gt; 0.001)
        {
          opacity_accum += 1.0 - v25;
        }
      }
      else if (distance_to_use &gt; -1.0)
      {
        opacity_accum = 0.0;
        if (distance_to_use &lt; 1.0)
        {
          break;
        }
      }
    }

    float const opacity ( opacity_accum &gt; 0.001
                        ? std::min (1.0f, opacity_accum)
                        : 0.0f
                        );

    //! \note all assignments asserted to be &gt; -0.5 &amp;&amp; &lt; 255.5f
    CArgb&amp; color (mapObjGroup-&gt;mocv[vertex_index]);
    color.r = ((127.0f - color.r) * opacity) + color.r;
    color.g = ((127.0f - color.g) * opacity) + color.g;
    color.b = ((127.0f - color.b) * opacity) + color.b;
    color.a = opacity * 255.0;
  }
}
</pre>

<h2>
	<span>MLIQ chunk</span>
</h2>

<ul><li>
		<b>Specifies liquids inside WMOs.</b>
	</li>
</ul><p>
	This is where the water from Stormwind and BFD etc. is hidden. (slime in Undercity, pool water in the Darnassus temple, some lava in IF)
</p>

<p>
	Chunk header:
</p>

<pre>
<b>Offset	Type 			Description</b>
0x00 	uint32 			number of X vertices (xverts)
0x04 	uint32 			number of Y vertices (yverts)
0x08 	uint32 			number of X tiles (xtiles = xverts-1)
0x0C 	uint32 			number of Y tiles (ytiles = yverts-1)
0x10 	float[3] 		base coordinates for X and Y
0x1C 	uint16 			material ID
</pre>

<p>
	After the header, verts and tiles follow:
</p>

<pre>
struct SMOLVert
{
  union
  {
    struct SMOWVert
    {
      uint8_t flow1;
      uint8_t flow2;
      uint8_t flow1Pct;
      uint8_t filler;
      float height;
    }  waterVert;
    struct SMOMVert
    {
      int16_t s;
      int16_t t;
      float height;
    } magmaVert;
  };
} verts[xverts*yverts];

struct SMOLTile
{
  uint8_t liquid : 6;
  uint8_t fishable : 1;
  uint8_t shared : 1;
} tiles[xtiles*ytiles];
</pre>

<p>
	The liquid data contains the vertex height map (xverts * yverts * 8 bytes) and the tile flags (xtiles * ytiles bytes) as descripbed in <a href="https://wowdev.wiki/ADT" rel="external nofollow" title="ADT"><u><font color="#0066cc">ADT</font></u></a> files (<a href="https://wowdev.wiki/ADT#MCLQ_chunk" rel="external nofollow" title="ADT"><u><font color="#0066cc">MCLQ</font></u></a> chunk). The length and width of a liquid tile is the same as on the map, that is, 1/8th of the length of a map chunk. (which is in turn 1/16th the length of a map tile).
</p>

<p>
	Note that although I could read Mh2o's heightmap and existstable in row major order (like reading a book), I had to read this one in column major order to compensate for a 90° misrotation. --<a href="https://wowdev.wiki/index.php?title=User:Bananenbrot&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Bananenbrot (page does not exist)"><u><font color="#0066cc">Bananenbrot</font></u></a> 22:02, 1 August 2012 (UTC)
</p>

<p>
	Either the unknown data or the "types" must somehow control how the points at the edges work. In looking at 3D mesh screen captures, something is changed to create a flat edge where it meets other MLIQ chunks. The first Unknown data is always 0 when a point isn't used. Other seen values: 1, 4, 12, 22, 27, 31, 105, &amp; 124. Not yet sure what they mean/how to use them, I suspect they become the modifier for the edge placement points. --<a href="https://wowdev.wiki/index.php?title=User:Kjasi&amp;action=edit&amp;redlink=1" rel="external nofollow" title="User:Kjasi (page does not exist)"><u><font color="#0066cc">Kjasi</font></u></a> 14 February 2016
</p>

<h3>
	<span>how to determine <a href="https://wowdev.wiki/DB/LiquidType" rel="external nofollow" title="DB/LiquidType"><u><font color="#0066cc">LiquidTypeRec</font></u></a> to use</span>
</h3>

<pre>
enum liquid_basic_types
{
  liquid_basic_types_water = 0,
  liquid_basic_types_ocean = 1,
  liquid_basic_types_magma = 2,
  liquid_basic_types_slime = 3,

  liquid_basic_types_MASK = 3,
};
enum liquid_types
{
  // ...
  LIQUID_WMO_Water = 13,
  LIQUID_WMO_Ocean = 14,
  LIQUID_Green_Lava = 15,
  LIQUID_WMO_Magma = 19,
  LIQUID_WMO_Slime = 20,

  LIQUID_END_BASIC_LIQUIDS = 20,
  LIQUID_FIRST_NONBASIC_LIQUID_TYPE = 21,

  LIQUID_NAXX_SLIME = 21,
  // ...
};

enum SMOGroup::flags
{
  LIQUIDSURFACE = 0x1000,
  is_not_water_but_ocean = 0x80000,
};

liquid_types to_wmo_liquid (int x)
{
  liquid_basic_types const basic (x &amp; liquid_basic_types_MASK);
  switch (basic)
  {
  case liquid_basic_types_water:
    return (smoGroup-&gt;flags &amp; is_not_water_but_ocean) ? LIQUID_WMO_Ocean : LIQUID_WMO_Water;
  case liquid_basic_types_ocean:
    return LIQUID_WMO_Ocean;
  case liquid_basic_types_magma:
    return LIQUID_WMO_Magma;
  case liquid_basic_types_slime:
    return LIQUID_WMO_Slime;
  }
}


if ( mapObj-&gt;mohd_data-&gt;field_3C &amp; 4 )
{
  if ( smoGroup-&gt;field_34 &lt; LIQUID_FIRST_NONBASIC_LIQUID_TYPE )
  {
    this-&gt;liquid_type = to_wmo_liquid (smoGroup-&gt;field_34 - 1);
  }
  else
  {
    this-&gt;liquid_type = smoGroup-&gt;field_34;
  }
}
else
{
  if ( smoGroup-&gt;field_34 == LIQUID_Green_Lava )
  {
    this-&gt;liquid_type = 0;
  }
  else
  {
    int const liquidType (smoGroup-&gt;field_34 + 1);
    int const tmp (smoGroup-&gt;field_34);
    if ( smoGroup-&gt;field_34 &lt; LIQUID_END_BASIC_LIQUIDS )
    {
      this-&gt;liquid_type = to_wmo_liquid (smoGroup-&gt;field_34);
    }
    else
    {
      this-&gt;liquid_type = smoGroup-&gt;field_34 + 1;
    }
    assert (!liquidType || !(smoGroup-&gt;flags &amp; SMOGroup::LIQUIDSURFACE));
  }
}
</pre>

<h2>
	<span>MORI</span>
</h2>

<pre>
uint16_t triangle_strip_indices[];
</pre>

<h2>
	<span>MORB</span>
</h2>

<ul><li>
		ignored if !CMap::enableTriangleStrips
	</li>
	<li>
		modifies MOBA, therefore has same count.
	</li>
	<li>
		size is not checked, but 2 * sizeof(int), even though it is only (int, short).
	</li>
</ul><pre>
struct MORB_entry
{
  uint32_t start_index;
  uint16_t index_count;
  uint16_t padding;
}
</pre>

<ul><li>
		overwrites 0xC and 0x10 of MOBA (start, count).
	</li>
</ul><h2>
	<span>MOTA</span>
</h2>

<ul><li>
		Map Object Tangent Array
	</li>
</ul><pre>
struct MOTA
{
  unsigned short first_index[moba_count]; // either -1 or first index of batch.count indices into tangents[]. 
                                          // if auto-generated, only has entries for batches with 
                                          // material[batch.material].shader == 10 or 14.
  C4Vector tangents[accumulated_num_indices]; // sum (batches[i].count | material[batches[i].material].shader == 10 or 14)
};
</pre>

<p>
	Is auto generated, if there are batches with shaders 10 or 14, but no tangents. (And maybe some additional condition.) See CMapObjGroup::Create().
</p>

<h2>
	<span>MOBS</span>
</h2>

<ul><li>
		size = 0x18
	</li>
</ul><pre>
struct MOBS_entry
{
  char unk[0x18];
};
</pre>

<h2>
	<span>MDAL</span>
</h2>

<ul><li>
		likely new in WoD, unknown contents.
	</li>
</ul><pre>
struct
{
  CArgb replacement_for_header_color; // if -1 or not present, take color from header
} mdal;
</pre>

<h2>
	<span>MOPL (WoD(?)+)</span>
</h2>

<ul><li>
		requires MOGP.canCutTerrain
	</li>
</ul><pre>
C4Plane terrain_cutting_planes[&lt;=32];

</pre>
]]></description><guid isPermaLink="false">20030</guid><pubDate>Mon, 01 Aug 2016 20:10:13 +0000</pubDate></item><item><title>ZMP Files</title><link>https://www.getmangos.eu/wiki/referenceinfo/clientfiles/zmp-files-r20025/</link><description><![CDATA[<h2>
	Introduction
</h2>

<p>
	ZMP Files - presumably for Zone Map - link map data to location info from <a href="./dbcfiles/mangoszerodbc/AreaTable-r1503/" rel="external">AreaTable.dbc</a>. There are 3 of those files in 1.12.2:
</p>

<p>
	Interface\WorldMap\Azeroth.zmp
</p>

<p>
	Interface\WorldMap\Expansion01.zmp (in patch.MPQ, no data present)
</p>

<p>
	Interface\WorldMap\Kalimdor.zmp
</p>

<h3>
	Structure
</h3>

<p>
	The files are headerless. They contain 128 x 128 uint32 values (double resolution compared to WDT) which are area IDs from <a href="./dbcfiles/mangoszerodbc/AreaTable-r1503/" rel="external">AreaTable.dbc</a>
</p>

<h3>
	Speculation
</h3>

<p>
	We think it is possible that this file is used by the client to display the name of the current area while moving in the World.
</p>

<h3>
	WowDev Wiki says:
</h3>

<p>
	They are used on parsing <a href="./dbcfiles/mangoszerodbc/WorldMapArea-r1649/" rel="external">WorldMapArea.dbc</a>. The values get copied and then get overwritten with the WorldMapArea-id the areaid they referenced is in. It will hold a zero or the WMA-id depending on if the area and the map that's currently parsed match. This also takes the virtual map id into account.
</p>
]]></description><guid isPermaLink="false">20025</guid><pubDate>Mon, 01 Aug 2016 09:57:53 +0000</pubDate></item></channel></rss>
