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

天行健 君子當(dāng)自強(qiáng)而不息

Working with skeletal animation(3)

Modifying Bone Orientation

After you have loaded the bone hierarchy, you can manipulate it. To modify the orientation of a bone, you first need to locate its respective frame structure by creating a function that recursively searches the frames for a specific bone name. Once it is found, a pointer to the frame is provided so you can directly access the frame's transformation matrix. The recursive search function might look something like this:

Note You can apply any transformation to any bone in the hierarchy, but it's recommended that you only work with rotations. Why only rotations? Think of it this way−when you bend your elbow, it rotates. How would you explain it if you translated your elbow instead? That would make your elbow pop off your arm−something you definitely don't want!

If you are trying to move the entire mesh through the world, just translate the root bone; all other bones will inherit that transformation. Better yet, use the world transformation to move the skinned mesh object through the 3D world.

D3DXFRAME_EX *FindFrame(D3DXFRAME_EX *Frame, char *Name)
{
// Only match non−NULL names
if(Frame && Frame−>Name && Name)
{
// Return frame pointer if matching name found
if(!strcmp(Frame−>Name, Name))
return Frame;
}
	// Try to find matching name in sibling frames
if(Frame && Frame−>pFrameSibling)
{
D3DXFRAME_EX *FramePtr = FindFrame((D3DXFRAME_EX*)Frame−>pFrameSibling, Name);
		if(FramePtr)
return FramePtr;
}
	// Try to find matching name in child frames
if(Frame && Frame−>pFrameFirstChild)
{
D3DXFRAME_EX *FramePtr = FindFrame((D3DXFRAME_EX*)Frame−>pFrameFirstChild, Name);
		if(FramePtr)
return FramePtr;
}
	// No matches found, return NULL
return NULL;
}

Suppose you want to find a bone called "Leg" using the FindFrame function. You simply provide the name of the bone to find and a pointer to your root frame, as shown here:

// pRootframe = D3DXFRAME_EX root frame pointer
D3DXFRAME_EX *Frame = FindFrame(pRootFrame, "Leg");

if(Frame) {
  // Do something with frame, like changing the D3DXFRAME_EX::TransformationMatrix to something
  // you want. For here, let's rotate the bone a little
  D3DXMatrixRotationY(&Frame−>TransformationMatrix, 1.57f);
}

 

Updating the Hierarchy

Once you've modified the bone transformations, you need to update the entire hierarchy so you can use it later for rendering. Even if you haven't modified the bone transformations, you still need to update the hierarchy because you need to set certain variables before rendering.

During the hierarchy update, you must combine each successive transformation down through the hierarchy. Starting at the root, you apply the bone's transformation matrix to the frame's combined transformation matrix. The bone's transformation matrix is passed to any siblings of the root to be combined as well. From there, the combined transformation matrix you just calculated is passed to each child of the root. This process propagates itself throughout the hierarchy.

Although it is hard to understand at first, you can think of the process this way: Take the skeletal structure in Figure 4.2, start at the root, and multiply it by a transformation matrix that positions the root in the world.

As you can see in Figure 4.2, the combined transformation from the root is passed to all of its child bones, which in turn are combined. The results are passed to the child bones of those bones. However, trying to compute the transformation matrices in the manner shown is very difficult, so other means are necessary.

The easiest way to update your frame hierarchy is to create a recursive function that combines the frame's transformation with a provided transformation matrix. From there, the transformation matrix is passed to the frame's siblings, and the combined matrix is passed to the frame's child frames. Take a look at the function in question.

void UpdateHierarchy(D3DXFRAME_EX *Frame, D3DXMATRIX matTransformation = NULL)
{
D3DXFRAME_EX *pFramePtr;
D3DXMATRIX matIdentity;
	// Use an identity matrix if none passed
if(!matTransformation)
{
D3DXMatrixIdentity(&matIdentity);
matTransformation = &matIdentity;
}
	// Combine matrices with supplied transformation matrix
matCombined = TransformationMatrix * (*matTransformation);
	// Combine with sibling frames
if((pFramePtr = (D3DXFRAME_EX*)pFrameSibling))
pFramePtr−>UpdateHierarchy(matTransformation);
	// Combine with child frames
if((pFramePtr = (D3DXFRAME_EX*)pFrameFirstChild))
pFramePtr−>UpdateHierarchy(&matCombined);
}

