Header
The header has mostly the layout of number-offset pairs, containing the number of a particular record in the file, and the offset. These appear at fixed places in the header. Record sizes are not specified in the file.
The unknown blocks have (mostly arbitrary) alphabetic names until we figure out what they are.
Offset
|
Type
|
Description
|
0x000
|
char[4]
|
"MD20"
|
0x004
|
uint8[4]
|
Version (always 00 01 00 00)
|
0x008
|
uint32
|
model name length
|
0x00C
|
uint32
|
model name offset
|
0x010
|
uint32
|
Model type? always 0, 1 or 3 (mostly 0)
|
0x014
|
uint32
|
nGlobalSequences - number of global sequences
全局的时间序列,各个动画的duration
|
0x018
|
uint32
|
ofsGlobalSequences - offset to global sequences
|
0x01C
|
uint32
|
nAnimations - number of animation sequences
|
0x020
|
uint32
|
ofsAnimations - offset to animation sequences
|
0x024
|
uint32
|
nC
|
0x028
|
uint32
|
ofsC
|
0x02C
|
uint32
|
nD - always 201 or 203 depending on WoW client version
|
0x030
|
uint32
|
ofsD
|
0x034
|
uint32
|
nBones - number of bones
|
0x038
|
uint32
|
ofsBones - offset to bones
|
0x03C
|
uint32
|
nF - bone lookup table
|
0x040
|
uint32
|
ofsF
|
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
Material
的Emissive, Specular Color动画
|
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
|
nK
|
0x080
|
uint32
|
ofsK
|
0x084
|
uint32
|
nRenderFlags - number of blending mode definitions
与场景的混合方式,共有6种。
|
0x088
|
uint32
|
ofsRenderFlags - offset to blending mode definitions
|
0x08C
|
uint32
|
nY - bone lookup table
|
0x090
|
uint32
|
ofsY
|
0x094
|
uint32
|
nTexLookup - number of texture lookup table entries
全局纹理数组的查询表
|
0x098
|
uint32
|
ofsTexLookup - offset to texture lookup table
|
0x09C
|
uint32
|
nTexUnits - texture unit definitions?
子材质Sub of Material,对应一次提交(一组渲染状态)
|
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
|
14 * float
|
float values ... ? (in range -1000...1000, mostly in -20...30)
|
0x0EC
|
uint32
|
nBoundingTriangles
绑定Mesh的三角形索引,用来做较精确的碰撞检测。
|
0x0F0
|
uint32
|
ofsBoundingTriangles
|
0x0F4
|
uint32
|
nBoundingVertices
绑定Mesh的顶点数据
|
0x0F8
|
uint32
|
ofsBoundingVertices
|
0x0FC
|
uint32
|
nBoundingNormals
绑定Mesh的法向量
|
0x100
|
uint32
|
ofsBoundingNormals
|
0x104
|
uint32
|
nO
|
0x108
|
uint32
|
ofsO
|
0x10C
|
uint32
|
nP
|
0x110
|
uint32
|
ofsP
|
0x114
|
uint32
|
nQ
|
0x118
|
uint32
|
ofsQ
|
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
|
Particle emitters
nparticleEmitters records of 0x1F8 bytes starting at
ofsParticleEmitters, followed by data referenced in these records.
The records have the following structure:
Offset
|
Type
|
Description
|
0x000
|
int32
|
id (always -1?)
|
0x004
|
int32
|
flags
表示粒子行为和表现的标记位,如面向摄像机的方式、属性随机的方式(光晕、武器光等),我觉得这部分可以归纳为不同的发射器,如光晕效果可以用一个环形发射器实现。
|
0x008
|
float[3]
|
position
|
0x014
|
int16
|
Bone ID
|
0x016
|
int16
|
Texture ID
|
0x018
|
uint32
|
Number of ints referenced #1
|
0x01C
|
uint32
|
Offset to list of ints #1
|
0x020
|
uint32
|
Number of ints referenced #2
|
0x024
|
uint32
|
Offset to list of ints #2
|
0x028
|
int16
|
Blending mode
与场景混合方式
|
0x02A
|
int16
|
Emitter type
发射器类型
|
0x02C
|
int16
|
Particle type
面向摄像机方式
|
0x02E
|
int16
|
Texture tile rotation (-1,0,1)
|
0x030
|
int16
|
Rows on texture
?
使用的纹理包含纹理动画时,一行包含的动画帧数目
|
0x032
|
int16
|
Columns on texture
?
一列包含的动画帧数目
|
0x034
|
AnimationBlock (float) [10]
|
Parameters
10
个属性的关键帧数据
|
0x14C
|
float[36]
|
unknown float values - more parameters?
|
0x14C
|
float
|
Midpoint in lifespan? (0 to 1)
|
0x150
|
uint32[3]
|
ARGB colors (start, mid, end)
颜色动画关键帧
|
0x15C
|
float[3]
|
Particle sizes (start, mid, end)
缩放关键帧
|
0x168
|
short[10]
|
Indices into the tiles on the texture?
如果是索引,那为什么要记录这些数据?顺序播放不成吗,难道同一个纹理动画有多种播放策略? 需要在WOW里面需求例子。
|
0x17C
|
float[3]
|
Unknown
|
0x188
|
float[3]
|
Something about particle scaling? Hm.
|
0x194
|
float
|
Slowdown
|
0x198
|
float
|
Particle rotation
|
0x19C
|
float[10]
|
Unknown (usually all 0)
|
0x1C4
|
float[6]
|
Unknown, usually (2.5, 0.7, 7, 0.9, 0, 0)
|
0x1DC
|
AnimationBlock (int)
|
unknown
|
About slowdown: for nonzero values, instead of travelling linearly the particles seem to slow down sooner. I can't work out the exact function but for a value of, say, 10, the particles pretty much stay in place. Not the same effect as gravity, though. Update: thanks to nsz for the formula. Speed is multiplied by exp( -slowdown * t )
About particle rotation: 0 for none, 1 to rotate the particle 360 degrees throughout its lifetime.
The ten animatable particle parameters are:
Number
|
Description
|
0
|
Emission speed
发射速度
|
1
|
Speed variation (range: 0 to 1)
速度变化
|
2
|
Spread? (range: 0 to pi)
相对发射器发射方向的扩散角度
|
3
|
? (range: 0 to 2*pi)
|
4
|
Gravity
重力
|
5
|
Lifespan
寿命
|
6
|
Emission rate
发射率
|
7
|
Emission area length
发射区域的长度
|
8
|
Emission area width
发射区域的宽度
|
9
|
Gravity? (much stronger)
重力
|
Emitter types:
Value
|
Description
|
1
|
Plane (rectangle)
|
2
|
Sphere
|
3
|
(Spline? can't be bothered to find one)
|
Particle types:
Value
|
Description
|
0
|
"normal" particle
|
1
|
large quad from the particle's origin to its position (used in Moonwell water effects)
|
2
|
seems to be the same as 0 (found some in the Deeprun Tram blinky-lights-sign thing)
|
Flags:
Value
|
Description
|
0x1000
|
do not billboard (used for some water wake ripple effects)
|