青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當自強而不息

Using Key?Framed Skeletal Animation(4)

Matching Animations to Bones

After you've loaded the animation data, you need to map the animation classes to their respective bones in the bone hierarchy. Mapping the hierarchies is important because whenever an animation is updated, you need a quick way to access the bone's transformations. By mapping, you create an easier method of accessing the bones.

In this instance, the bone hierarchy will be represented in a D3DXFRAME hierarchy. Inside the D3DXFRAME structure, there are two linked list pointers that you'll use to help construct the hierarchy. From the root D3DXFRAME structure you are using, you can access child objects through the D3DXFRAME::pFrameFirstChild pointer and sibling objects through the D3DXFRAME::pFrameSibling pointer.

The next function in cAnimationCollection to which you want to pay attention is Map. You use the Map function to map the animation structure's m_Bone pointer to a frame in the frame hierarchy that shares the same name.

The Map function scans through every cAnimationSet object and iterates every cAnimation object contained in each of the animation set objects. The name of each cAnimation object is compared to each of the frame's names; if a match is found, the cAnimation::m_Bone pointer is set to the frame's address.

The Map function takes the hierarchy's root frame parameter.

void cAnimationCollection::Map(D3DXFRAME *RootFrame)
{
// Go through each animation set
cAnimationSet *AnimSet = m_AnimationSets;
	while(AnimSet != NULL) 
{
// Go through each animation object
cAnimation *Anim = AnimSet−>m_Animations;
		while(Anim != NULL) 
{
// Go through all frames and look for match
Anim−>m_Bone = FindFrame(RootFrame, Anim−>m_Name);
			// Go to next animation object
Anim = Anim−>m_Next;
}
		// Go to next animation set object
AnimSet = AnimSet−>m_Next;
}
}

Whereas the Map function only scans through each of the cAnimationSet and cAnimation objects, the FindFrame function recursively works through the frame hierarchy to look for a match to the name you provide. When it finds a matching name, the FindFrame function returns the pointer to the specific frame. Take a look at the FindFrame code on which the Map function depends.

D3DXFRAME *cAnimationCollection::FindFrame(D3DXFRAME *Frame, char *Name)
{
D3DXFRAME *FramePtr;
	// Return NULL if no frame
if(!Frame)
return NULL;
	// Return current frame if no name used
if(!Name)
return Frame;
	// Process child frames
if((FramePtr = FindFrame(Frame−>pFrameFirstChild, Name)))
return FramePtr;
	// Process sibling frames
if((FramePtr = FindFrame(Frame−>pFrameSibling, Name)))
return FramePtr;
	// Nothing found
return NULL;
}

Again, take a deep breath. The animation data has been loaded, and you've mapped the animation objects to the bone hierarchy. All that's left to do is update the animation and set the transformation matrices for the bones.

 

Updating Animations

After you've matched the animation classes to the bone hierarchy, you can begin animating your meshes! All you have to do is scan the animation keys for each bone, applying the interpolated transformations to each bone's transformation before rendering. This is merely a matter of iterating through each animation class and its keys to find the proper key values to use.

Going back to the cAnimationCollection class, you can see that one function will do all that for you. By supplying the cAnimationCollection::Update function with the name of the animation set you want to use, as well as the time in the animation, all of the transformation matrices in your entire mapped bone hierarchy will be set and ready for rendering.

Take a closer look at the Update function to see how you can update your animation data.

