| 今天去ogre官網賺了一圈,看到了一款用Ogre做的游戲TorchLight,不妨下下來玩玩。 游戲做的很好,說明ogre的強大。 在安裝目錄里看到了ogreMain.dll OIS.dll等熟悉的dll,忽然看到了resources.cfg文件,里面定義了一個pak/zip文件路徑。 好了找到了zip,600M,里面裝了啥?ogre資源!模型,骨骼,貼圖。天!!!!。 但是里面的模型,骨骼動畫并不能直接用,要使貼圖起作用要把material里的texture_unit里的png改為dds,要用skeleton的話,就得用OgreXMLconvert將.skeleton文件轉換回xml文件,在Animation里添加link的動作文件。 以dog.mesh為例,不知道大家研究過ogre的mesh文件沒有,還有skeleton文件,自己轉化成xml文件看看吧。 把dog.skeleton轉化為xml文件后(用OgreXmlConverter,源碼tools注意不是SDK里自己編譯一下,這個工具就出來了),發現animation里沒有鏈接skeleton,自己添加skeleton link吧。 ??? </bonehierarchy> ??? <animations> ??????? <animation name="bind" length="0"> ??????????? <tracks /> ??????? </animation> ??? </animations> ??? <animationlinks> ??????? <animationlink skeletonName="attack1.SKELETON" scale="1" /> ??????? <animationlink skeletonName="attack2.SKELETON" scale="1" /> ??????? <animationlink skeletonName="attack3.SKELETON" scale="1" /> ??????? <animationlink skeletonName="bark.SKELETON" scale="1" /> ??????? <animationlink skeletonName="fidget_alert.SKELETON" scale="1" /> ??????? <animationlink skeletonName="fidget_shake.SKELETON" scale="1" /> ??????? <animationlink skeletonName="get_hit.SKELETON" scale="1" /> ??????? <animationlink skeletonName="hit.SKELETON" scale="1" /> ??????? <animationlink skeletonName="idle.SKELETON" scale="1" /> ??????? <animationlink skeletonName="run.SKELETON" scale="1" /> ??????? <animationlink skeletonName="walk.SKELETON" scale="1" /> ??? </animationlinks> </skeleton> 注意灰色的部分,就是添加的link,skeletonName是動作文件。 再用OgreXmlConvert將skeleton轉化回二進制文件。大功告成。好了,可以自己使用這些資源了。真是踏破鐵鞋無覓處,得來全不費工夫。 600M的模型資源啊(其中有些是音樂),還有動畫!天!發了。世界上頂級的美工做得東西就可以用了。 其中我還發現一個CEGUI自定義的類型,那UI也挺漂亮。 這就是那個主人公攜帶的寵物狗了,以后用它在自己游戲里當小怪! 補充: 1.將.skeleton文件直接拖入OgreXmlConverter.exe生成.xml文件,之后進行修改后再拖入OgreXmlConverter.exe后又重新生成.skeleton文件。 2.ogre能直接讀取dds格式,torchlight中都是使用dds圖片格式,要想在ogre中直接使用其模型,在.material(如dog模型)中,直接將png給為dds 即可。 material pet { technique { ?? pass ?? { ??? ambient 0.588 0.588 0.588 ??? diffuse 0.588 0.588 0.588 ??? specular 0 0 0 0 ??? emissive .2 .2 .2 ??? scene_blend alpha_blend ??? alpha_rejection greater 128 ??? texture_unit ??? { ???? texture dog_pet.dds ??? } ?? } } } |