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

天行健 君子當自強而不息

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)  編輯 收藏 引用


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


公告

導航

統(tǒng)計

常用鏈接

隨筆分類(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精品国产自| 久久久欧美一区二区| 亚洲第一毛片| 亚洲国产成人高清精品| 欧美精品一区二区三区在线播放| 日韩一二三区视频| 亚洲小视频在线观看| 国产欧美日韩视频在线观看| 久久九九国产精品| 欧美粗暴jizz性欧美20| 亚洲色图在线视频| 午夜精品久久久久久| 揄拍成人国产精品视频| 亚洲高清精品中出| 国产精品久久久久久久久借妻| 欧美专区一区二区三区| 久久婷婷综合激情| 亚洲午夜精品在线| 久久久久久自在自线| 夜夜夜久久久| 欧美影院视频| 亚洲免费黄色| 欧美在线视频导航| 亚洲视频一二| 久久漫画官网| 午夜欧美精品| 欧美韩日高清| 久久久精品一区二区三区| 欧美激情2020午夜免费观看| 久久国产精品电影| 欧美日韩国产欧美日美国产精品| 久久精品久久99精品久久| 欧美极品影院| 美女精品自拍一二三四| 国产精品久久久一区二区三区| 免费日韩成人| 国产女优一区| 在线视频精品一| 亚洲美女av黄| 久久综合网络一区二区| 久久成人在线| 国产精品日韩精品欧美在线| 亚洲黄色影片| 在线色欧美三级视频| 亚洲欧美日产图| 亚洲天堂黄色| 欧美人与性动交cc0o| 免费在线播放第一区高清av| 国产亚洲欧美日韩精品| 亚洲摸下面视频| 亚洲一区二区欧美| 欧美日韩国产一区二区三区| 亚洲大片在线| 亚洲国产精品一区| 久久综合伊人77777蜜臀| 亚洲欧美日韩人成在线播放| 欧美日韩一区二区视频在线| 欧美激情精品久久久| 亚洲国产高清一区二区三区| 久久久久国产精品一区| 久久久噜噜噜久久中文字免| 国产日韩av高清| 亚洲欧美在线一区| 欧美一区二区三区的| 国产日韩一区二区三区| 午夜精品三级视频福利| 久久久福利视频| 精品成人一区| 免费在线一区二区| 亚洲人屁股眼子交8| 一区二区激情| 国产精品大片| 午夜一级在线看亚洲| 久久乐国产精品| 在线观看的日韩av| 欧美激情一区二区三级高清视频| 亚洲人成网站在线观看播放| 一区二区三区高清不卡| 国产精品日韩欧美| 久久精品夜色噜噜亚洲a∨| 美女国内精品自产拍在线播放| 亚洲激情视频在线播放| 欧美另类亚洲| 亚洲资源av| 欧美成人一区二区在线| 一区二区三区高清不卡| 国产精品视频yy9099| 久久久久久网址| 亚洲精品美女| 久久精品视频99| 亚洲国产天堂久久国产91| 欧美日韩成人综合在线一区二区| 亚洲一区影院| 亚洲福利视频在线| 午夜精品999| 亚洲激情一区二区三区| 国产精品久久| 久久综合亚州| 午夜精品久久久久久久99水蜜桃 | 亚洲一区三区电影在线观看| 国产精品一级久久久| 美女主播视频一区| 亚洲专区一区二区三区| 欧美激情视频在线播放| 欧美一级久久| 日韩午夜在线电影| 黄色av一区| 国产精品区一区二区三区| 欧美91大片| 欧美自拍偷拍午夜视频| 99成人精品| 欧美二区在线看| 久久久国产精品一区二区三区| 亚洲日韩中文字幕在线播放| 国产午夜精品一区二区三区视频| 欧美精品一区二区在线播放| 久久精品91| 亚洲在线一区二区| 夜夜嗨av一区二区三区| 欧美激情视频在线免费观看 欧美视频免费一| 亚洲在线1234| 在线亚洲观看| 亚洲乱码国产乱码精品精可以看| 国内精品国产成人| 国产精品一区在线播放| 欧美插天视频在线播放| 亚洲国产精品一区二区www在线| 欧美视频福利| 欧美日本在线视频| 久久这里只有精品视频首页| 欧美伊人久久久久久午夜久久久久 | 在线成人国产| 国产在线一区二区三区四区| 国产精品av久久久久久麻豆网| 欧美不卡视频一区发布| 毛片一区二区三区| 久久亚洲精品一区二区| 欧美伊人久久| 欧美在线二区| 久久久www| 久久婷婷成人综合色| 久久福利一区| 久久躁狠狠躁夜夜爽| 久久视频这里只有精品| 久久婷婷久久| 免费不卡在线观看| 欧美大片免费| 欧美精品三级日韩久久| 欧美日韩国产美| 欧美性jizz18性欧美| 国产精品自拍小视频| 国产一区二区高清不卡| 激情一区二区三区| 亚洲国产精彩中文乱码av在线播放| 亚洲国产黄色| 99re66热这里只有精品4| 亚洲视频观看| 午夜精品一区二区三区四区 | 欧美专区日韩专区| 久久久亚洲影院你懂的| 美女精品在线观看| 亚洲欧洲精品成人久久奇米网| 亚洲精品乱码久久久久久日本蜜臀| 99re热精品| 欧美综合77777色婷婷| 麻豆乱码国产一区二区三区| 欧美精品在线观看91| 国产精品嫩草影院av蜜臀| 韩国三级在线一区| 99在线精品视频在线观看| 西西人体一区二区| 欧美福利电影在线观看| 一区二区三区日韩| 久久国内精品视频| 欧美日韩伦理在线| 国精品一区二区| 99综合在线| 久久免费精品日本久久中文字幕| 亚洲二区视频| 欧美一区二区视频在线| 欧美激情免费观看| 国产自产女人91一区在线观看| 91久久在线播放| 久久国产福利| 亚洲日本欧美| 久久久久久久一区二区三区| 欧美日韩中文字幕综合视频| 国产一区二区三区日韩| 在线亚洲精品| 欧美国产日韩一二三区| 性色一区二区| 欧美三级韩国三级日本三斤| 亚洲国产一二三| 久久色中文字幕| 亚洲一区精品视频| 欧美片在线观看| 亚洲人成在线观看一区二区 |