void cAnimationCollection::Update(char *AnimationSetName, DWORD Time)
{
cAnimationSet *AnimSet = m_AnimationSets;
DWORD i, Key, Key2;
	// Look for matching animation set name if used
if(AnimationSetName)
{
// Find matching animation set name
while(AnimSet != NULL)
{
// Break when match found
if(!stricmp(AnimSet−>m_Name, AnimationSetName))
break;
			// Go to next animation set object
AnimSet = AnimSet−>m_Next;
}
}
	// Return no set found
if(AnimSet == NULL)
return;

The Update function starts by scanning the list of animation sets loaded into the linked list. If you instead supply a NULL value for AnimationSetName, Update will merely use the first animation set in the list (which happens to be the last set loaded). If no matching sets are found using the name you specified, the function returns without further delay.

Once a matching animation set is found, however, the code continues by scanning each cAnimation object in it. For each animation object, the entire list of keys (translation, scaling, rotation, and transformation) is searched, and the time you specify is checked to see which key to use.

After you've found the proper key to use, the values (rotation, scaling, translation, or transformation) are interpolated, and a final transformation matrix is computed. This final transformation matrix is then stored in the mapped bone (as pointed to by the m_Bone pointer).

You've already seen how to scan a list of keys to look for the ones between which a specific time falls, so I'll skip the code here.

Once you've calculated the transformations to apply to each bone from the animation data, you can jump right back into the game and render the mesh. Remember, you must apply the transformation matrices for each bone to the appropriate vertices in the mesh, and the best way to do so is to use a vertex shader.


posted on 2008-04-25 13:13 lovedday 閱讀(289) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久精品一区中文字幕| 久久蜜桃资源一区二区老牛 | 久久国产精品久久久久久电车| 男女精品网站| 日韩亚洲精品电影| 一区二区三区久久网| 国产精品久久久久久户外露出 | 99精品久久久| 日韩一级裸体免费视频| 国产精品久久久免费| 久久精品夜夜夜夜久久| 久久影院午夜论| 9色精品在线| 亚洲一区二区久久| 精东粉嫩av免费一区二区三区| 欧美高清视频一区二区| 欧美日韩ab片| 久久大逼视频| 母乳一区在线观看| 亚洲欧美日韩国产一区二区三区| 香蕉久久夜色精品国产使用方法| 在线国产精品一区| 亚洲精品中文字幕在线| 国产欧美一区二区三区在线老狼 | 久久精品国产77777蜜臀| 亚洲黄网站黄| 亚洲女女女同性video| 精品二区视频| 一区二区福利| 樱桃国产成人精品视频| 99re视频这里只有精品| 国内激情久久| 一片黄亚洲嫩模| 一区二区在线观看视频| 亚洲精品欧洲精品| 国产偷国产偷亚洲高清97cao| 欧美成人资源| 国产精品第13页| 欧美激情一区二区三级高清视频| 国产精品久久久久久亚洲调教| 欧美.www| 国产一区二区欧美| 亚洲视频免费在线| 亚洲久久视频| 久久综合九色综合久99| 欧美在线播放高清精品| 欧美经典一区二区三区| 欧美aⅴ一区二区三区视频| 国产乱肥老妇国产一区二| 亚洲精品视频在线观看免费| 永久免费精品影视网站| 亚洲欧美在线看| 亚洲一区欧美| 欧美日韩成人综合| 亚洲国产精品99久久久久久久久| 国产啪精品视频| 亚洲一区二区三区免费在线观看 | 国外成人网址| 亚洲自拍高清| 午夜精品成人在线| 国产精品进线69影院| 亚洲乱码国产乱码精品精天堂 | 欧美色大人视频| 亚洲伦伦在线| 一区二区三区久久精品| 欧美另类亚洲| 日韩午夜中文字幕| 亚洲午夜国产一区99re久久| 欧美精品一区在线发布| 亚洲激情一区二区| 亚洲美女区一区| 欧美激情精品久久久久久大尺度| 欧美fxxxxxx另类| 亚洲成人中文| 欧美xart系列高清| 亚洲日韩第九十九页| 99re6热只有精品免费观看| 欧美精品一区二| 日韩视频在线免费观看| 亚洲一区在线免费| 国产精品国产三级国产aⅴ9色| 一区二区三区高清不卡| 亚洲欧美综合国产精品一区| 国产日韩欧美在线一区| 欧美在线观看视频在线| 麻豆精品视频| 亚洲另类自拍| 欧美三级免费| 欧美一区二区视频在线观看2020| 鲁大师成人一区二区三区| 亚洲激情偷拍| 国产精品福利在线观看网址| 亚洲欧美日韩中文播放| 免费国产一区二区| 99综合电影在线视频| 狂野欧美一区| 一本久久a久久精品亚洲| 国产精品女主播在线观看| 久久精品99国产精品| 亚洲国产毛片完整版| 午夜精品在线看| 亚洲第一色在线| 国产精品久久久久久久久久久久久久 | 久久精品亚洲一区| 亚洲日韩中文字幕在线播放| 国产精品久久久久av| 久久综合久久久| 亚洲一区二区三区中文字幕| 欧美国产亚洲精品久久久8v| 亚洲男人av电影| 亚洲欧洲在线看| 国产婷婷成人久久av免费高清 | 欧美精品入口| 久久精品在线免费观看| 一级日韩一区在线观看| 欧美成人激情在线| 欧美一区二区视频在线| 日韩视频免费| 亚洲第一中文字幕在线观看| 欧美天天影院| 欧美韩日亚洲| 久久久成人精品| 亚洲你懂的在线视频| 99re热精品| 亚洲欧洲一区二区三区| 免费成人在线观看视频| 小辣椒精品导航| 亚洲一级片在线看| 亚洲精品一级| 亚洲区欧美区| 亚洲激情成人| 在线观看视频免费一区二区三区| 国产老肥熟一区二区三区| 国产精品大片wwwwww| 欧美精品一区二区高清在线观看| 久久综合精品国产一区二区三区| 欧美一区2区视频在线观看 | 亚洲毛片在线看| 亚洲第一区在线观看| 蜜臀久久久99精品久久久久久| 欧美亚洲一级| 性色av一区二区三区在线观看| 亚洲一区二区3| 亚洲色图综合久久| 99热这里只有精品8| 日韩一区二区精品在线观看| 91久久线看在观草草青青| 亚洲精品1区| 亚洲另类自拍| 亚洲一二区在线| 欧美一级视频精品观看| 亚洲欧美另类国产| 欧美一区二区视频在线| 久久av最新网址| 久久久夜精品| 欧美成人精品一区二区三区| 欧美99在线视频观看| 亚洲国产激情| 99re热这里只有精品视频| 在线一区二区日韩| 亚洲欧美激情视频在线观看一区二区三区| 一区二区三区产品免费精品久久75| 一本一本久久| 亚洲欧美一区在线| 久久久免费av| 欧美激情第4页| 国产精品久久久久毛片软件| 国产日韩欧美夫妻视频在线观看| 精品成人国产| 一本色道久久加勒比88综合| 亚洲综合首页| 久久一区免费| 亚洲七七久久综合桃花剧情介绍| 一区二区欧美在线观看| 欧美专区在线观看| 欧美福利电影在线观看| 欧美午夜一区二区三区免费大片| 国产视频一区在线观看| 亚洲国产一区二区三区高清| 亚洲图片在线观看| 久久综合给合久久狠狠狠97色69| 亚洲国产精品精华液网站| 亚洲资源av| 欧美精品videossex性护士| 国产美女精品视频免费观看| 亚洲国产福利在线| 亚洲欧美日韩综合国产aⅴ| 农村妇女精品| 性欧美xxxx视频在线观看| 欧美成人免费网站| 国产午夜亚洲精品不卡| 日韩香蕉视频| 免费欧美视频| 午夜精品久久久久久久99热浪潮 | 欧美高清免费| 国产一区欧美| 亚洲欧美另类国产| 91久久在线| 久久综合色播五月| 国产日韩欧美亚洲|