Fork me on GitHub

ogre demo_skeletalanimation

D:\stu\GAMEENGINE\ogre\Tools\XMLConverter

OgreXMLConverter.exe

from:http://www.ogre3d.org/docs/manual/manual_47.html

The OgreXmlConverter tool can converter binary .mesh and .skeleton files to XML and back again - this is a very useful tool for debugging the contents of meshes, or for exchanging mesh data easily - many of the modeller mesh exporters export to XML because it is simpler to do, and OgreXmlConverter can then produce a binary from it. Other than simplicity, the other advantage is that OgreXmlConverter can generate additional information for the mesh, like bounding regions and level-of-detail reduction.

Syntax: Usage: OgreXMLConverter sourcefile [destfile]sourcefile = name of file to convertdestfile = optional name of file to write to. If you don't specify this OGRE works it out through the extension and the XML contents if the source is XML. For example test.mesh becomes test.xml, test.xml becomes test.mesh if the XML document root is <mesh> etc. When converting XML to .mesh, you will be prompted to (re)generate level-of-detail(LOD) information for the mesh - you can choose to skip this part if you wish, but doing it will allow you to make your mesh reduce in detail automatically when it is loaded into the engine. The engine uses a complex algorithm to determine the best parts of the mesh to educe in detail depending on many factors such as the curvature of the surface, the edges of the mesh and seams at the edges of textures and smoothing groups - taking advantage of it is advised to make your meshes more scalable in real scenes.

I use OgreXMLConverter.exe to generate rjaiqua.mesh.xml, jaiqua.skeleton.xml

jaiqua.skeleton.xml:

<skeleton> <bones>--------------------- <bone id="0" name="head"><position x="0.5" y="0" z="-4.44089e-016" /> <rotation angle="0.309934"><axis x="0.283808" y="0.564704" z="0.77496" /></rotation></bone> <bone id="1" name="neck"><position x="0" y="-3.55271e-015" z="0" /> <rotation angle="1.25688"><axis x="0.0431474" y="-0.0144685" z="0.998964" />

</rotation>

......................

bonehierarchy>

<boneparent bone="head" parent="neck" /><boneparent bone="neck" parent="neckroot" />

<boneparent bone="Rbicept" parent="Rarmroot ......

<animations>

<animation name="Run" length="0.7"> <tracks> <track bone="head"> <keyframes> <keyframe time="0"><translate x="0" y="0" z="2.22045e-016" /> <rotate angle="0.274176"><axis x="-0.499034" y="-0.502816" z="-0.705791" /> </rotate></keyframe> <keyframe time="0.166667"><translate x="0" y="0" z="0" /> <rotate angle="0.312969"><axis x="-0.279987" y="-0.55982" z="-0.779878" /> </rotate></keyframe>

<animation name="Sneak" length="10.6333">。。。

ogre demo_skeletalanimation - wwweurope - wwweurope的博客
ogre demo_skeletalanimation - wwweurope - wwweurope的博客

ijust for fun(modify code slightly):

n skeletalanimation.h

line 170:

   if(0==i)
            mAnimState[i] = ent->getAnimationState("Turn");
    if(1==i)
     mAnimState[i] = ent->getAnimationState("Run");
    if(2==i)
     mAnimState[i] = ent->getAnimationState("Stagger");
    if(3==i)
     mAnimState[i] = ent->getAnimationState("Sneak");
    if(4==i)
     mAnimState[i] = ent->getAnimationState("Walk");

//蒙皮技术。。。

posted @ 2010-07-11 22:24  europelee  阅读(297)  评论(0编辑  收藏  举报