﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-平民程序 - linghuye's blog-随笔分类-MyWarCraftStudio</title><link>http://www.cnitblog.com/linghuye/category/587.html</link><description>&lt;p align=right style="background-color: transparent"&gt;天下风云出我辈，一入江湖岁月催。皇图霸业谈笑中，不胜人生一场醉。提剑跨骑挥鬼雨，白骨如山鸟惊飞。尘事如潮人如水，只笑江湖几人回。&lt;p align=right style="background-color: transparent;"&gt;&lt;/p&gt;</description><language>zh-cn</language><lastBuildDate>Mon, 26 Sep 2011 07:25:36 GMT</lastBuildDate><pubDate>Mon, 26 Sep 2011 07:25:36 GMT</pubDate><ttl>60</ttl><item><title>星际争霸2 Beta客户端资源分析</title><link>http://www.cnitblog.com/linghuye/archive/2010/02/22/64347.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Mon, 22 Feb 2010 14:35:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2010/02/22/64347.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/64347.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2010/02/22/64347.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/64347.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/64347.html</trackback:ping><description><![CDATA[星际争霸2 Beta测试开始了,下载下来,没有帐号玩不了,于是开始琢磨客户端资源.<br><br>又看到熟悉的MPQ打包文件,很顺利地打开Battle.net\Battle.net.MPQ.<br>里面是战网的界面资源,界面用的是Scaleform的gfx格式文件,在SWF目录下,显然StarCraft2采用了Scaleform的界面解决方案.接着用2.2版本的ScaleformSDK尝试打开,报告格式不兼容,失败.<br>配合Scaleform使用的是png格式的图像文件.<br>简体中文版的汉化文字已经做好了,在Battle.net.MPQ\i18n\zhCN\String\*.xml里面.<br><br>Mods目录下是主要的资源文件,除了MPQ出现了*.SC2Assets/*.SC2Data/*.SC2Locale文件.<br>其中*.SC2Locale是文本文件,直接用记事本打开.<br>*.SC2Assets/*.SC2Data用UltraEdit打开后,发现还是MPQ文件,于是直接加个.mpq后缀就用MyWarCraftStudio打开看到里面的内容了.<br>Core.SC2Mod\Base.SC2Data里有个Shaders目录,大量的.fx文件,嘿嘿,FX Shader! 比较眼熟的有HDR/DeferredLight/VSSkinning/VSShadow/PSShadow/PSSSAO/PSParallax/PSPostProcess等.嗯,那OpenGL也是用这些shader吗?<br>Core.SC2Mod\Base.SC2Data]\UI里是游戏界面,用的Flash文件,<br>有一些*.galaxy文件,不知道做什么用的.<br><br>Mods\Liberty.SC2Mod\base.SC2Assets是最大的打包文件,打开后发现大量的*.m3格式文件,这就是星际2的模型文件了.纹理这次直接使用的DDS文件,直接看.<br>另外还有一种与m3共存的m3h格式的文件,是xml格式的文本文件,记录了那些可以灵活配置的模型数据,比如Socket绑点.<br><br>Mods\Liberty.SC2Mod\Base.SC2Data里的GameData目录是游戏逻辑相关大量配置文件.<br><br>Support/Version目录下是一些dll,看出星际2用VS2005开发的,用fmod音效底层,icudt42.dll/icuin42.dll/icuuc42.dll不知道是什么库.baselineCache.bin有几十兆,好像是预编译好的shader文件.<br><br>打开SC2.exe文件,找到几个hkpXXX,那就是使用了Havok物理引擎了.<br><br>看来只要把m3和m3h格式搞清楚,再用里面的Fx Shader一渲染就差不多了.<br>   <img src ="http://www.cnitblog.com/linghuye/aggbug/64347.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2010-02-22 22:35 <a href="http://www.cnitblog.com/linghuye/archive/2010/02/22/64347.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Geometry Instance</title><link>http://www.cnitblog.com/linghuye/archive/2008/03/17/41049.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Mon, 17 Mar 2008 13:11:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2008/03/17/41049.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/41049.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2008/03/17/41049.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/41049.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/41049.html</trackback:ping><description><![CDATA[<p>DirectX9.0C直接支持Geometry Instance,通过D3DDECLUSAGE_TEXCOORD多层纹理坐标流,将Instance Data数据传送到GPU,技巧在于:<br>pd3dDevice-&gt;SetStreamSourceFreq(0, (D3DSTREAMSOURCE_INDEXEDDATA | g_numInstancesToDraw));<br>pd3dDevice-&gt;SetStreamSource(0, g_VB_Geometry, 0, D3DXGetDeclVertexSize(g_VBDecl_Geometry, 0));</p>
<p>pd3dDevice-&gt;SetStreamSourceFreq(1, (D3DSTREAMSOURCE_INSTANCEDATA | 1));<br>pd3dDevice-&gt;SetStreamSource(1, g_VB_InstanceData, 0, D3DXGetDeclVertexSize( g_VBDecl_InstanceData, 1));</p>
<p>Stream1中的顶点数据,每g_numInstancesToDraw个顶点处理后递进一个,相当于每Instance递进一次.在HLSL中将Stream1中的数据流还原出来.</p>
<p>OpenGL当前不直接支持Geometry Instance,但是注意到<br>1.OpenGL的glDrawElements簇函数的消耗比DX的DrawIndexedPrimitives小得多.<br>2.OpenGL有一项DirectX所没有的能力,设置当前全局顶点数据,如glColor3f,glTexCoord,glMultiTexCoord,而且此类函数的单个调用在Driver和hardware上的消耗都极小,所以可以用glMultiTexCoord传递顶点数据到shader,而不是使用glUniformMatrix4fvARB或glLoadMatrix传递变换矩阵,此类设置GPU寄存器的函数,或者说是改变Vertex shader当前的全局处理状态的函数,很显然将等待当前GPU正在执行的Vertex process完成后才能返回,CPU将等待GPU.<br></p>
<p><br>The technique does not scale well to complex mesh rendering techniques like skinning; there<br>are not enough vertex attributes to store all of the bone transforms for each instance.<br>但,无论Directx9.0c或OpenGL2.1都无法传递几十个骨骼矩阵这么庞大的顶点数据单位格式(注意是一个顶点数据单位格式,OpenGL没有那么多层的glMultiTexCoord, DirectX没有那么大的顶点声明能容纳几十个矩阵),所以都无法完成带骨骼动画的Geometry Instance,只能是静态物体,或使用CPU作骨骼计算. DX10好像可以,没有显卡,没实践过.<br><br>CPU和GPU是并行结构,若使得两者完全并行运行,效率将最大化.若一方为了线性逻辑而不得不去等待另一方,效率将降低,这就好像两个线程间需要同步的数据或逻辑越多,效率就越低下.<br><br>Reference:<br><a href="http://developer.download.nvidia.com/SDK/9.5/Samples/DEMOS/Direct3D9/src/HLSL_Instancing/docs/HLSL_Instancing.pdf"><span style="COLOR: #ffff00">http://developer.download.nvidia.com/SDK/9.5/Samples/DEMOS/Direct3D9/src/HLSL_Instancing/docs/HLSL_Instancing.pdf</span></a><br><a href="http://developer.download.nvidia.com/SDK/9.5/Samples/DEMOS/OpenGL/src/glsl_pseudo_instancing/docs/glsl_pseudo_instancing.pdf"><span style="COLOR: #ffff00">http://developer.download.nvidia.com/SDK/9.5/Samples/DEMOS/OpenGL/src/glsl_pseudo_instancing/docs/glsl_pseudo_instancing.pdf</span></a></p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/41049.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2008-03-17 21:11 <a href="http://www.cnitblog.com/linghuye/archive/2008/03/17/41049.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DrawIndexedPrimitiveUP这个函数</title><link>http://www.cnitblog.com/linghuye/archive/2007/02/03/22602.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Fri, 02 Feb 2007 16:07:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2007/02/03/22602.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/22602.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2007/02/03/22602.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/22602.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/22602.html</trackback:ping><description><![CDATA[<p>最近被DrawIndexedPrimitiveUP这个函数搞崩了好几次,甚至连显卡的Blue Screen Of Death也出来凑热闹了,所以需要总结一下它崩溃的可能原因,理清下头绪:<br>1.与OpenGL的glXXXPointer一样,如果指针内存错误,崩溃是肯定的,这种bug比较好找.<br>DirectX的原因更复杂:<br>2.DrawIndexedPrimitiveUP不直接崩溃,而是在Present的时候崩溃.可能SetIndices的索引缓冲指针是野指针,LPDIRECT3DVERTEXDECLARATION9是野指针.<br><br>解决方法:使用Debug Runtime排除所有异常调用,这对显卡驱动程序蓝屏崩溃或异常现象的调试十分有效,如:<br>Direct3D9: Decl Validator: X249: (Element Error) (Decl Element [5]) Declaration can't map to fixed function FVF because blendweight must use D3DDECLTYPE_FLOAT1/2/3/4.<br>Direct3D9: (ERROR) :DrawIndexedPrimitive failed.<br><br>3.又发现一种DrawIndexedPrimitiveUP错误,当错误地把索引个数作为第2个参数传入(实际上第2个参数应该是顶点个数), 导致程序在运行一段不定时间,随机地,可能地,花屏了.此时DX8报告一个驱动程序的错误:<br>Direct3D8: (ERROR) :Driver not handled in DrawPrimitives2<br>Direct3D8: (ERROR) :Driver returned error: DDERR_INVALIDPARAMS&nbsp;&nbsp;<br>Direct3D8: (ERROR) :Driver failed command batch. Attempting to reset device state. The device may now be in an unstable state and the application may experience an access violation.<br><br>另:在试图安装现在的DirectX Debug Runtime时发现先前网上的资料或MSDN里都没谈到现在的安装方法:把Developer Runtime\x86里的dll复制到System32目录,然后再运行Utilities\Bin\x86\dxcpl.exe切换到Debug Rumtime模式.运行REF模式需要Debug Runtime环境!<br><br>Reference:<br><a style="COLOR: #ffff00" href="http://linghuye.googlepages.com/MyownlittleDirectXFAQ.mht">http://linghuye.googlepages.com/MyownlittleDirectXFAQ.mht</a><a href="http://tomsdxfaq.blogspot.com/"><font color=#ffff00></font></a></p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/22602.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2007-02-03 00:07 <a href="http://www.cnitblog.com/linghuye/archive/2007/02/03/22602.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MyWarCraftStudio 0.10.6337</title><link>http://www.cnitblog.com/linghuye/archive/2007/01/28/22395.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sun, 28 Jan 2007 07:18:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2007/01/28/22395.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/22395.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2007/01/28/22395.html#Feedback</comments><slash:comments>22</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/22395.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/22395.html</trackback:ping><description><![CDATA[1.Update MyWarCraftStudio to 0.10.6337 for supporting Burning Crusade final formal client 2.0.6.6337.<br />2.It should be compatible with the normal 1.12 wow client.<br />3.I try to experiment DirectX rendering in this version. Change the Cnfg\MyWarCraftStudio.xml about &lt;RenderEngine API="OpenGL"/&gt; to &lt;RenderEngine API="DirectX"/&gt;. Be aware of bugs.<br /><br /><a href="/Files/linghuye/MyWarCraftStudio_0.10.6337.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.10.6337.rar</font></a><br /><a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.10.6337.rar"><font color="#ffff00">http://linghuye.googlepages.com/MyWarCraftStudio_0.10.6337.rar</font></a><img src ="http://www.cnitblog.com/linghuye/aggbug/22395.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2007-01-28 15:18 <a href="http://www.cnitblog.com/linghuye/archive/2007/01/28/22395.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>身处何乡</title><link>http://www.cnitblog.com/linghuye/archive/2006/10/20/18206.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Fri, 20 Oct 2006 13:25:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/10/20/18206.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/18206.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/10/20/18206.html#Feedback</comments><slash:comments>12</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/18206.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/18206.html</trackback:ping><description><![CDATA[
		<p>基于Portal的引擎如何知道当前人物处于哪个sector是个难决的问题.用google搜索了一下论坛,有两种方案:<br />一种主张跟踪人物位置,给定一个起始sector,而后时刻检查人物是否穿过某个portal平面,一旦穿过则更新当前人物的sector位置变量.<br />一种主张实时计算,需要附加的对sector进行划分的bsp树数据进行计算.</p>
		<p>在程序逻辑上,我比较倾向第2种,因为其逻辑概念比较清晰简单,但其需要额外的数据制作,wmo数据的BSP树是普通的leafy bsp,而非solid leafy bsp,似乎不足以判断一个点是否在BSP整体空间内,而且不能适应2个sector相嵌套的情形,WoW的城内的建筑portal摆放随意性很大,似乎没什么限制.</p>
		<p>而判断人物穿过portal,感觉上逻辑比较模糊,脆弱,不稳定.当人物一直在portal边上左右徘徊时,算法是否够强壮?人物初始化时,又通过什么手段得知其初始sector呢?人物从城外进入城内的瞬间,又如何知道进入哪个sector?</p>
		<p>WoW使用了哪一种呢?至少穿越portal这方案还可以实现出来,Crystal Space也是这么干的,可惜大部分的资料根本不提这一问题.<br /></p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/18206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-10-20 21:25 <a href="http://www.cnitblog.com/linghuye/archive/2006/10/20/18206.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Burning Crusade Closed Beta</title><link>http://www.cnitblog.com/linghuye/archive/2006/10/15/18005.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sun, 15 Oct 2006 15:43:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/10/15/18005.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/18005.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/10/15/18005.html#Feedback</comments><slash:comments>23</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/18005.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/18005.html</trackback:ping><description><![CDATA[1. MPQ resource files reorganized, locale related resource mpqs are moved into locale sub-directory like "enUS", "enGB", "koKR", "zhCN".<br />2. Some DBC files fields changed and new fields added.<br />3. M2 format changes a little.<br />    a. A int32 is inserted into bone define struct, so the new m2 model can not be used in current wow client.<br />    b.Rotation quaternion is packed into 8 bytes as:<br />    struct PACK_QUTERNION  {   int16 x,y,z,w;  }; <br />    Extract out float quternion, for exsample:<br />    PACK_QUTERNION  q = pCompressQuats[i];<br />    qRotate.x = float(q.x &gt; 0? q.x - 32767 : q.x + 32767)/32767.0f;<br />    qRotate.y = float(q.y &gt; 0? q.y - 32767 : q.y + 32767)/32767.0f;<br />    qRotate.z = float(q.z &gt; 0? q.z - 32767 : q.z + 32767)/32767.0f;<br />    qRotate.w = float(q.w &gt; 0? q.w - 32767 : q.w + 32767)/32767.0f;<br /><br />Update MyWarCraftStudio to 0.9.5991 for supporting Burning Crusade Closed Beta client, and it should also work for current Wow client and alpha test client.<br /><a href="/Files/linghuye/MyWarCraftStudio_0.9.5991.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.9.5991.rar</font></a><img src ="http://www.cnitblog.com/linghuye/aggbug/18005.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-10-15 23:43 <a href="http://www.cnitblog.com/linghuye/archive/2006/10/15/18005.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>燃烧远征Closed Beta的资源变动</title><link>http://www.cnitblog.com/linghuye/archive/2006/10/14/17959.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 14 Oct 2006 02:28:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/10/14/17959.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/17959.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/10/14/17959.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/17959.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/17959.html</trackback:ping><description><![CDATA[
		<p>记得上回WoW的Beta测试时mdx格式被替换成m2格式,这次暴雪又对资源文件和目录作出了调整,DBC字段有添加和变动.</p>
		<p>1.Data下出现有enUS目录,本地化的资源以后将放在Data下对应的本地化子目录中,原speech.mpq变为enUS\speech-enUS.MPQ,Interface.mpq,dbc.mpq并入enUS\locale-enUS.mpq. 想来是暴雪给每个本地化版本做那个2G多的patch做怕了.<br /><br />2.Common.mpq 达到了3.49G,把之前的各个分类资源mpq全统一了.<br /><br />3.M2 格式有变动,骨骼结构被修改,旋转四元数数据被压缩成8个字节的int16 * 4,还原4元数失败.</p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/17959.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-10-14 10:28 <a href="http://www.cnitblog.com/linghuye/archive/2006/10/14/17959.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Wow Burning Crusade</title><link>http://www.cnitblog.com/linghuye/archive/2006/09/02/16275.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Fri, 01 Sep 2006 16:57:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/09/02/16275.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/16275.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/09/02/16275.html#Feedback</comments><slash:comments>16</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/16275.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/16275.html</trackback:ping><description><![CDATA[
		<img src="http://linghuye.googlepages.com/BloodElfFemale.png" />
		<img src="http://linghuye.googlepages.com/BrokenMale.png" />
		<br />
		<img src="http://linghuye.googlepages.com/Cool.png" />
		<img src="http://linghuye.googlepages.com/DaeneiFemale.png" />
		<br />
		<img src="http://linghuye.googlepages.com/DaeneiMale.png" />
		<img src="http://linghuye.googlepages.com/Elekk.png" />
		<br />
		<img src="http://linghuye.googlepages.com/FelOrc.png" />
		<img src="http://linghuye.googlepages.com/mob1.png" />
		<br />
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				<span style="COLOR: #008000">
						<font size="2">//</font>
				</span>
				<font size="2">
						<span style="COLOR: #008000"> To open the new patch.mpq <br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> Error if mpq file is bigger than 2G</span>
				</font>
				<span style="COLOR: #008000">
						<br />
						<font size="2">
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						</font>
				</span>
				<font size="2">
						<span style="COLOR: #000000">fseek(<img src="http://www.cnitblog.com/images/dot.gif" />);    </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> or</span>
				</font>
				<span style="COLOR: #008000">
						<br />
						<font size="2">
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						</font>
				</span>
				<font size="2">
						<span style="COLOR: #000000">lseek(<img src="http://www.cnitblog.com/images/dot.gif" />);    </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> or</span>
				</font>
				<span style="COLOR: #008000">
						<br />
						<font size="2">
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						</font>
				</span>
				<font size="2">
						<span style="COLOR: #000000">::SetFilePointer(hFile, dwHashTablePos, </span>
						<span style="COLOR: #000000">0</span>
				</font>
				<font size="2">
						<span style="COLOR: #000000">, FILE_BEGIN);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> Correct</span>
				</font>
				<span style="COLOR: #008000">
						<br />
						<font size="2">
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						</font>
				</span>
				<font size="2">
						<span style="COLOR: #000000">_lseeki64(<img src="http://www.cnitblog.com/images/dot.gif" />);   </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> or</span>
				</font>
				<span style="COLOR: #008000">
						<br />
						<font size="2">
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
						</font>
				</span>
				<span style="COLOR: #000000">
						<br />
						<font size="2">
								<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />LARGE_INTEGER li;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />li.QuadPart </font>
				</span>
				<span style="COLOR: #000000">
						<font size="2">=</font>
				</span>
				<font size="2">
						<span style="COLOR: #000000"> dwHashTablePos;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />::SetFilePointer(hFile, li.LowPart, </span>
						<span style="COLOR: #000000">&amp;</span>
						<span style="COLOR: #000000">li.HighPart, FILE_BEGIN);</span>
				</font>
		</div>
		<br />
		<p>So change the every fseek/SetFilePointer in stormlib or libmpq in WowModelViewer source code and recompile, we can open the new patch.mpq in WoW BC which is 2.7G. The mpq format is NOT changed, I am a fool to decode a new format from the begining.<br /><br />=============================================<br /><a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z"><font color="#ffff00">http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z</font></a><br />or<br /><a href="/Files/linghuye/MyWarCraftStudio_0.9.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.9.rar</font></a><br />1.Fix the bug when reading Burning Crusade's patch.mpq<br />2.Fix bugs when displaying model on ATI graphic cards<br />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.</p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/16275.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-09-02 00:57 <a href="http://www.cnitblog.com/linghuye/archive/2006/09/02/16275.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Portal Engine 学习与设计</title><link>http://www.cnitblog.com/linghuye/archive/2006/08/22/15716.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Tue, 22 Aug 2006 04:53:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/08/22/15716.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/15716.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/08/22/15716.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/15716.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/15716.html</trackback:ping><description><![CDATA[
		<p>Wow的室内环境,奥格瑞玛/血色修道院等,是由wmo文件代表的sector组成的,从解析出来的sector三维景象来看,是很明显的portal sector,比如甬道被格成单独的wmo,每个wmo sector有明显的portal开口.<br /><br />Portal引擎和BSP是可以一起使用的,不相互排斥,对每个sector的处理将采用BSP算法,这个概念很关键.Portal的另一个重要作用是将室外环境和室内环境在算法逻辑上联系起来.<br /><br />可以确定,Wow的室内碰撞检测是使用BSP来完成的,其BSP为Leafy BSP. Leafy BSP使用的切分平面可以不与场景中的多边形共面,切分平面目前只看到X,Y,Z三轴,定义等同Quake3源码中的定义.<br />在碰撞检测中,BSP数据最神奇的地方就在于,它能够快速地给出人物附近的三角面集合,即需要进行碰撞检测的三角形集合.<br /><br />若将Leaf上的数据全设0,则进入游戏后,室内场景就没有碰撞了.<br />此BSP除了碰撞检测,还对室内的渲染有影响.<br /><br />Most engines do not use the BSP-tree to speed up the drawing, such as portal engines, but still almost all of them have built a BSP-tree out of the geometry. This is because of the great advantage when calculating the collision detection, namely that it is very cheap to position the user in the BSP-tree. When that is done, the only polygons needed to be checked; are the polygons in the leaves the object passed through that frame.<br /><br /><font color="#ffc0cb">References:</font><br /><a href="http://www.flipcode.com/articles/portals_issue01.shtml"><font color="#ffff00">http://www.flipcode.com/articles/portals_issue01.shtml</font></a><br /><font color="#ffff00">Core Techniques and Algorithms in Game Programming<br /><a href="http://www.devmaster.net/articles/bsp-trees/"><font color="#ffff00">http://www.devmaster.net/articles/bsp-trees/</font></a><br /><a href="http://www.karkza.org/ftp/programming/misc/bsp.htm"><font color="#ffff00">http://www.karkza.org/ftp/programming/misc/bsp.htm</font></a><br /><a href="http://www.devmaster.net/articles/bsp-trees-physics/"><font color="#ffff00">http://www.devmaster.net/articles/bsp-trees-physics/</font></a></font></p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/15716.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-08-22 12:53 <a href="http://www.cnitblog.com/linghuye/archive/2006/08/22/15716.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Animation Blending and transitioning</title><link>http://www.cnitblog.com/linghuye/archive/2006/08/21/15647.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Mon, 21 Aug 2006 04:43:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/08/21/15647.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/15647.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/08/21/15647.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/15647.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/15647.html</trackback:ping><description><![CDATA[
		<p>在魔兽世界中,在人物奔跑的同时,使用挥手等表情命令,人物会在奔跑的同时作出其他动作,这是骨骼动作混合.<br />猎人中奔跑时开始拉弓时,身体会过渡到拉弓的动作,而不是瞬间变换为拉弓姿势,这是骨骼动作transitioning.</p>
		<p>骨骼动作混合是作动作过渡的技术基础,目前看到有两种方案,一种简单,一种复杂.<br />简单的方案应该是起源于Quake,魔兽世界亦采用该方案,即,在骨架数据中预先标识某ID骨骼为上半身的根骨骼,依此标识下半身的根骨骼,手臂的根骨骼,腿的根骨骼.<br />使用骨骼动画架构可以很容易地,让奔跑的动作帧数据只作用于下本身的骨骼层次,即只作用于整个骨骼层次的子骨骼体系.让挥手或开枪的动作只作用上本身骨骼,最终的结果形成了动作混合.<br />复杂的方案是Weighted animation blending,为每个动作的每根骨骼标识它的权重,即标识每根骨骼在每个动作中的重要性,可以用1.0标识腿部骨骼在奔跑动作中的权重,用0.0标识上半身在奔跑动作中的权重.<br />与另一动作混合时,两个动作骨骼分别计算自身当前的骨骼帧运动数据,然后依据动作权重进行插值混合两者的运动数据,Jupiter,Nebula使用了该方案.其复杂不在程序上,而在美工制作上,程序代码上更优雅简单.</p>
		<p>奔跑时拉弓就要让下半身保持奔跑动作,上本身从奔跑时的姿势过渡到拉弓姿势.Animation transitioning是要解决两个骨架姿势之间的过渡问题,从一个姿势过渡到另一个姿势,即从一个骨架数据渐转到另一个骨架数据,即在过渡间的人物骨架姿势由两个动作的骨架数据混合而成,一个数据渐增0-&gt;1,一个数据渐减1-&gt;0,这里的权重作用于整个骨架,称Weighted animation blending.这样的过渡是数据计算出来的,而不是美工设计出来的,有时会有变形出现.</p>
		<p>这些方案都基于骨架层次体系,适合组合任意个骨骼动作.帧数据插值混合时,若姿势间相差过大,旋转超过180度,slerp计算会出现混乱.</p>
		<p>
				<font color="#ffff00">References:</font>
				<br />Quake3 source code<br />WowModelViewer's animation blending source code<br /><a href="http://www.circlesoft.org/DirectMesh2/DM2Spec/pages/Features.htm"><font color="#ffffff">http://www.circlesoft.org/DirectMesh2/DM2Spec/pages/Features.htm</font></a><br /><a class="" title="" href="http://linghuye.googlepages.com/jeppsson_masterthesis.7z" target=""><font color="#ffff00">Realtime Character Animation Blending Using Weighted Skeleton Hierarchies</font></a> (该问题最好的论文)</p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/15647.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-08-21 12:43 <a href="http://www.cnitblog.com/linghuye/archive/2006/08/21/15647.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MyWarCraftStudio 0.88</title><link>http://www.cnitblog.com/linghuye/archive/2006/07/26/14220.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Wed, 26 Jul 2006 04:57:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/07/26/14220.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/14220.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/07/26/14220.html#Feedback</comments><slash:comments>15</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/14220.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/14220.html</trackback:ping><description><![CDATA[1. A new m2 model renderer that can show most model skin texture set, add particle system effect, texture animation, npc skin.<br />2. Add two mpq edit functions in the pop menu by right clicking on the file tree item.<br />   Import File: Import a single file directly from local file system under the clicking tree node.<br />   Import Folder: Import all files in a directory from local file system under the clicking tree node.<br />3. Wow data path config is automaticlly set to where you open your mpq file now, no need to set it manually.<br /><br /><a href="/Files/linghuye/MyWarCraftStudio_0.88.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.88.rar</font></a><br /><br />Please update,<br /><a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z"><font color="#ffff00">http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z</font></a><img src ="http://www.cnitblog.com/linghuye/aggbug/14220.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-07-26 12:57 <a href="http://www.cnitblog.com/linghuye/archive/2006/07/26/14220.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我终于站在那辆杂货车上</title><link>http://www.cnitblog.com/linghuye/archive/2006/07/16/13738.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sun, 16 Jul 2006 15:33:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/07/16/13738.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/13738.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/07/16/13738.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/13738.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/13738.html</trackback:ping><description><![CDATA[
		<img height="896" alt="Phyx.jpg" src="http://www.cnitblog.com/images/cnitblog_com/linghuye/Phyx.jpg" width="1120" border="0" />
		<br />哈哈,哈哈,在物理引擎研究上总算有了突破,终于可以实用了,PhysX不愧是商业级的物理引擎啊.<br /><br />我终于知道自己对物理引擎的研究钻到哪个死胡同了,完全没跟上商业主流.<br />Ageia PhysX收购了物理引擎设计商Novodex,物理加速卡已经诞生,Nvidia和ATI联合Havok物理引擎加入混战.<br />如同当初显卡的发展和混战,又有好戏看了,最终Havok引擎也会开放API的.<br />与显卡驱动程序一样,没有物理硬件,物理引擎可以运行在软件模拟下,PhysX Demo的效果cool毙了.<br /><br />7月15日 －&gt; 7月16日<img src ="http://www.cnitblog.com/linghuye/aggbug/13738.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-07-16 23:33 <a href="http://www.cnitblog.com/linghuye/archive/2006/07/16/13738.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MyWarCraft_0.8</title><link>http://www.cnitblog.com/linghuye/archive/2006/06/09/11898.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Fri, 09 Jun 2006 08:12:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/06/09/11898.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/11898.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/06/09/11898.html#Feedback</comments><slash:comments>13</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/11898.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/11898.html</trackback:ping><description><![CDATA[最近没啥好写的,把半成品挖出来充充数.<br />一直不能解决物理引擎的问题,一切都停滞不前.<br /><br /><a href="/linghuye/archive/2005/08/13/1861.aspx"><font color="#ffff00">http://www.cnitblog.com/linghuye/archive/2005/08/13/1861.aspx</font></a><br /><a href="/Files/linghuye/MyWarCraftStudio_0.88.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.88.rar</font></a><br /><br />Please update,<br /><a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z"><font color="#ffff00">http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z</font></a><a href="/Files/linghuye/MyWarCraft_0.8.rar"><font color="#ffff00"></font></a><img src ="http://www.cnitblog.com/linghuye/aggbug/11898.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-06-09 16:12 <a href="http://www.cnitblog.com/linghuye/archive/2006/06/09/11898.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>www.wowguru.com/wiki</title><link>http://www.cnitblog.com/linghuye/archive/2006/04/28/9832.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Fri, 28 Apr 2006 02:23:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/04/28/9832.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/9832.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/04/28/9832.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/9832.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/9832.html</trackback:ping><description><![CDATA[
		<p>新的Wow wiki,欢迎拜访!<br /><br />New wow wiki site, welcome to have a visit!</p>
		<p>
				<a href="http://www.wowguru.com/wiki/index.php/Main_Page">
						<font color="#ffff00">http://www.wowguru.com/wiki/index.php/Main_Page</font>
				</a>
		</p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/9832.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-04-28 10:23 <a href="http://www.cnitblog.com/linghuye/archive/2006/04/28/9832.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WowMapViewer stuffs</title><link>http://www.cnitblog.com/linghuye/archive/2006/02/11/6584.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 11 Feb 2006 12:28:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2006/02/11/6584.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/6584.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2006/02/11/6584.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/6584.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/6584.html</trackback:ping><description><![CDATA[Ufoz的WowMapViewer的sourceforge点被关掉了,这个是说明和及更新版本的下载点,WowModelViewer现在版本是0.47.<BR><A href="http://www.pyoro.com/wowmapview.html">http://www.pyoro.com/wowmapview.html</A><BR>程序About框上有linghuye的名字,pioneers,呵呵,低调,低调.<BR>幸亏我有先见之明,存了以前的文档资料.<BR><A href="/Files/linghuye/Wowwiki.rar">http://www.cnitblog.com/Files/linghuye/Wowwiki.rar</A><img src ="http://www.cnitblog.com/linghuye/aggbug/6584.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2006-02-11 20:28 <a href="http://www.cnitblog.com/linghuye/archive/2006/02/11/6584.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>场景裁减方案估计</title><link>http://www.cnitblog.com/linghuye/archive/2005/11/25/4899.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Fri, 25 Nov 2005 09:06:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/11/25/4899.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/4899.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/11/25/4899.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/4899.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/4899.html</trackback:ping><description><![CDATA[0.使用天空球包围整个世界,使用雾限制可控远景.<BR>1.地形裁减: <BR>&nbsp; 1.使用四叉树算法对MapArea-&gt;AreaChunk逐层进行相对镜头的可见性裁减.<BR>&nbsp; 2.在1过程中,对镜头内的地形进行水平线扫描剔除.<BR>&nbsp; 2.然后镜头裁减完的区域必然是连续区域,对此连续区域作ROAM算法下的LOD处理,近细远粗.<BR>2.模型裁减: <BR>&nbsp; 1.基于上述地形四叉树裁减下作基本的每一个模型的裁减,实践测试结果表明收益大于测试成本.<BR>&nbsp; 2.距离裁减:以镜头为中心画圆,处于远景雾外的模型不作渲染,模型进雾后会逐步显示,这样不会有poping缺陷.<BR>&nbsp; 3.不采用模型LOD,数据制作过于复杂,控制复杂,加大内存需求,也有poping缺陷,优点不明显.<BR>&nbsp;&nbsp;4.在地形水平线裁减中剔除物体.<BR>3.进入BSP室内场景后的裁减.<BR><BR><IMG src="http://linghuye.nease.net/Pic/Show8.jpg" border=0><img src ="http://www.cnitblog.com/linghuye/aggbug/4899.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-11-25 17:06 <a href="http://www.cnitblog.com/linghuye/archive/2005/11/25/4899.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WoW骨骼动画的GLSL实现</title><link>http://www.cnitblog.com/linghuye/archive/2005/11/14/4471.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Mon, 14 Nov 2005 09:38:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/11/14/4471.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/4471.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/11/14/4471.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/4471.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/4471.html</trackback:ping><description><![CDATA[<p>在OpenGL.org论坛上不幸被告知VERTEX_BLEND_ARB扩展不属OpenGL核心标准,被ARB卡查掉了,Nvidia也不实现了,所以在OpenGL下要做骨骼动画只好靠Shader了,让CPU计算,效率会很惨,写写Demo还凑和.</p>
