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

天行健 君子當自強而不息

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

公告

導航

統計

常用鏈接

隨筆分類(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>
            午夜在线精品偷拍| 国产午夜精品一区二区三区欧美| 国产原创一区二区| 欧美日韩在线精品| 欧美在线一二三四区| 一区二区电影免费观看| 91久久精品日日躁夜夜躁欧美| 久久精品1区| 久久精品人人做人人爽电影蜜月 | 亚洲肉体裸体xxxx137| 亚洲大胆视频| 美女黄毛**国产精品啪啪| 午夜视频久久久| 欧美一区二区三区四区在线观看| 亚洲桃花岛网站| 亚洲视频在线观看免费| 亚洲视频一区二区| 亚洲男女自偷自拍图片另类| 亚洲小说欧美另类婷婷| 亚洲欧美日韩中文视频| 欧美一区在线直播| 亚洲一区视频在线| 中文精品99久久国产香蕉| 国产精品私拍pans大尺度在线| 欧美日韩免费观看一区三区| 欧美性开放视频| 国产三级精品在线不卡| 黄色精品免费| 亚洲另类春色国产| 亚洲影院在线| 久久野战av| 亚洲狠狠丁香婷婷综合久久久| 亚洲裸体俱乐部裸体舞表演av| 亚洲精选大片| 亚洲欧美在线一区二区| 久久噜噜噜精品国产亚洲综合| 麻豆av福利av久久av| 欧美日韩另类丝袜其他| 欧美—级a级欧美特级ar全黄| 欧美激情按摩在线| 欧美午夜视频一区二区| 国产亚洲欧洲| 亚洲欧洲日本国产| 亚洲一区三区电影在线观看| 久久精视频免费在线久久完整在线看| 久久躁狠狠躁夜夜爽| 亚洲人成免费| 亚洲精品中文字幕女同| 亚洲黄色影院| 亚洲天堂第二页| 亚洲日本精品国产第一区| 亚洲一区二区三区四区五区午夜| 欧美在线|欧美| 欧美人与禽猛交乱配| 国产一区二区三区四区在线观看| 亚洲乱码国产乱码精品精| 久久精品欧美日韩| aa国产精品| 亚洲视频一二| 欧美激情一区二区久久久| 国产三级精品在线不卡| 一区二区黄色| 亚洲高清在线视频| 久久精品人人| 国产精品一区在线观看| 亚洲精品在线免费| 免费亚洲电影在线| 先锋亚洲精品| 欧美精品久久99| 亚洲国产91| 久久久久国产精品一区| 亚洲大胆人体视频| 久久精品人人| 黄色国产精品| 久久国产精品久久久久久电车| 日韩视频在线播放| 欧美精品激情在线| 亚洲精品资源| 亚洲国产aⅴ天堂久久| 久久噜噜亚洲综合| 国语精品一区| 久久久免费精品视频| 亚洲欧美精品中文字幕在线| 国产精品二区二区三区| 亚洲国产欧美日韩| 亚洲天堂免费观看| 99国内精品久久| 欧美日韩亚洲一区二区三区四区| 亚洲国产欧美一区二区三区久久 | 欧美激情一区| 一个色综合av| 夜夜嗨av一区二区三区四季av| 欧美成人高清| 欧美日本国产视频| 99视频国产精品免费观看| 亚洲电影第三页| 欧美激情中文字幕一区二区| 亚洲精品在线看| 日韩一区二区高清| 久久综合久色欧美综合狠狠| 欧美日本高清| 午夜精品久久久久久久久久久久久| 一本色道久久综合亚洲精品小说| 国产精品红桃| 久久久国产精品一区| 久久se精品一区精品二区| 在线免费观看一区二区三区| 亚洲成人在线视频播放 | 亚洲综合成人婷婷小说| 国产精品一二三四| 久久综合图片| 欧美国产精品| 午夜精品999| 久久美女性网| 中日韩男男gay无套| 亚洲国语精品自产拍在线观看| 久久免费国产精品| 亚洲私人黄色宅男| 久久精品一本| 在线亚洲一区观看| 欧美一区二区视频免费观看| 亚洲区在线播放| 亚洲欧美日韩区| 亚洲国产欧美一区| 亚洲欧美视频一区二区三区| 亚洲大片免费看| 亚洲综合精品四区| 日韩亚洲欧美综合| 欧美与黑人午夜性猛交久久久| 国产模特精品视频久久久久| 欧美激情乱人伦| 国产欧美视频一区二区三区| 亚洲电影第1页| 国产视频在线观看一区二区三区| 欧美激情免费在线| 国产伦精品一区二区三区高清版| 亚洲福利久久| 海角社区69精品视频| 欧美国产成人精品| 欧美日韩一区视频| 亚洲电影在线免费观看| 好看的亚洲午夜视频在线| 一区二区国产精品| 国产精品久在线观看| 91久久综合| 91久久精品美女| 久久久精品一区| 国产一区av在线| 欧美影院成年免费版| 亚洲一区精品视频| 欧美久久久久久| 91久久精品一区二区三区| 影音先锋亚洲电影| 欧美不卡激情三级在线观看| 亚洲欧洲在线看| 亚洲小说欧美另类婷婷| 国产午夜亚洲精品理论片色戒 | 欧美激情影院| 亚洲五月婷婷| 老司机一区二区三区| 亚洲精品一区中文| 国产精品二区影院| 久久久蜜桃精品| 亚洲人成人一区二区在线观看| 亚洲一区二区精品| 国内成人精品2018免费看| 欧美成人一二三| 亚洲欧美激情一区| 欧美成人免费va影院高清| 亚洲视频一区二区在线观看| 国产一区二区三区高清播放| 你懂的国产精品永久在线| 中文日韩欧美| 欧美高清视频免费观看| 午夜精品久久久| 亚洲国产中文字幕在线观看| 国产精品久久久久久超碰| 久久综合激情| 亚洲欧美日韩精品综合在线观看 | 免费永久网站黄欧美| 亚洲小说春色综合另类电影| 影院欧美亚洲| 国产精品另类一区| 牛人盗摄一区二区三区视频| 亚洲综合电影一区二区三区| 亚洲国产二区| 久久偷窥视频| 欧美一区二区播放| 一本色道久久综合亚洲精品不| 国产综合色产在线精品| 欧美日韩国产一区二区三区地区| 久久精品人人做人人爽电影蜜月| 在线性视频日韩欧美| 欧美黄在线观看| 卡通动漫国产精品| 欧美一区二区三区视频在线 | 一区二区三区偷拍| 亚洲人精品午夜| 在线电影国产精品| 国产一区二区三区日韩|