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

天行健 君子當自強而不息

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>
            欧美专区在线观看| 久久精品国产清高在天天线| 欧美精品一区在线| 在线视频你懂得一区| 一区二区不卡在线视频 午夜欧美不卡在 | 免费在线国产精品| 亚洲人www| 亚洲视频免费观看| 好吊妞**欧美| 亚洲欧洲精品一区| 欧美日韩另类国产亚洲欧美一级| 亚洲伊人观看| 久久精品国产欧美激情| 亚洲精品乱码久久久久久| 一本色道久久综合亚洲精品按摩| 国产欧美日韩专区发布| 美女视频黄a大片欧美| 欧美精品一区二区三区很污很色的 | 亚洲在线国产日韩欧美| 午夜精品福利视频| 最新成人av网站| 亚洲性夜色噜噜噜7777| 伊人成人在线视频| 日韩视频一区| 尤物yw午夜国产精品视频| 亚洲精品一二三区| 国产主播在线一区| 99国内精品| 亚洲国产99精品国自产| 中国女人久久久| 亚洲韩日在线| 性亚洲最疯狂xxxx高清| 亚洲最黄网站| 久久久美女艺术照精彩视频福利播放| 一区二区三区日韩欧美精品| 香蕉国产精品偷在线观看不卡| 亚洲免费成人| 久久视频精品在线| 久久国产精品72免费观看| 欧美日本在线| 欧美1区视频| 国产在线国偷精品产拍免费yy| 亚洲精品美女91| 最新69国产成人精品视频免费 | 久久在线视频| 国产精品一卡二卡| 日韩午夜在线观看视频| 亚洲福利一区| 久久九九国产| 久久久中精品2020中文| 国产精品区二区三区日本| 亚洲精品午夜| 亚洲毛片网站| 欧美经典一区二区| 亚洲韩国一区二区三区| 亚洲国产高清高潮精品美女| 亚久久调教视频| 欧美专区在线播放| 国产精品资源| 性欧美超级视频| 久久久国产一区二区| 国产日产欧美a一级在线| 亚洲五月婷婷| 欧美一级免费视频| 国产精品尤物| 欧美一级午夜免费电影| 久久大逼视频| 国产亚洲aⅴaaaaaa毛片| 性亚洲最疯狂xxxx高清| 久久精品视频播放| 狠狠久久综合婷婷不卡| 久久亚洲电影| 亚洲国产天堂久久国产91| 99在线|亚洲一区二区| 欧美区高清在线| 一本到高清视频免费精品| 亚洲一区二区欧美日韩| 国产乱码精品一区二区三区忘忧草 | 亚洲三级国产| 亚洲欧美在线高清| 国产一区二区三区四区三区四| 久久精品亚洲乱码伦伦中文| 老司机午夜免费精品视频| 最近中文字幕日韩精品| 欧美日韩一区综合| 欧美一级久久久| 亚洲国产精品久久久久秋霞不卡| 亚洲视频999| 国产日韩综合| 欧美精品久久99| 性欧美videos另类喷潮| 欧美国产日韩一区| 亚洲中无吗在线| 精品91视频| 欧美深夜福利| 久久精品视频亚洲| 亚洲精品一区二区在线| 欧美影院一区| 亚洲精品视频免费在线观看| 国产精品成人免费精品自在线观看| 午夜亚洲激情| 91久久在线视频| 久久免费高清视频| 亚洲图片欧美日产| 亚洲国产欧美精品| 国产欧美日韩91| 欧美精品一区在线观看| 欧美在线视频免费观看| 99精品国产一区二区青青牛奶| 久久精品国语| 亚洲综合色噜噜狠狠| 亚洲国产精品一区二区久| 国产精品少妇自拍| 欧美日韩亚洲一区二区三区四区| 久久久人成影片一区二区三区| 一本久久综合亚洲鲁鲁五月天| 免费欧美日韩国产三级电影| 亚洲在线观看免费| 亚洲免费观看| 亚洲黄色小视频| 国内偷自视频区视频综合| 欧美午夜片在线免费观看| 老司机精品导航| 欧美中文字幕久久| 亚洲免费中文字幕| 一本色道久久综合亚洲精品婷婷| 欧美成人一区二区三区在线观看| 久久精品日韩欧美| 性欧美在线看片a免费观看| 99视频一区| 日韩视频一区二区| 亚洲精品免费一二三区| 在线观看不卡| 黄色资源网久久资源365| 国产欧美在线视频| 国产一级精品aaaaa看| 国产精品久久久久国产精品日日| 欧美另类极品videosbest最新版本| 久久野战av| 欧美 日韩 国产 一区| 免费av成人在线| 欧美大胆人体视频| 欧美区高清在线| 欧美日韩国产一区| 国产精品爱啪在线线免费观看| 欧美片第一页| 欧美四级在线| 国产精品综合色区在线观看| 国产精品三级视频| 国产精品丝袜久久久久久app| 国产精品爽爽爽| 国产欧美日韩精品a在线观看| 国产日韩欧美在线观看| 国产原创一区二区| 国内成+人亚洲| 在线免费观看欧美| 亚洲免费观看高清完整版在线观看熊| 亚洲精品免费在线播放| 99精品国产热久久91蜜凸| 夜夜躁日日躁狠狠久久88av| 亚洲一区二区黄色| 久久精品亚洲一区二区三区浴池| 久久婷婷一区| 亚洲黄色三级| 一区二区三区日韩欧美精品| 亚洲免费在线视频| 久久婷婷国产麻豆91天堂| 欧美成人午夜免费视在线看片| 欧美日韩精品三区| 国产在线精品自拍| 99热这里只有成人精品国产| 亚洲一区二三| 女人天堂亚洲aⅴ在线观看| 亚洲国产欧美精品| 午夜日韩在线观看| 欧美不卡视频一区| 国产日韩欧美在线观看| 亚洲精品视频一区二区三区| 亚洲免费视频成人| 蜜桃av久久久亚洲精品| 夜夜嗨av一区二区三区网站四季av| 午夜免费在线观看精品视频| 欧美成人免费全部| 国产日韩亚洲欧美精品| 亚洲美女av网站| 久久深夜福利| 国产精品99久久99久久久二8| 久久久av毛片精品| 国产精品一区=区| 一本一本久久| 免费h精品视频在线播放| 亚洲一级一区| 欧美日韩国产在线| 亚洲经典一区| 米奇777超碰欧美日韩亚洲| 亚洲视频碰碰| 欧美视频在线观看免费| 亚洲欧洲另类国产综合| 久久综合影视| 欧美怡红院视频|