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

天行健 君子當自強而不息

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>
            欧美jizzhd精品欧美巨大免费| 欧美一区二区三区免费视频| 国产精品99久久不卡二区| 久久亚洲私人国产精品va媚药 | 欧美性一二三区| 乱中年女人伦av一区二区| 欧美一区二区三区视频| 久久精品日韩欧美| 欧美+日本+国产+在线a∨观看| 欧美1区2区3区| 欧美日韩xxxxx| 国产精品夜色7777狼人| 韩日欧美一区二区| 亚洲精品乱码| 欧美一区二区视频网站| 午夜一区二区三区不卡视频| 久久久免费观看视频| 亚洲黄色成人网| 亚洲国产精品视频| 亚洲无人区一区| 老司机成人在线视频| 欧美日韩中文在线观看| 国产日韩精品在线播放| 亚洲激情视频| 亚洲免费观看高清在线观看 | 久久综合狠狠综合久久激情| 欧美日本亚洲| 好男人免费精品视频| 99在线精品观看| 久久久水蜜桃| 亚洲天堂视频在线观看| 久久影院午夜论| 欧美sm视频| 亚洲专区在线| 欧美激情综合五月色丁香小说| 亚洲欧美精品在线观看| 国产精品卡一卡二| 亚洲美女视频网| 欧美aⅴ99久久黑人专区| 亚洲主播在线观看| 欧美亚洲不卡| 日韩一区二区福利| 免费观看不卡av| 欧美亚洲日本网站| 国产精品一国产精品k频道56| 亚洲国产精品免费| 久久久精品动漫| 日韩西西人体444www| 久久精品国产91精品亚洲| 国产精品久久久久久户外露出| 亚洲欧洲在线看| 免费在线看一区| 欧美亚洲视频在线看网址| 国产精自产拍久久久久久| 一区二区三区 在线观看视| 美女视频黄 久久| 欧美亚洲免费电影| 国产日韩欧美三区| 久久久欧美一区二区| 亚洲午夜久久久久久尤物| 欧美欧美午夜aⅴ在线观看| 亚洲国产美女精品久久久久∴| 亚洲一区二区精品视频| 91久久线看在观草草青青| 欧美国产日本高清在线| 亚洲国内在线| 亚洲免费成人| 欧美日韩精品三区| 亚洲视频图片小说| 一本久道久久综合婷婷鲸鱼| 欧美四级在线观看| 欧美一级在线视频| 久久成人综合视频| 亚洲国产天堂久久综合| 亚洲国产色一区| 欧美日韩直播| 久久精品亚洲| 美女主播一区| 亚洲影院色无极综合| 亚洲欧美综合一区| 狠狠v欧美v日韩v亚洲ⅴ| 欧美a级大片| 欧美午夜精品久久久久久超碰| 欧美一区二区三区另类| 久久久欧美精品sm网站| 99在线精品视频在线观看| 亚洲一区二区三区精品动漫| 国内精品亚洲| 亚洲剧情一区二区| 国产亚洲毛片| 亚洲裸体视频| 在线免费观看一区二区三区| 亚洲美女毛片| 99www免费人成精品| 国产一区视频在线观看免费| 亚洲电影在线看| 国产欧美日韩亚洲精品| 欧美国产在线视频| 国产精品视频内| 亚洲精品激情| 伊人久久婷婷色综合98网| 99视频+国产日韩欧美| 国产主播精品在线| 99精品欧美一区二区三区综合在线| 国产手机视频精品| 一区二区三区成人| 亚洲免费高清| 久久久亚洲国产天美传媒修理工| 亚洲欧美日本视频在线观看| 欧美伊人久久| 欧美一区二区三区免费在线看| 欧美激情精品久久久久久久变态| 久久激情网站| 国产精品欧美日韩| 亚洲精品国产无天堂网2021| 黄色小说综合网站| 亚洲一级在线观看| 亚洲美女诱惑| 欧美激情aⅴ一区二区三区 | 久久亚洲图片| 国产精品美女久久久浪潮软件| 欧美国产精品一区| 狠狠色噜噜狠狠狠狠色吗综合| 一区二区三区|亚洲午夜| 亚洲精品免费电影| 六月天综合网| 欧美二区在线观看| 黄色一区二区三区| 久久精品视频99| 久久久久欧美精品| 国产在线精品一区二区中文 | 欧美在线综合视频| 久久国产精品毛片| 国产欧美一级| 欧美在线不卡| 久久在精品线影院精品国产| 国产亚洲成av人在线观看导航| 中国av一区| 午夜精品一区二区在线观看| 国产精品成人一区二区三区夜夜夜 | 一区二区三区久久精品| 最新国产拍偷乱拍精品| 久久国产毛片| 麻豆国产va免费精品高清在线| 国产亚洲二区| 久久久久久9999| 欧美阿v一级看视频| 亚洲激情中文1区| 欧美巨乳波霸| 亚洲一区中文| 美女性感视频久久久| 亚洲激情午夜| 国产精品v日韩精品v欧美精品网站| 亚洲一级黄色| 欧美高清在线视频| 亚洲一区二区三区在线播放| 亚洲欧美日韩综合一区| 久久久久这里只有精品| 亚洲高清毛片| 国产精品va在线播放| 香蕉成人伊视频在线观看 | 欧美精品一区二区三区在线播放| 亚洲国产精品免费| 午夜激情久久久| 尤物在线精品| 欧美视频在线一区二区三区| 久久精品av麻豆的观看方式| 亚洲国产欧美一区二区三区久久 | 一区二区在线不卡| 欧美福利在线| 亚洲综合色激情五月| 久久在线免费视频| 一区二区三区国产精品| 国产亚洲午夜高清国产拍精品| 欧美成人69av| 午夜激情久久久| 亚洲欧洲午夜| 快射av在线播放一区| 一区二区高清在线| 国语自产精品视频在线看8查询8 | 欧美亚洲在线播放| 亚洲日韩中文字幕在线播放| 亚洲欧美综合一区| 亚洲精品乱码久久久久| 国产一区二区在线免费观看| 欧美精品一二三| 久久另类ts人妖一区二区| 一本久久综合亚洲鲁鲁五月天| 免费观看在线综合| 久久国产精品99久久久久久老狼 | 亚洲一区二区三区四区五区黄| 激情久久久久| 国产欧美精品日韩| 国产精品chinese| 欧美国产日本在线| 卡一卡二国产精品| 久久久久久尹人网香蕉| 欧美一区观看| 午夜在线视频观看日韩17c| 一区二区三区毛片|