<p>使用指令将顶点的骨骼和权重信息作为Generic Attribute属性传入给Shader对象.<br>GLint indexBone = glGetAttribLocationARB(m_glPrograme, "bone");<br>GLint indexWeight = glGetAttribLocationARB(m_glPrograme, "weight");<br>glVertexAttribPointerARB(indexBone, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(MDL_VERTEX), m_arrMdlVertices[0].bones);<br>glVertexAttribPointerARB(indexWeight, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(MDL_VERTEX), m_arrMdlVertices[0].weights);<br>glEnableVertexAttribArrayARB(indexBone);<br>glEnableVertexAttribArrayARB(indexWeight);</p>
<p>在每帧在CPU中计算骨骼矩阵,并将计算好的骨骼矩阵数组传入Shader对象.<br>GLint indexBoneMatrices = glGetUniformLocationARB(m_model.m_glPrograme, "boneMatrices");<br>for(unsigned int i = 0; i &lt; m_animSkeleton.m_vecBones.size(); i++)<br>{&nbsp;<br>&nbsp;CM2Bone* pBone = m_animSkeleton.m_vecBones[i];<br>&nbsp;glUniformMatrix4fvARB(indexBoneMatrices + i, 1, GL_TRUE, pBone-&gt;m_transformMatrix);<br>}</p>
<p>搞定,运行,发现wow的兽人模型竟然有128个骨骼,而N6200的shader的Uniform Matrix参数最多只给60个,还得考虑低端机器,玻璃渣是怎么做的?发现DX的实现从来就是送入硬件处理的,节省了额外的顶点内存,加快了速度,确实是不二的选择.<br>结论:<br>1.模型中的LOD是硬件LOD,即匹配给各层次的显卡使用的,最小LOD的动画都只需十几根骨骼,这对美工的要求很高.<br>2.可以直接传入UNSIGNED_BYTE的骨骼权重,让显卡去运算到float的mapping.<br>3.uniform mat4 boneMatrices[60];显卡能力不同将导致这里实际的60数值不同.<br>4.低端显卡不支持for循环控制流,要拆开手写.<br></p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">attribute&nbsp;vec4&nbsp;bone;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>attribute&nbsp;vec4&nbsp;weight;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>uniform&nbsp;mat4&nbsp;boneMatrices[</span><span style="COLOR: #000000">32</span><span style="COLOR: #000000">];<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>void&nbsp;main()<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>{&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;vec4&nbsp;blendVertex&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;vec4(</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">&nbsp;i&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;&nbsp;i&nbsp;</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">4</span><span style="COLOR: #000000">;&nbsp;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;blendVertex&nbsp;</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">&nbsp;boneMatrices[</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">(bone[i])]&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;gl_Vertex&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;weight[i];<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;gl_Position&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;gl_ModelViewProjectionMatrix&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;blendVertex;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;gl_TexCoord[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;gl_MultiTexCoord0;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;gl_FrontColor&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;gl_Color;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;vec4&nbsp;ecPos&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;gl_ModelViewMatrix&nbsp;</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">&nbsp;blendVertex;<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;gl_FogFragCoord&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #0000ff">abs</span><span style="COLOR: #000000">(ecPos.z);<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top>}<br><img src="http://www.cnitblog.com/Images/OutliningIndicators/None.gif" align=top></span></div>
<br>修正:<br>1.ATI实现的GLSL实在缺德, gl_TextureMatrix不是默认单位矩阵值,而是没有定义, Nvidia下运行正常,ATI不正常. 
<img src ="http://www.cnitblog.com/linghuye/aggbug/4471.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-11-14 17:38 <a href="http://www.cnitblog.com/linghuye/archive/2005/11/14/4471.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MyWarCraftStudio's DBCViewer</title><link>http://www.cnitblog.com/linghuye/archive/2005/09/23/2851.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Fri, 23 Sep 2005 08:01:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/09/23/2851.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/2851.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/09/23/2851.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/2851.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/2851.html</trackback:ping><description><![CDATA[<P>DBCTool的数据打开速度太慢,排序也很慢,受不了,于是改良了一下我原有的DBCReader.dll,打开和排序速度都很快,当然跟DBCTool的功能不能比.</P>
<P>MyWarCraftStudio's DBCCraft, support:</P>
<P>1.DBC data browse<BR>2.Data field sort by clicking column title.<BR>3.Data search by text<BR>4.Data export to csv<BR>5.Data field define by change the Cnfg\DBCRecordDef.xml<BR><BR><A href="http://www.linghuye.nease.net/Tools/MyWarCraftStudio_DBCViewer.rar"><FONT color=#ffff00>http://www.linghuye.nease.net/Tools/MyWarCraftStudio_DBCViewer.rar</FONT></A><FONT color=#0080ff><BR><BR></FONT><FONT color=#9acd32><FONT color=#006400>linghuye software</FONT><BR></FONT></P><img src ="http://www.cnitblog.com/linghuye/aggbug/2851.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-09-23 16:01 <a href="http://www.cnitblog.com/linghuye/archive/2005/09/23/2851.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>类MPQ格式游戏资源打包解决方案</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/14/1904.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sun, 14 Aug 2005 11:00:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/14/1904.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1904.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/14/1904.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1904.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1904.html</trackback:ping><description><![CDATA[类Blizzard  MPQ格式的游戏资源打包解决方案<BR>1.打包成单文件的独立虚拟文件系统支持,减少游戏资源载入的IO消耗时间.<BR>2.支持Zip,LZMA,Wave压缩,文件表加密.<BR>3.支持与本地操作系统的文件树无缝连接（优先加载本地文件树系统中的文件,用于资源补丁发布等）,分语言的资源管理.<BR>4.欢迎使用 <FONT color=#00ff00>Linghuye Software<BR></FONT><A href="http://www.cnitblog.com/linghuye/Files/linghuye/PackCraft_2710.rar"><BR><FONT color=#ffff00>http://www.cnitblog.com/Files/linghuye/PackCraft_2710.rar</FONT></A><img src ="http://www.cnitblog.com/linghuye/aggbug/1904.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-14 19:00 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/14/1904.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WoW's ROAM Terrain</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1868.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:44:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1868.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1868.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1868.html#Feedback</comments><slash:comments>26</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1868.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1868.html</trackback:ping><description><![CDATA[繁琐沉重的工作麻木了程序员的思维，也只有在完全属于自己的闲趣的代码中才能找回自己的方向和热情。<br />留下些足迹，让未来的自己，体味现在与曾经的彷徨和执着。<br />嗨，我梦萦的Kalimdor大陆.<br /><img src="http://www.cnitblog.com/images/cnitblog_com/linghuye/WoWRoam.jpg" border="0" /><br /><br /><font color="#ffff00">Reference:<br /></font><a href="http://www.cognigraph.com/ROAM_homepage/"><font color="#ffff00">http://www.cognigraph.com/ROAM_homepage/</font></a><br /><img src ="http://www.cnitblog.com/linghuye/aggbug/1868.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:44 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1868.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MPQ及文件打包</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1866.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:43:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1866.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1866.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1866.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1866.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1866.html</trackback:ping><description><![CDATA[1.树型文件结构不过是为人便于管理使用而制造的假象,实际文件格式坚持以数组存储，通过某种假象信息表达出树型结构，如路径名。<BR>2.坚持读取效率至上原则，添加编辑删除效率次之，文件大小用一个终极优化整理操作完成。<BR>3.坚持哈希表结构,使用加密密钥形成实际的不同文件格式。<BR>4.设计上要考虑多语言化支持，多格式压缩，与本地文件系统操作完全兼容,无缝链接。<BR>5.Great&nbsp;thx&nbsp;to&nbsp;Ladislav&nbsp;Zezula's&nbsp;<A href="http://www.zezula.net/" target=_blank><FONT style="BACKGROUND-COLOR: #000000" color=#ffff00>http://www.zezula.net</FONT></A><BR>6.<A href="http://www.soarchin.com/" target=_blank><FONT color=#ffff00>http://www.soarchin.com</FONT></A>的MPQMaster做的不错,用Upx压缩,自称最小最快,嘿嘿我的程序也一样.<BR>7.文件数据结构无非:<BR>&nbsp;&nbsp;&nbsp;a.HEADER<BR>&nbsp;&nbsp;&nbsp;b.DataChunk(tag,offset.size)<BR>&nbsp;&nbsp;&nbsp;c.StructArray<img src ="http://www.cnitblog.com/linghuye/aggbug/1866.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:43 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1866.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>That's My UI</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1867.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:43:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1867.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1867.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1867.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1867.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1867.html</trackback:ping><description><![CDATA[<P>Develop&nbsp;in&nbsp;2005&nbsp;for&nbsp;my&nbsp;own&nbsp;road&nbsp;to&nbsp;my&nbsp;wow. 
<P>&nbsp;</P>
<P>XML&nbsp;UI排版实现思考<BR>1.每个UI元素要根据其父元素的既定位置进行对齐偏移,所以在代码逻辑上父元素应在自身导入完备后,再行导入其子元素.(两阶段载入,good&nbsp;solution)<BR>2.由于一个复合元素内的子元素来源不同,继承而来,组合而来,组合继承而来,导致确定子元素最终位置的复杂性.<BR>3.文字的渲染性质与纹理类同,而纹理的Size由脚本数据预指定,文本的Size则在初始化时动态计算决定,设置可变文本在每次文字变化时需再次计算决定,然后这两个类同逻辑应在同一个加载阶段完成,以保证逻辑的协调.<BR>4.a.虚元素的属性的有效性取决于InheritPropertyFrom函数实现.<BR>&nbsp;&nbsp;b.逻辑上,虚元素只能定义元素的样式,大小,对齐偏移,而不能定义具体位置,或具体文本内容.<BR>&nbsp;&nbsp;c.无大小定义的纹理,其大小决定于其所依附的元素.<BR>5.对于虚组合元素,如按钮等,它的所有子元素均为第2层虚元素.<BR>6.对于多重复合继承,依靠严格遵循如上准则,多重组合继承应该在逻辑上自然实现.</P>
<P>虚元素的逻辑定义层次<BR>1.只有样式,没有对齐偏移和Size的虚元素为第1层.<BR>2.有对齐偏移或Size的虚元素定义的虚元素为第2层.<BR>3.组合了其他虚子元素的虚组合元素为第3层,如一个虚的按钮的NormalText元素也是个虚元素,同时NormalText又继承于某个FontString元素.<BR>4.复合的Frame元素为第4层.<BR></P><IMG src="http://211.152.49.10/linghuye/Images/MyUI.JPG" border=0><img src ="http://www.cnitblog.com/linghuye/aggbug/1867.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:43 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1867.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>暴雪程序方案策略</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1864.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:42:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1864.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1864.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1864.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1864.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1864.html</trackback:ping><description><![CDATA[搜索路径策略:<BR>假设主程序目录为Root,资源目录名ResDir<BR>1.Root\ResDir<BR>2.Root\ResDir.zip<BR>3.Root\Data\ResDir<BR>4.Root\Data\Patch.mpq\ResDir<BR>5.Root\Data\Local.mpq\ResDir<BR>6.Root\Data\ResDir.mpq\ResDir<img src ="http://www.cnitblog.com/linghuye/aggbug/1864.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:42 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1864.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WoW's M2 格式研究</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1865.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:42:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1865.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1865.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1865.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1865.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1865.html</trackback:ping><description><![CDATA[<P>基本设计格式<BR>1.定义字符串长度为:&nbsp;strlen(szText)&nbsp;+&nbsp;1<BR>2.所有偏移位置均指以文件头为起点.<BR>3.文件存储各段数据实际以16字节对齐占用,即若strlen为16,加尾部\0字符,长度为17,但实际要占用32字节.&nbsp;即,除非该段Offset为0(无数据),则该段至少占用16字节的整数倍空间.<BR>4.vec3_type:&nbsp;3D向量点&nbsp;&nbsp;&nbsp;vec2_type:2D向量点 
<P>&nbsp;</P>
<P>//&nbsp;M2文件头部信息结构<BR>struct&nbsp;M2_HEADER //&nbsp;336&nbsp;bytes,&nbsp;84&nbsp;DWORDs.<BR>{ <BR>DWORD&nbsp;dwIdent; //&nbsp;M2&nbsp;File&nbsp;Identity<BR>DWORD&nbsp;dwVersion; //&nbsp;version:&nbsp;256<BR><BR>DWORD&nbsp;nModelNameSize; //&nbsp;strlen(szModelName)&nbsp;+&nbsp;1<BR>DWORD&nbsp;nModelNameOffset; //&nbsp;always&nbsp;336(header&nbsp;size),&nbsp;points&nbsp;to&nbsp;ModelName.<BR><BR>DWORD&nbsp;dwUnk1; //&nbsp;All&nbsp;0s,&nbsp;occasionally&nbsp;1,3(World\SkillActivated\Containers\TreasureChest01:&nbsp;3)<BR><BR>DWORD&nbsp;nGlobalSequences;<BR>DWORD&nbsp;nGlobalSequencesOffset; //&nbsp;points&nbsp;to&nbsp;array&nbsp;of&nbsp;DWORD<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>DWORD&nbsp;nNumAnimations; <BR>DWORD&nbsp;nAnimationsOffset; //&nbsp;points&nbsp;to&nbsp;M2_ANIMATION_INFO<BR><BR>DWORD&nbsp;nUnkIndices; <BR>DWORD&nbsp;nUnkIndicesOffset; //&nbsp;points&nbsp;to&nbsp;array&nbsp;of&nbsp;unsigned&nbsp;short </P>
<P>DWORD&nbsp;nUnkLongs;<BR>DWORD&nbsp;nUnkLongsOffset; //&nbsp;points&nbsp;to&nbsp;array&nbsp;of&nbsp;longs</P>
<P>DWORD&nbsp;nBonesCount;<BR>DWORD&nbsp;nBonesOffset; //&nbsp;points&nbsp;to&nbsp;M2_BONE_DATA</P>
<P>DWORD&nbsp;nUnkIndices2;<BR>DWORD&nbsp;nUnkIndicesOffset2; //&nbsp;points&nbsp;to&nbsp;array&nbsp;of&nbsp;unsigned&nbsp;short<BR><BR>DWORD&nbsp;nNumVertices; <BR>DWORD&nbsp;nVerticesOffset; //&nbsp;points&nbsp;to&nbsp;M2_Vertex!!!<BR><BR>DWORD&nbsp;nNumGeoMeshs; &nbsp;<BR>DWORD&nbsp;nGeoMeshsOffset; //&nbsp;Points&nbsp;to&nbsp;M2_GEOMETRY_MESH!!!<BR><BR>DWORD&nbsp;dwMagic[2]; //&nbsp;0s<BR><BR>DWORD&nbsp;nNumTextures; <BR>DWORD&nbsp;nTexturesOffset; //&nbsp;points&nbsp;to&nbsp;M2_TEXTURE_INFO.<BR><BR>DWORD&nbsp;dwUnk6[10]; //&nbsp;Other&nbsp;chunks<BR><BR>DWORD&nbsp;nGroupBoneIDs; //&nbsp;Bone&nbsp;groups&nbsp;data <BR>DWORD&nbsp;nGroupBoneIDsOffset; //&nbsp;points&nbsp;to&nbsp;array&nbsp;of&nbsp;unsigned&nbsp;short&nbsp;which&nbsp;is&nbsp;bone&nbsp;id.<BR><BR>DWORD&nbsp;nNumMaterials;<BR>DWORD&nbsp;nMaterialsOffset;<BR><BR>DWORD&nbsp;nStruct1Count; //&nbsp;16&nbsp;bytes,&nbsp;only&nbsp;1.&nbsp;<BR>DWORD&nbsp;nStruct1Offset;</P>
<P>DWORD&nbsp;nStruct2Count; //&nbsp;16&nbsp;bytes,&nbsp;only&nbsp;1.<BR>DWORD&nbsp;nStruct2Offset; </P>
<P>DWORD&nbsp;nStruct3Count; //&nbsp;16&nbsp;bytes,&nbsp;only&nbsp;1.<BR>DWORD&nbsp;nStruct3Offset;</P>
<P>vec3_type&nbsp;vMinBox; //&nbsp;Bounding&nbsp;box<BR>vec3_type&nbsp;vMaxBox;<BR><BR>float&nbsp;fUnk4; //&nbsp;Unknown&nbsp;but&nbsp;it's&nbsp;right&nbsp;before&nbsp;min&nbsp;box&nbsp;when&nbsp;former&nbsp;mdx&nbsp;format.<BR><BR>float&nbsp;fUnk[5];<BR>DWORD&nbsp;dwUnk8; //&nbsp;Unknown&nbsp;0<BR>float&nbsp;fUnk9; <BR><BR>DWORD&nbsp;dwUnk10; &nbsp; //&nbsp;Always&nbsp;36<BR>DWORD&nbsp;dwUnk11[5];<BR><BR>DWORD&nbsp;nAttachments; <BR>DWORD&nbsp;nAttachmentsOffset;<BR><BR>DWORD&nbsp;dwUnk12;<BR>DWORD&nbsp;dwUnkOffset12;<BR><BR>DWORD&nbsp;nNumEvents; <BR>DWORD&nbsp;nEventsOffset;&nbsp; </P>
<P>DWORD&nbsp;dwUnk13;<BR>DWORD&nbsp;dwUnkOffset13;</P>
<P>DWORD&nbsp;nCameras1; <BR>DWORD&nbsp;nCameras1Offset;<BR><BR>DWORD&nbsp;nCameras2;<BR>DWORD&nbsp;nCameras2Offset;<BR>DWORD&nbsp;dwUnk14;<BR><BR>DWORD&nbsp;dwUnk15[6];<BR>};&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P>
<P>//&nbsp;纹理信息结构<BR>struct&nbsp;M2_TEXTURE_INFO<BR>{ <BR>DWORD&nbsp;nReplaceableId; //&nbsp;非0时,表示换装(Creature/Character部分全部为换装类型).<BR>DWORD&nbsp;dwUnk2; //&nbsp;换装参数?<BR>DWORD&nbsp;nNameSize; //&nbsp;字符串长度,为1则空.<BR>DWORD&nbsp;nNameOffset; //&nbsp;字符串偏移位置<BR>}; </P>
<P>//&nbsp;顶点信息结构&nbsp;<BR>struct&nbsp;M2_VERTEX //&nbsp;48&nbsp;bytes<BR>{ <BR>vec3_type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v;<BR>unsigned&nbsp;long&nbsp;&nbsp;bwgt; //&nbsp;?<BR>unsigned&nbsp;short&nbsp;bidx; //&nbsp;?&nbsp;<BR>unsigned&nbsp;short&nbsp;gndx; //&nbsp;?<BR>vec3_type &nbsp;&nbsp;&nbsp;n;<BR>vec2_type &nbsp;&nbsp;&nbsp;u;<BR>unsigned&nbsp;long&nbsp;&nbsp;unk[2]; //&nbsp;Reserved&nbsp;0&nbsp;until&nbsp;now&nbsp;1.12<BR>}; </P>
<P>//&nbsp;几何&nbsp;Mesh&nbsp;信息结构<BR>struct&nbsp;M2_GEOMETRY_MESH //&nbsp;44&nbsp;bytes<BR>{ <BR>DWORD&nbsp;nNumIndexedVertices; //&nbsp;Indexed&nbsp;vertices&nbsp;count <BR>DWORD&nbsp;nIndicesOffset; //&nbsp;Vertices&nbsp;indices&nbsp;array,&nbsp;points&nbsp;to&nbsp;unsigned&nbsp;shorts. <BR>DWORD&nbsp;nPrimitivesCount; //&nbsp;Primitives&nbsp;count,&nbsp;Triangle's&nbsp;count&nbsp;*&nbsp;3 <BR>DWORD&nbsp;nPrimitivesOffset; //&nbsp;Points&nbsp;to&nbsp;primitive&nbsp;vertex&nbsp;indices,&nbsp;MDL_TRIANGLEs.&nbsp;<BR>DWORD&nbsp;nNumGroupIndices; //&nbsp;Group&nbsp;indices&nbsp;count <BR>DWORD&nbsp;nGroupIndicesOffset; //&nbsp;M2_4GROUP_INDICES&nbsp;array&nbsp;correlative&nbsp;with&nbsp;vertex.<BR>DWORD&nbsp;nNumGeoParts; //&nbsp;per&nbsp;32&nbsp;bytes<BR>DWORD&nbsp;nGeoPartsOffset; //&nbsp;points&nbsp;to&nbsp;M2_GEOMESH_GROUP_DATA<BR>DWORD&nbsp;nUnk; //&nbsp;per&nbsp;24&nbsp;bypes<BR>DWORD&nbsp;nUnkOffset; //&nbsp;points&nbsp;to&nbsp;M2_GROUP_BONE_DATA <BR>DWORD&nbsp;dwUnk3; //&nbsp;one&nbsp;of&nbsp;256,&nbsp;75,&nbsp;53,&nbsp;21&nbsp;<BR>}; </P>
<P>struct&nbsp;M2_ANIMATION_INFO //&nbsp;68&nbsp;bytes<BR>{ <BR>DWORD&nbsp;&nbsp;&nbsp;nAnimationClass; //&nbsp;Refer&nbsp;to&nbsp;AnimationData.dbc's&nbsp;first&nbsp;field.<BR>DWORD nFrameBegin;<BR>DWORD nFrameEnd;<BR>float fMoveSpeed;<BR>int bNonLooping;<BR>int nUnk1;<BR>DWORD&nbsp;&nbsp;&nbsp;nUnk2;<BR>DWORD&nbsp;&nbsp;&nbsp;nUnk3;<BR>DWORD&nbsp;&nbsp;&nbsp;nUnk4;&nbsp;&nbsp;&nbsp;<BR>vec3_type&nbsp;vMins; //&nbsp;Unsure?<BR>vec3_type&nbsp;vMaxs;<BR>float&nbsp;&nbsp;&nbsp;fBoundsRadius;<BR>DWORD&nbsp;&nbsp;&nbsp;nUnk5;<BR>};&nbsp;&nbsp;</P>
<P>struct&nbsp;M2_ANIM_FRAME_SEQUENCE //&nbsp;Animation&nbsp;Frame&nbsp;Sequence<BR>{ <BR>short&nbsp;wType;<BR>short&nbsp;wFlags;<BR>DWORD&nbsp;dwLineTypeCount; //&nbsp;Interpolate&nbsp;type?<BR>DWORD&nbsp;dwLineTypeOffset;<BR>DWORD&nbsp;nFramesCount; //&nbsp;num&nbsp;of&nbsp;frame&nbsp;indices<BR>DWORD&nbsp;nFramesOffset; //&nbsp;points&nbsp;to&nbsp;frame&nbsp;indices&nbsp;array&nbsp;<BR>DWORD&nbsp;nMtDataCount; //&nbsp;num&nbsp;of&nbsp;frame&nbsp;matrix&nbsp;transform&nbsp;data(translate/rotate/scale)<BR>DWORD&nbsp;nMtDataOffset; //&nbsp;frame&nbsp;matrix&nbsp;transform&nbsp;data&nbsp;offset&nbsp;<BR>}; </P>
<P>struct&nbsp;M2_BONE_DATA<BR>{ <BR>int&nbsp;&nbsp;&nbsp;nParentID;<BR>short&nbsp;wObjTag;<BR>short&nbsp;wUnk;<BR>short&nbsp;nGeosetAnimID;<BR>short&nbsp;nGeosetID;<BR>M2_ANIM_FRAME_SEQUENCE&nbsp;infoTranslate;<BR>M2_ANIM_FRAME_SEQUENCE&nbsp;infoRotate;<BR>M2_ANIM_FRAME_SEQUENCE&nbsp;infoScale;<BR>vec3_type&nbsp;vPivotPoint;<BR>}; <BR><BR>struct&nbsp;M2_TRANSLATE_DATA<BR>{ <BR>vec3_type&nbsp;vTrans;<BR>}; </P>
<P>struct&nbsp;M2_ROTATE_DATA<BR>{ <BR>quaternion_type&nbsp;qRotate;<BR>}; </P>
<P>struct&nbsp;M2_SCALE_DATA<BR>{<BR>vec3_type&nbsp;vScale;<BR>};</P>
<P>struct&nbsp;M2_GEOMESH_GROUP_DATA<BR>{ <BR>DWORD&nbsp;dwUnk;<BR>unsigned&nbsp;short&nbsp;nUnk0;<BR>unsigned&nbsp;short&nbsp;nNumVertices;<BR>unsigned&nbsp;short&nbsp;nUnk2;<BR>unsigned&nbsp;short&nbsp;nPrimitivesCount;<BR>unsigned&nbsp;short&nbsp;nGroupCount;<BR>unsigned&nbsp;short&nbsp;nUnk4;<BR>unsigned&nbsp;short&nbsp;nUnk5;<BR>unsigned&nbsp;short&nbsp;nUnk6;<BR>vec3_type&nbsp;vUnk;<BR>}; </P>
<P>struct&nbsp;M2_GROUP_BONE_DATA<BR>{<BR>short&nbsp;dwUnk[12];<BR>};</P>
<P>struct&nbsp;M2_4GROUP_INDICES<BR>{ <BR>unsigned&nbsp;char&nbsp;idx[4];<BR>}; </P><img src ="http://www.cnitblog.com/linghuye/aggbug/1865.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:42 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1865.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>魔兽世界UI方案研究</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1862.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:41:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1862.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1862.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1862.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1862.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1862.html</trackback:ping><description><![CDATA[<P>0.XML+Lua,格式和逻辑,强强联合.<BR>1.FrameXML.toc线性顺序加载,出log.<BR>2.每个XML文件描述一项界面元素,关联脚本使用"file="语法.<BR>3.Interface.mpq内为原始版本,在主程序目录下可以创建一个定制版本目录.<BR>4.编辑工具:XMLSpy 
<P>&nbsp;</P>
<P>HTML&nbsp;UI解决方案<BR>1.使用纯HTML网页界面.(XML描述C++图形界面系统)<BR>2.使用javascript脚本.(Lua&nbsp;脚本)<BR>3.使用window.external提供COM服务体系入口.(Lua&nbsp;脚本引擎环境)<BR>4.使用动态绑定IDispatch技巧将一个普通的C++类暴露为动态COM对象.<BR>5.使用执行函数脚本达到事件回调的效果.(Lua脚本执行)</P>
<P>http://www.wowwiki.com<BR>http://www.cosmosui.com/forums/<BR>http://vnboards.ign.com/WoW_UI_Customization/b22852/<BR><A href="http://forums.worldofwarcraft.com/board.aspx?fn=wow-interface-customization" target=_blank><FONT color=#ffff00>http://forums.worldofwarcraft.com/board.aspx?fn=wow-interface-customization</FONT></A></P><img src ="http://www.cnitblog.com/linghuye/aggbug/1862.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:41 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1862.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>暴雪程序方案策略</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1863.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:41:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1863.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1863.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1863.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1863.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1863.html</trackback:ping><description><![CDATA[搜索路径策略:<BR>假设主程序目录为Root,资源目录名ResDir<BR>1.Root\ResDir<BR>2.Root\ResDir.zip<BR>3.Root\Data\ResDir<BR>4.Root\Data\Patch.mpq\ResDir<BR>5.Root\Data\Local.mpq\ResDir<BR>6.Root\Data\ResDir.mpq\ResDir<img src ="http://www.cnitblog.com/linghuye/aggbug/1863.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:41 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1863.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MyWarCraftStudio Development History</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1861.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:40:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1861.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1861.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1861.html#Feedback</comments><slash:comments>52</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1861.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1861.html</trackback:ping><description><![CDATA[
		<p>====2007-1-28<br />1.Update MyWarCraftStudio to 0.10.6337 for supporting Burning Crusade final formal client 2.0.6.6337.<br />2.It should be compatible with the normal 1.12 wow client.<br />3.I try to experiment DirectX rendering in this version. Change the Cnfg\MyWarCraftStudio.xml about &lt;RenderEngine API="OpenGL"/&gt; to &lt;RenderEngine API="DirectX"/&gt;. Be aware of bugs.<br /><a href="/Files/linghuye/MyWarCraftStudio_0.10.6337.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.10.6337.rar</font></a><br /><a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.10.6337.rar"><font color="#ffff00">http://linghuye.googlepages.com/MyWarCraftStudio_0.10.6337.rar</font></a><br /><br />====2006-10-15<br />1.Update MyWarCraftStudio to 0.9.5991 for supporting Burning Crusade Closed Beta client<br /><a href="/Files/linghuye/MyWarCraftStudio_0.9.5991.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.9.5991.rar</font></a><br /><a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.9.5991.7z"><font color="#ffff00">http://linghuye.googlepages.com/MyWarCraftStudio_0.9.5991.7z</font></a><br /><br />==== 2006-9-6<a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z"><font color="#ffff00"><br /></font></a><a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z"><font color="#ffff00">http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z</font></a><a href="http://linghuye.googlepages.com/MyWarCraftStudio_0.9.7z"><br />or<br /></a><a href="/Files/linghuye/MyWarCraftStudio_0.9.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.9.rar</font></a><br />1.Fix the bug when reading Burning Crusade's patch.mpq<br />2.Fix bugs when displaying model on ATI graphic cards<br />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.<br /><br />==== 2006-7-26<br />1. A new m2 model renderer that can show most model skin texture set, add particle system effect, texture animation, npc skin.<br />2. Add two mpq edit functions in the pop menu by right clicking on the file tree item.<br />   Import File: Import a single file directly from local file system under the clicking tree node.<br />   Import Folder: Import all files in a directory from local file system under the clicking tree node.<br />3. Wow data path config is automaticlly set to where you open your mpq file now, no need to set it manually.<br /><br /><a href="/Files/linghuye/MyWarCraftStudio_0.88.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.88.rar</font></a><a href="/Files/linghuye/MyWarCraft_0.8.rar"><font color="#ffff00"></font></a> <br /><br /><br />==== 2006-6-9<br />0.Fix the bug of the limit of file name length in edit box.<br />1.Please change the &lt;WoW DataPath="H:\World of Warcraft\Data\"/&gt; in "Cnfg\MyWarCraftStudio.xml" first.<br />2.New things: F5 -&gt; Welcome to DestinyMatrix <br />   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. :)<br /><br /><a href="/Files/linghuye/MyWarCraftStudio_0.8.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_0.8.rar</font></a><a href="/Files/linghuye/MyWarCraft_0.8.rar"><font color="#ffff00"></font></a> <br />  <br />==== 2006-5-26<br />1.Fix for the mywarcraftstudio for the problem of loading wow 1.11 test's Patch.mpq.<br />2.Decompress the rar and overwrite original program files, it  should work for 0.6/0.7.<br /><br /><a href="/Files/linghuye/MyWarCraftStudio_Fix_1.11_TestPatch.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraftStudio_Fix_1.11_TestPatch.rar</font></a><br />==== 2005-11-3<br />1.Version 0.7, no new things, just program interface changed.<br /><a href="/Files/linghuye/MyWarCraft_0.7.rar"><font color="#ffff00">http://www.cnitblog.com/Files/linghuye/MyWarCraft_0.7.rar</font></a><br /><br />Main Interface:<br /><a href="/Files/linghuye/IWarCraft.rar">http://www.cnitblog.com/Files/linghuye/IWarCraft.rar</a><br /><br />==== 2005-3-13</p>
		<p>1.Version 0.6在<a href="http://www.blizzhackers.com/">www.Blizzhackers.com</a>上发布。</p>
		<p>2.解析出所有数据格式。</p>
		<p>==== 2004-07-20 ========<br />1.加入保存纹理图像格式功能.<br />2.加入信息操作对话框机制.<br />3.加入人物纹理 </p>
		<p>==== 2004-07-18 ========<br />1.同时支持解析魔兽争霸和魔兽世界的MPQ档案,Blp图像纹理,Mdx物体模型.<br />2.魔兽世界的MPQ档案分布在其主目录的Data下,物体模型model.MPQ,图像纹理texture.MPQ.<br />3.人物模型的可变更纹理系统尚未解析完全,人物无纹理,World节点下的模型比较有观赏性.<br />4.BLP2's format is cracked by Technetium's Blpdecode.dll.<br />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.</p>
