Ogre study notes (8): Bone Animation

Source: Internet
Author: User
The basic animation control of ogre is very simple. The operation for setting an animation is as follows:

// Set idle Animation

Manimationstate = ent-> getanimationstate ("idle ");

Manimationstate-> setloop (true );

Manimationstate-> setenabled (true );

(The above Code comes from intermediate tutorial1-Ogre wiki) Get the animationstate pointer from an entity object, and then set some attributes, which need to be called at each frame:

Manimationstate-> addtime (EVT. timesincelastframe );

 

 

Loading SKELETON:

In skeletalapplication: createscene ()

Skeletonptr skel = skeletonmanager: getsingleton (). Load ("jaiqua. Skeleton ",

Resourcegroupmanager: default_resource_group_name );

This statement is used to read the skeleton file. The read operation is in the "skeleton: loadimpl" function. This function mainly performs two steps: one is to call "skeletonserializer: importskeleton ()", and the other is "load any linked skeletons ". The animation information is stored in the "animationlist manimationslist" member variable of skeleton.

A "skeletonptr mskeleton" is stored in the mesh class, And skeletonptr is a derived class of "sharedptr <skeleton>. Load a mesh:

Meshserializerimpl: readmesh ()-case m_mesh_skeleton_link:

-Meshserializerimpl: readskeletonlink ()
-- "Mesh: setskeletonname ()
-ResourceManager: load ()-Get the skeleton pointer

The animation class object is "an animation sequence". All types of animation sequences are managed by this class. It manages three types of track lists: nodeanimationtrack, numericanimationtrack, and vertexanimationtrack.

In the constructor of entity, if the mesh contains a skeleton animation or vertex animation, an animationstateset object will be created and "mesh-> _ initanimationstate (manimationstate);" will be called );".

 

 

Animation computing:

Entity stores a skeletoninstance Object Pointer, which is a derived class of skeleton.

The main operation is in the "Void entity: updateanimation (void)" function.

À entity: cachebonematrices
À SKELETON: setanimationstate
This function first calls "skeleton: reset", finds the corresponding animation for each enabled animation state, and then calls Animation: Apply () to calculate the status of each bone.

 

The overall ogre animation management structure is chaotic. The dependency between entity, skeleton, animation, animationstate, and skeletoninstance is too complex and has circular dependencies.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.