As you can see, the UpdateHierarchy function takes a D3DXFRAME_EX object as the first parameter−this is the current frame being processed. You only need to call UpdateHierarchy once, to provide a pointer to your root frame; the function will recursively call itself for each frame.

Notice the second parameter of UpdateHierarchy−matTransformation. The matTransformation parameter is the transformation matrix to apply to the frame's transformation. By default, the matTransformation pointer is NULL, meaning that an identity matrix is used during the call to UpdateHierarchy. After a frame's matrix is combined with the provided transformation, the resulting transformation is passed to the child frames by setting matTransformation during the next call.

As I just mentioned, you only need to call the UpdateHierarchy function using your root frame. Don't provide a transformation matrix as the second parameter−this should be left up to the recursive calls. If you do provide a transformation matrix with the root frame, you'll be moving the entire mesh using that transformation matrix. That's the same as setting the world transformation matrix to position and orient the mesh to render.

// pRootFrame = D3DXFRAME_EX root frame object
UpdateHierarchy(pRootFrame);

Now that you have a little understanding of the skeletal structure and how to work with bone hierarchies, it's time to move on to the second piece of the animation puzzle−the overlaid skinned mesh that deforms to match the orientation of the bone hierarchy.


posted on 2008-04-23 18:06 lovedday 閱讀(431) 評論(0)  編輯 收藏 引用


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


公告

導(dǎo)航