<img src ="http://www.cnitblog.com/linghuye/aggbug/1861.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:40 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1861.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Opengl编程低级错误</title><link>http://www.cnitblog.com/linghuye/archive/2005/08/13/1845.html</link><dc:creator>linghuye</dc:creator><author>linghuye</author><pubDate>Sat, 13 Aug 2005 09:24:00 GMT</pubDate><guid>http://www.cnitblog.com/linghuye/archive/2005/08/13/1845.html</guid><wfw:comment>http://www.cnitblog.com/linghuye/comments/1845.html</wfw:comment><comments>http://www.cnitblog.com/linghuye/archive/2005/08/13/1845.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.cnitblog.com/linghuye/comments/commentRss/1845.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/linghuye/services/trackbacks/1845.html</trackback:ping><description><![CDATA[1.没有glDisable(GL_TEXTURE_2D),导致基本几何作图全部失败。<br />2.镜头位置没调好,导致所有物体不可见.<br />3.物体位置数据错误，导致物体大大超出镜头显示范围.<br />4.纹理没有GL_CLAMP导致边界拼接出现缝线.<br />5.纹理没有GL_REPEAT导致使用超出1.0纹理坐标技巧失败，显示单色插值.<br />6.没有glEnable(GL_TEXTURE_2D)导致全白纹理.<br />7.glEnable(GL_TEXTURE_2D)后没有使用纹理顶点导致如glColor效果的纯单色.<br />8.应该在作图循环设置灯光位置,因为The position is transformed by the modelview matrix when glLight is called (just as if it were a point), and it is stored in eye coordinates. <br />9.灯光位置应该是4个float，3个float程序不出错，但结果完全扭曲。<br />10.打开灯光却没设置顶点法线，到头一场空。<br />11.Window Class 没有CS_OWNDC,导致glDrawPixels失败,如在子窗口View上进行象素写入操作.<br />12.没有设置PIXELFORMATDESCRIPTOR的cAlphaBits,导致glReadPixels读取alpha通道数据失败,统统为0.<br />13.手动实现的多层纹理闪烁,出现线带,没有使用glPolygonOffset.<br />14.glDrawPixels格式GL_RGB或GL_BGR_EXT的数据时崩溃,且数据有效,没有使用glPixelStorei(GL_UNPACK_ALIGNMENT, 1);导致图像行默认4字节对齐,导致OpenGL数据读取越界崩溃.相应的要为glReadPixels设置glPixelStorei(GL_PACK_ALIGNMENT, 1);<br />15.glReadPixel读取被覆盖的OpenGL窗口部分的图像数据时,读出数据混乱无效,OpenGL Pixel Ownership检测导致,标准如此.使用PixelBuffer,或强制置前OpenGL窗口解决.<br />16.glReadPixels读取总是从FrameBuffer的左下往右上读取,毫无参数可设置改变方向,真是笨到家了. 载入图像一般还是从上到下比较容易理解.<br />17.使用glDepthMask(GL_FALSE)后不打开,glClear无法清除深度缓冲,导致现象:场景起始静止正常,一旦移动出现不规则的透明无渲染区域,深度缓存逻辑混乱.<br />18. gluPerspective(45.0f, (GLfloat)cxPixels/(GLfloat)cyPixels, 0.1f, 2000.0f);这里的0.1f将导致物体和地面的相交处闪烁,原因待查,至少取1.0f.<br />19.没有显示定义shiniess或shiniess为0,在shader中对gl_FrontMaterial.shininess使用pow计算,结果不可测,黑色条带闪烁，quite not understand.<br />20.纹理出现白色点状闪烁,没有Mipmap过滤导致!<br />21.任何初装的Windows系统,多好的机器,一开始对OpenGL只支持1.1,连多重纹理都没有,需要警惕这种机器,装着DX9,微软真恶心,::SwapBuffer直接崩溃,故需要检测显卡至少支持了1.2标准,否则要求更新显卡驱动程序.<br />22.3D和2D,透视和正射模式混合时,2D模式的渲染覆盖不了3D的渲染,原因深度测试失败,<br />      a.2D下渲染时所取点深度确实大于3D点的深度.<br />      b.glOrtho参数错误,导致2D渲染所得深度值错误,如zNear被取负数!<br />      c.使用glDisable(GL_DEPTH_TEST);<br />23.glDrawElements崩溃,<br />      a.glXXXPointer设置的缓冲错误,顶点索引越界引用顶点数组.<br />      b.当前glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer);硬件缓冲和内存缓冲混淆.<br />24.画面上出现方块形背景色,原因,渲染一次后,在glClear时glDepthMask没有打开,glClear没能clear掉depth,但clear掉颜色缓冲,depth值持续到下一次render,导致depth test没通过,颜色画不上.<br />25.树叶挡在物体前,树叶间隙或蛀洞本应该透明却呈现背景色.原因,没有启用Alpha过滤.一般不可能用几何形状勾勒出叶子的形状,只用较大的多边形包围叶子,用Alpha过滤掉空隙.此时不启用Alpha过滤,出现Alpha为0的三角面也被渲染,但得到的是背景图像,并且由于Alpha为0的三角面离视点近,后面的物体渲染无法通过深度测试补上透明的空隙区域.<br />26.atlgdi.h里有#pragma comment(lib, "opengl32.lib"),导致无源无故链接opengl32.lib失败.<img src ="http://www.cnitblog.com/linghuye/aggbug/1845.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/linghuye/" target="_blank">linghuye</a> 2005-08-13 17:24 <a href="http://www.cnitblog.com/linghuye/archive/2005/08/13/1845.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>