|
1.多种发型,胡须,特征(耳朵,嘴巴等)的几何Chunk集成在一个人物模型文件内部.
2.多种手腕护甲,腿护甲,鞋子,披风的几何Chunk集成在一个人物模型文件内部.
3.集成的模型块(GeoChunk)按数值区域进行分类,如设发型块的标识范围为1-100,胡须101-200,耳朵701-800,大腿1301-1400,小腿501-600.在各自的取值范围内,不同值代表不同的几何形状风格,如1:光头,2:冲天发等等.
4.手腕护甲,腿护甲,鞋子,披风物品应该有数据表明自己影响了哪些集成模型块(GeoChunk),如长筒靴影响了小腿的几何形状风格.每样物品均能影响身体的各个部位,若各个物品影响出现重叠,取影响优先高的物体.如靴子影响小腿是最高优先的,其他的影响被冲消.
5.武器,护甲,盾牌作为外部模型连接到身体的某块骨骼,以之为根骨骼进行骨骼矩阵运作.每个人物模型定义了其使用各种武器,盾牌时的动作.每个人物模型定义了各部位的物品接入点标识和坐标,如1:右手心,2左手心,并且定义接入的骨骼ID.
6.每样物品,鞋子,披风,武器,护甲,盾牌除几何形状外,有数据定义各自的纹理,极其复杂.一个物品应该有左右模型文件,左右纹理文件,以及对身体各部位影响的几何形状风格和对应的纹理.
7.头发的颜色使用不同的纹理来表达,但毛发纹理不仅表达颜色,还表达毛发的外观风格,如辫子,四披头,长发等不同发质,数据组织极其复杂,分性别,种族,发型,颜色值等等.
8.人物模型分块应该以Material为基本标准,兼顾几何形状(GeoChunk)分布,Material在存储时要预排序.1个Materail可以影响多个几何Mesh,一个Mesh可以受多个Material影响(多重纹理).
9.1个Materail用Flags(1个或多个DWORD)表达自己的Shader,这样使用Flags就可以排序优化模型渲染队列.基本有:BLEND_NONE,BLEND_TRANSPARENT,BLEND_MERGE,BLEND_ADDITIVE,BLEND_ADDITIVE_ALPHA,BLEND_SRC_DEST等等.甚至可以是一个VS,PS的Shader ID.
10.Refer to http://www.cnitblog.com/linghuye/archive/2005/08/14/1903.aspx
繁琐沉重的工作麻木了程序员的思维,也只有在完全属于自己的闲趣的代码中才能找回自己的方向和热情。 留下些足迹,让未来的自己,体味现在与曾经的彷徨和执着。 嗨,我梦萦的Kalimdor大陆. Reference: http://www.cognigraph.com/ROAM_homepage/
1.树型文件结构不过是为人便于管理使用而制造的假象,实际文件格式坚持以数组存储,通过某种假象信息表达出树型结构,如路径名。 2.坚持读取效率至上原则,添加编辑删除效率次之,文件大小用一个终极优化整理操作完成。 3.坚持哈希表结构,使用加密密钥形成实际的不同文件格式。 4.设计上要考虑多语言化支持,多格式压缩,与本地文件系统操作完全兼容,无缝链接。 5.Great thx to Ladislav Zezula's http://www.zezula.net6. http://www.soarchin.com的MPQMaster做的不错,用Upx压缩,自称最小最快,嘿嘿我的程序也一样. 7.文件数据结构无非: a.HEADER b.DataChunk(tag,offset.size) c.StructArray
Develop in 2005 for my own road to my wow.
XML UI排版实现思考 1.每个UI元素要根据其父元素的既定位置进行对齐偏移,所以在代码逻辑上父元素应在自身导入完备后,再行导入其子元素.(两阶段载入,good solution) 2.由于一个复合元素内的子元素来源不同,继承而来,组合而来,组合继承而来,导致确定子元素最终位置的复杂性. 3.文字的渲染性质与纹理类同,而纹理的Size由脚本数据预指定,文本的Size则在初始化时动态计算决定,设置可变文本在每次文字变化时需再次计算决定,然后这两个类同逻辑应在同一个加载阶段完成,以保证逻辑的协调. 4.a.虚元素的属性的有效性取决于InheritPropertyFrom函数实现. b.逻辑上,虚元素只能定义元素的样式,大小,对齐偏移,而不能定义具体位置,或具体文本内容. c.无大小定义的纹理,其大小决定于其所依附的元素. 5.对于虚组合元素,如按钮等,它的所有子元素均为第2层虚元素. 6.对于多重复合继承,依靠严格遵循如上准则,多重组合继承应该在逻辑上自然实现.
虚元素的逻辑定义层次 1.只有样式,没有对齐偏移和Size的虚元素为第1层. 2.有对齐偏移或Size的虚元素定义的虚元素为第2层. 3.组合了其他虚子元素的虚组合元素为第3层,如一个虚的按钮的NormalText元素也是个虚元素,同时NormalText又继承于某个FontString元素. 4.复合的Frame元素为第4层.
搜索路径策略: 假设主程序目录为Root,资源目录名ResDir 1.Root\ResDir 2.Root\ResDir.zip 3.Root\Data\ResDir 4.Root\Data\Patch.mpq\ResDir 5.Root\Data\Local.mpq\ResDir 6.Root\Data\ResDir.mpq\ResDir
基本设计格式 1.定义字符串长度为: strlen(szText) + 1 2.所有偏移位置均指以文件头为起点. 3.文件存储各段数据实际以16字节对齐占用,即若strlen为16,加尾部\0字符,长度为17,但实际要占用32字节. 即,除非该段Offset为0(无数据),则该段至少占用16字节的整数倍空间. 4.vec3_type: 3D向量点 vec2_type:2D向量点
// M2文件头部信息结构 struct M2_HEADER // 336 bytes, 84 DWORDs. { DWORD dwIdent; // M2 File Identity DWORD dwVersion; // version: 256
DWORD nModelNameSize; // strlen(szModelName) + 1 DWORD nModelNameOffset; // always 336(header size), points to ModelName.
DWORD dwUnk1; // All 0s, occasionally 1,3(World\SkillActivated\Containers\TreasureChest01: 3)
DWORD nGlobalSequences; DWORD nGlobalSequencesOffset; // points to array of DWORD DWORD nNumAnimations; DWORD nAnimationsOffset; // points to M2_ANIMATION_INFO
DWORD nUnkIndices; DWORD nUnkIndicesOffset; // points to array of unsigned short
DWORD nUnkLongs; DWORD nUnkLongsOffset; // points to array of longs
DWORD nBonesCount; DWORD nBonesOffset; // points to M2_BONE_DATA
DWORD nUnkIndices2; DWORD nUnkIndicesOffset2; // points to array of unsigned short
DWORD nNumVertices; DWORD nVerticesOffset; // points to M2_Vertex!!!
DWORD nNumGeoMeshs; DWORD nGeoMeshsOffset; // Points to M2_GEOMETRY_MESH!!!
DWORD dwMagic[2]; // 0s
DWORD nNumTextures; DWORD nTexturesOffset; // points to M2_TEXTURE_INFO.
DWORD dwUnk6[10]; // Other chunks
DWORD nGroupBoneIDs; // Bone groups data DWORD nGroupBoneIDsOffset; // points to array of unsigned short which is bone id.
DWORD nNumMaterials; DWORD nMaterialsOffset;
DWORD nStruct1Count; // 16 bytes, only 1. DWORD nStruct1Offset;
DWORD nStruct2Count; // 16 bytes, only 1. DWORD nStruct2Offset;
DWORD nStruct3Count; // 16 bytes, only 1. DWORD nStruct3Offset;
vec3_type vMinBox; // Bounding box vec3_type vMaxBox;
float fUnk4; // Unknown but it's right before min box when former mdx format.
float fUnk[5]; DWORD dwUnk8; // Unknown 0 float fUnk9;
DWORD dwUnk10; // Always 36 DWORD dwUnk11[5];
DWORD nAttachments; DWORD nAttachmentsOffset;
DWORD dwUnk12; DWORD dwUnkOffset12;
DWORD nNumEvents; DWORD nEventsOffset;
DWORD dwUnk13; DWORD dwUnkOffset13;
DWORD nCameras1; DWORD nCameras1Offset;
DWORD nCameras2; DWORD nCameras2Offset; DWORD dwUnk14;
DWORD dwUnk15[6]; };
// 纹理信息结构 struct M2_TEXTURE_INFO { DWORD nReplaceableId; // 非0时,表示换装(Creature/Character部分全部为换装类型). DWORD dwUnk2; // 换装参数? DWORD nNameSize; // 字符串长度,为1则空. DWORD nNameOffset; // 字符串偏移位置 };
// 顶点信息结构 struct M2_VERTEX // 48 bytes { vec3_type v; unsigned long bwgt; // ? unsigned short bidx; // ? unsigned short gndx; // ? vec3_type n; vec2_type u; unsigned long unk[2]; // Reserved 0 until now 1.12 };
// 几何 Mesh 信息结构 struct M2_GEOMETRY_MESH // 44 bytes { DWORD nNumIndexedVertices; // Indexed vertices count DWORD nIndicesOffset; // Vertices indices array, points to unsigned shorts. DWORD nPrimitivesCount; // Primitives count, Triangle's count * 3 DWORD nPrimitivesOffset; // Points to primitive vertex indices, MDL_TRIANGLEs. DWORD nNumGroupIndices; // Group indices count DWORD nGroupIndicesOffset; // M2_4GROUP_INDICES array correlative with vertex. DWORD nNumGeoParts; // per 32 bytes DWORD nGeoPartsOffset; // points to M2_GEOMESH_GROUP_DATA DWORD nUnk; // per 24 bypes DWORD nUnkOffset; // points to M2_GROUP_BONE_DATA DWORD dwUnk3; // one of 256, 75, 53, 21 };
struct M2_ANIMATION_INFO // 68 bytes { DWORD nAnimationClass; // Refer to AnimationData.dbc's first field. DWORD nFrameBegin; DWORD nFrameEnd; float fMoveSpeed; int bNonLooping; int nUnk1; DWORD nUnk2; DWORD nUnk3; DWORD nUnk4; vec3_type vMins; // Unsure? vec3_type vMaxs; float fBoundsRadius; DWORD nUnk5; };
struct M2_ANIM_FRAME_SEQUENCE // Animation Frame Sequence { short wType; short wFlags; DWORD dwLineTypeCount; // Interpolate type? DWORD dwLineTypeOffset; DWORD nFramesCount; // num of frame indices DWORD nFramesOffset; // points to frame indices array DWORD nMtDataCount; // num of frame matrix transform data(translate/rotate/scale) DWORD nMtDataOffset; // frame matrix transform data offset };
struct M2_BONE_DATA { int nParentID; short wObjTag; short wUnk; short nGeosetAnimID; short nGeosetID; M2_ANIM_FRAME_SEQUENCE infoTranslate; M2_ANIM_FRAME_SEQUENCE infoRotate; M2_ANIM_FRAME_SEQUENCE infoScale; vec3_type vPivotPoint; };
struct M2_TRANSLATE_DATA { vec3_type vTrans; };
struct M2_ROTATE_DATA { quaternion_type qRotate; };
struct M2_SCALE_DATA { vec3_type vScale; };
struct M2_GEOMESH_GROUP_DATA { DWORD dwUnk; unsigned short nUnk0; unsigned short nNumVertices; unsigned short nUnk2; unsigned short nPrimitivesCount; unsigned short nGroupCount; unsigned short nUnk4; unsigned short nUnk5; unsigned short nUnk6; vec3_type vUnk; };
struct M2_GROUP_BONE_DATA { short dwUnk[12]; };
struct M2_4GROUP_INDICES { unsigned char idx[4]; };
0.XML+Lua,格式和逻辑,强强联合. 1.FrameXML.toc线性顺序加载,出log. 2.每个XML文件描述一项界面元素,关联脚本使用"file="语法. 3.Interface.mpq内为原始版本,在主程序目录下可以创建一个定制版本目录. 4.编辑工具:XMLSpy
HTML UI解决方案 1.使用纯HTML网页界面.(XML描述C++图形界面系统) 2.使用javascript脚本.(Lua 脚本) 3.使用window.external提供COM服务体系入口.(Lua 脚本引擎环境) 4.使用动态绑定IDispatch技巧将一个普通的C++类暴露为动态COM对象. 5.使用执行函数脚本达到事件回调的效果.(Lua脚本执行)
http://www.wowwiki.com http://www.cosmosui.com/forums/ http://vnboards.ign.com/WoW_UI_Customization/b22852/ http://forums.worldofwarcraft.com/board.aspx?fn=wow-interface-customization
搜索路径策略: 假设主程序目录为Root,资源目录名ResDir 1.Root\ResDir 2.Root\ResDir.zip 3.Root\Data\ResDir 4.Root\Data\Patch.mpq\ResDir 5.Root\Data\Local.mpq\ResDir 6.Root\Data\ResDir.mpq\ResDir
====2007-1-28 1.Update MyWarCraftStudio to 0.10.6337 for supporting Burning Crusade final formal client 2.0.6.6337. 2.It should be compatible with the normal 1.12 wow client. 3.I try to experiment DirectX rendering in this version. Change the Cnfg\MyWarCraftStudio.xml about <RenderEngine API="OpenGL"/> to <RenderEngine API="DirectX"/>. Be aware of bugs. http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.10.6337.rar http://linghuye.googlepages.com/MyWarCraftStudio_0.10.6337.rar
====2006-10-15 1.Update MyWarCraftStudio to 0.9.5991 for supporting Burning Crusade Closed Beta client http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.9.5991.rar http://linghuye.googlepages.com/MyWarCraftStudio_0.9.5991.7z
==== 2006-9-6 http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z or http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.9.rar 1.Fix the bug when reading Burning Crusade's patch.mpq 2.Fix bugs when displaying model on ATI graphic cards 3.M2Import.dli is a 3D Max import plugin for importing m2 file, but only meshs now, no texture, no skeleton animation. I am learning how to write a 3D Max import plugin, this is a byproduct.
==== 2006-7-26 1. A new m2 model renderer that can show most model skin texture set, add particle system effect, texture animation, npc skin. 2. Add two mpq edit functions in the pop menu by right clicking on the file tree item. Import File: Import a single file directly from local file system under the clicking tree node. Import Folder: Import all files in a directory from local file system under the clicking tree node. 3. Wow data path config is automaticlly set to where you open your mpq file now, no need to set it manually.
http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.88.rar
==== 2006-6-9 0.Fix the bug of the limit of file name length in edit box. 1.Please change the <WoW DataPath="H:\World of Warcraft\Data\"/> in "Cnfg\MyWarCraftStudio.xml" first. 2.New things: F5 -> Welcome to DestinyMatrix It is just a demo for my hobby and buggy game engine, if it crashs, please forgive me. I have little time to write and fix it, just wasting much time to make my own living and enjoy my life with girl friend. :)
http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.8.rar ==== 2006-5-26 1.Fix for the mywarcraftstudio for the problem of loading wow 1.11 test's Patch.mpq. 2.Decompress the rar and overwrite original program files, it should work for 0.6/0.7.
http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_Fix_1.11_TestPatch.rar ==== 2005-11-3 1.Version 0.7, no new things, just program interface changed. http://www.cnitblog.com/Files/linghuye/MyWarCraft_0.7.rar
Main Interface: http://www.cnitblog.com/Files/linghuye/IWarCraft.rar
==== 2005-3-13
1.Version 0.6在www.Blizzhackers.com上发布。
2.解析出所有数据格式。
==== 2004-07-20 ======== 1.加入保存纹理图像格式功能. 2.加入信息操作对话框机制. 3.加入人物纹理
==== 2004-07-18 ======== 1.同时支持解析魔兽争霸和魔兽世界的MPQ档案,Blp图像纹理,Mdx物体模型. 2.魔兽世界的MPQ档案分布在其主目录的Data下,物体模型model.MPQ,图像纹理texture.MPQ. 3.人物模型的可变更纹理系统尚未解析完全,人物无纹理,World节点下的模型比较有观赏性. 4.BLP2's format is cracked by Technetium's Blpdecode.dll. 5.Most important, ALL credits due to the shadowflare's sfmpq.dll, TheProphet's Warcraft 3 Viewer, Technetium' Blp2decode and DevIL library. I just learn it and code it in my way.
|