终于决定,还是通过wow model viewer起手,研究一下WOW的数据类型,从另一个角度,体验一把这个唯一让我充过值的游戏。
这将是一系列随笔,即在读代码的时候,顺便记录,以理清思路和加深映象。 其中会有很多让人费解的地方,如果有幸被某位兄弟看见
,请勿见笑。
这都是第四篇关于M2文件格式的文章了,但是,对MD2文件格式的理解却还是九牛一毛,冰山一角。 仔细思考了一下,发现是不是自己一
开始走的路不对,因为是从半腰上分析的。 今天决定把文件头补上。 因为文件头可以大概看出一个文件是如何组织数据,以及包含哪些
数据的。
在此,给出WotLK的头文件定义
char id[4];
uint8 version[4];
uint32 nameLength;
uint32 nameOfs;
uint32 GlobalModelFlags; // 1: tilt x, 2: tilt y, 4:, 8: add another field in header, 16: ; (no other flags as
of 3.1.1);
uint32 nGlobalSequences; // AnimationRelated
uint32 ofsGlobalSequences; // A list of timestamps.
uint32 nAnimations; // AnimationRelated
uint32 ofsAnimations; // Information about the animations in the model.
uint32 nAnimationLookup; // AnimationRelated
uint32 ofsAnimationLookup; // Mapping of global IDs to the entries in the Animation sequences block.
//uint32 nD;
//uint32 ofsD;
uint32 nBones; // BonesAndLookups
uint32 ofsBones; // Information about the bones in this model.
uint32 nKeyBoneLookup; // BonesAndLookups
uint32 ofsKeyBoneLookup; // Lookup table for key skeletal bones.
uint32 nVertices; // GeometryAndRendering
uint32 ofsVertices; // Vertices of the model.
uint32 nViews; // GeometryAndRendering
//uint32 ofsViews; // Views (LOD) are now in .skins.
uint32 nColors; // ColorsAndTransparency
uint32 ofsColors; // Color definitions.
uint32 nTextures; // TextureAndTheifAnimation
uint32 ofsTextures; // Textures of this model.
uint32 nTransparency; // H, ColorsAndTransparency
uint32 ofsTransparency; // Transparency of textures.
//uint32 nI; // always unused ?
//uint32 ofsI;
uint32 nTexAnims; // J, TextureAndTheifAnimation
uint32 ofsTexAnims;
uint32 nTexReplace; // TextureAndTheifAnimation
uint32 ofsTexReplace; // Replaceable Textures.
uint32 nTexFlags; // Render Flags
uint32 ofsTexFlags; // Blending modes / render flags.
uint32 nBoneLookup; // BonesAndLookups
uint32 ofsBoneLookup; // A bone lookup table.
uint32 nTexLookup; // TextureAndTheifAnimation
uint32 ofsTexLookup; // The same for textures.
uint32 nTexUnitLookup; // L, TextureAndTheifAnimation, seems gone after Cataclysm
uint32 ofsTexUnitLookup; // And texture units. Somewhere they have to be too.
uint32 nTransparencyLookup; // M, ColorsAndTransparency
uint32 ofsTransparencyLookup; // Everything needs its lookup. Here are the transparencies.
uint32 nTexAnimLookup; // TextureAndTheifAnimation
uint32 ofsTexAnimLookup; // Wait. Do we have animated Textures? Wasn't ofsTexAnims deleted? oO
Sphere collisionSphere;
Sphere boundSphere;
uint32 nBoundingTriangles; // Miscellaneous
uint32 ofsBoundingTriangles;
uint32 nBoundingVertices; // Miscellaneous
uint32 ofsBoundingVertices;
uint32 nBoundingNormals; // Miscellaneous
uint32 ofsBoundingNormals;
uint32 nAttachments; // O, Miscellaneous
uint32 ofsAttachments; // Attachments are for weapons etc.
uint32 nAttachLookup; // P, Miscellaneous
uint32 ofsAttachLookup; // Of course with a lookup.
uint32 nEvents; //
uint32 ofsEvents; // Used for playing sounds when dying and a lot else.
uint32 nLights; // R
uint32 ofsLights; // Lights are mainly used in loginscreens but in wands and some doodads too.
uint32 nCameras; // S, Miscellaneous
uint32