統(tǒng)計

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            国产日韩欧美精品综合| 国产精品九九| 亚洲国产欧美日韩精品| 欧美成人一品| 欧美日韩国产一区二区三区地区| 欧美mv日韩mv国产网站app| 最近中文字幕日韩精品| 最新成人av在线| 欧美日韩中文字幕综合视频 | 欧美黑人在线观看| 亚洲美女在线观看| 久久精品国产99国产精品澳门| 免费黄网站欧美| 国产亚洲精品aa午夜观看| 久久久99国产精品免费| 欧美a级大片| 欧美一级午夜免费电影| 亚洲久久视频| 国产一区二区三区在线观看免费视频 | 六月天综合网| 亚洲深夜av| 久久精品一区蜜桃臀影院| 亚洲伦理在线免费看| 亚洲欧美乱综合| 亚洲区免费影片| 香蕉成人伊视频在线观看| 亚洲欧洲另类| 欧美一区二区三区在线观看视频| 欧美日韩综合网| 一区二区日韩| 久久综合99re88久久爱| 亚洲女人小视频在线观看| 玖玖玖国产精品| 欧美一区二视频| 欧美精品久久久久久久| 老司机aⅴ在线精品导航| 欧美一区=区| 国产美女在线精品免费观看| 亚洲国产成人不卡| 欧美精品日韩一本| 免费在线国产精品| 国产欧美日本一区二区三区| 日韩午夜精品视频| 亚洲精品永久免费精品| 久久精品在这里| 久久成人av少妇免费| 欧美性大战久久久久久久蜜臀| 亚洲综合不卡| 亚洲女性裸体视频| 国一区二区在线观看| 亚洲电影免费在线 | 亚洲综合视频在线| 国产精品家教| 鲁大师成人一区二区三区 | 欧美在线www| 韩国v欧美v日本v亚洲v| 亚洲一品av免费观看| 亚洲调教视频在线观看| 欧美精品一区二区三区很污很色的 | 一区二区三区欧美| 99riav1国产精品视频| 免费成人性网站| 亚洲成人自拍视频| 很黄很黄激情成人| 亚洲国产电影| 亚洲日韩视频| 亚洲一区二区在线| 欧美一激情一区二区三区| 国产精品一区久久久久| 性感少妇一区| 一区二区日韩伦理片| 欧美人与性动交a欧美精品| 欧美影院久久久| 国产日韩视频一区二区三区| 亚洲一区在线观看视频 | 在线亚洲免费| 欧美在线影院在线视频| 黑人极品videos精品欧美裸| 亚洲精品中文字幕在线观看| 夜夜精品视频| 国产精品视频yy9099| 久久国产手机看片| 亚洲国产日韩一区| 亚洲综合社区| 狠狠做深爱婷婷久久综合一区| 亚洲精品你懂的| 亚洲精品美女久久久久| 欧美婷婷久久| 久久精品国产精品亚洲| 亚洲精品影视| 久久久亚洲高清| 国产精品青草久久| 久久精品视频导航| a4yy欧美一区二区三区| 久久久美女艺术照精彩视频福利播放| 欧美精品不卡| 欧美亚洲视频一区二区| 亚洲高清资源| 久久成人精品无人区| 亚洲精品一区二区在线| 国产精品视频福利| 欧美夫妇交换俱乐部在线观看| 久久视频精品在线| 夜夜嗨av一区二区三区四季av| 欧美sm极限捆绑bd| 亚洲影院高清在线| 亚洲国产高清一区| 久久久久久久综合日本| 国产日韩欧美黄色| 欧美日韩人人澡狠狠躁视频| 久久精品动漫| 亚洲男女自偷自拍| 亚洲精品一区二区三区樱花| 看片网站欧美日韩| 久久福利一区| 亚洲欧美另类国产| 国产精品久久久久久久久久尿 | 亚洲裸体俱乐部裸体舞表演av| 亚洲福利免费| 国产丝袜一区二区三区| 欧美日韩中文在线观看| 欧美国产日韩精品免费观看| 久久国产主播| 欧美在线视频免费| 午夜精品区一区二区三| 亚洲视频导航| 一区二区欧美在线| 99re6这里只有精品视频在线观看| 在线一区二区三区做爰视频网站| 国产精品久久久久久亚洲毛片| 在线天堂一区av电影| 亚洲裸体俱乐部裸体舞表演av| 亚洲欧美成人| 中文在线资源观看视频网站免费不卡| 欧美三级网址| 欧美日韩亚洲国产精品| 欧美巨乳在线| 欧美日韩国产成人在线91| 欧美福利精品| 欧美国产日韩一区二区在线观看| 日韩写真在线| 99精品免费视频| 99精品欧美一区| 久久人人爽人人爽爽久久| 久久精品九九| 久久夜色精品国产噜噜av| 亚洲美女黄网| 一区二区日韩欧美| 亚洲女性喷水在线观看一区| 亚洲在线网站| 久久成人精品电影| 噜噜噜躁狠狠躁狠狠精品视频 | 91久久综合亚洲鲁鲁五月天| 在线观看视频一区二区| 亚洲人成在线播放网站岛国| 亚洲精品一区在线| 国产一区二区三区精品欧美日韩一区二区三区| 国产精品高精视频免费| 国产日韩视频| 亚洲国产日韩在线| 一区二区三区四区五区精品视频| 国产一区二区av| 在线精品国产欧美| 国产欧美日韩不卡免费| 欧美精品一区二区久久婷婷| 欧美日韩裸体免费视频| 国产欧美日韩一区| 91久久久久久| 悠悠资源网亚洲青| 亚洲精品日韩久久| 欧美在线国产| 亚洲电影免费观看高清完整版在线观看| 欧美在线观看视频在线| 一区二区激情视频| 久久久久久久999| 欧美一区二区三区啪啪| 欧美成人一区二区三区在线观看 | 麻豆av一区二区三区久久| 欧美成人免费全部| 久久夜色精品国产亚洲aⅴ| 亚洲国产精品久久精品怡红院| 蜜臀久久99精品久久久画质超高清 | 美女黄网久久| 国产精品一级久久久| 欧美日韩精品欧美日韩精品一| 免费不卡亚洲欧美| 国产精品一区视频网站| 亚洲精品视频中文字幕| 久久久久久久综合色一本| 久久精品二区亚洲w码| 亚洲激情视频网站| 欧美一区二区三区四区在线观看地址 | 欧美11—12娇小xxxx| 国产精品影音先锋| 一区二区三区久久网| 欧美+日本+国产+在线a∨观看| 可以看av的网站久久看| 久久亚洲欧美| 欧美成人精品激情在线观看| 美女黄毛**国产精品啪啪|