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

天行健 君子當自強而不息

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 閱讀(435) 評論(0)  編輯 收藏 引用


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


公告

導航

統計

常用鏈接

隨筆分類(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>
            亚洲欧洲另类| 国产视频一区二区在线观看| 亚洲欧美日韩在线| 麻豆精品传媒视频| 性色av一区二区三区在线观看| 免费成人小视频| 久久久免费精品| 国产精品视频免费观看| 亚洲精品乱码视频| 欧美综合激情网| 欧美在线国产| 国产精品久久久久久久久久直播 | 最新日韩欧美| 欧美在线精品免播放器视频| 亚洲欧美激情视频在线观看一区二区三区| 中国成人亚色综合网站| 亚洲高清一区二| 国产区在线观看成人精品| 艳妇臀荡乳欲伦亚洲一区| 亚洲黄色在线视频| 久久尤物视频| 蜜月aⅴ免费一区二区三区| 国产一本一道久久香蕉| 亚洲欧美中文另类| 欧美一区永久视频免费观看| 国产精品露脸自拍| 亚洲在线视频网站| 午夜日韩福利| 国产欧美一区二区三区在线老狼 | 国产精品腿扒开做爽爽爽挤奶网站| 亚洲黄色小视频| 99re6这里只有精品视频在线观看| 亚洲人成人一区二区在线观看| 亚洲高清色综合| 亚洲国内欧美| 欧美高清在线一区| 亚洲精品专区| 欧美日韩视频在线| 亚洲性图久久| 久久成人国产| 在线精品高清中文字幕| 一区二区三区高清在线| 久久久久九九视频| 农村妇女精品| 夜夜精品视频一区二区| 欧美亚一区二区| 性欧美8khd高清极品| 久久综合中文| 99视频超级精品| 国产精品女人毛片| 久久精品亚洲精品国产欧美kt∨| 免费在线观看精品| 中文精品视频一区二区在线观看| 国产精品扒开腿爽爽爽视频| 午夜视频精品| 亚洲国产一区二区三区a毛片| 一区二区三区**美女毛片| 国产精品久久久久永久免费观看| 性欧美激情精品| 欧美激情精品| 亚洲免费在线观看视频| 狠狠色狠狠色综合| 欧美久久婷婷综合色| 午夜激情一区| 亚洲激情在线观看| 国产欧美在线视频| 欧美1区免费| 亚洲综合日韩在线| 欧美激情一区在线| 欧美一区二区在线播放| 亚洲人久久久| 国产日韩精品久久久| 欧美成人精品1314www| 亚洲婷婷综合久久一本伊一区| 欧美日韩久久久久久| 亚洲精品小视频在线观看| 久久国产免费看| 一区二区三区 在线观看视频 | 亚洲人成在线影院| 国产欧美一区二区三区另类精品 | 国产亚洲精品aa| 欧美精品日韩www.p站| 欧美在线免费| 亚洲午夜精品一区二区三区他趣| 欧美不卡在线视频| 欧美在线啊v一区| 一区二区三区导航| 亚洲国产综合视频在线观看| 国产色综合天天综合网| 欧美激情欧美激情在线五月| 免费人成网站在线观看欧美高清| 亚洲一区国产视频| 一区二区三区久久久| 在线看片欧美| 精品成人久久| 国产一区二区日韩精品欧美精品| 欧美午夜理伦三级在线观看| 欧美国产日韩精品免费观看| 久久久久在线| 久久国产毛片| 欧美在线播放一区二区| 亚洲伊人网站| 欧美猛交免费看| 欧美成人性生活| 麻豆精品91| 嫩草影视亚洲| 噜噜噜躁狠狠躁狠狠精品视频| 久久精品中文字幕一区| 香蕉视频成人在线观看| 亚洲欧美日韩成人| 午夜精品99久久免费| 亚洲欧美日韩系列| 亚洲欧美日韩天堂一区二区| 午夜精品福利视频| 欧美一区二区三区免费大片| 亚洲女人av| 欧美一级视频精品观看| 久久国产毛片| 欧美11—12娇小xxxx| 欧美成人a视频| 欧美日本国产精品| 欧美日韩在线播放三区| 国产精品免费在线| 久久精品观看| 久久一区视频| 欧美激情精品久久久久久| 欧美日韩蜜桃| 国产欧美日韩在线 | 欧美色综合网| 国产精品男女猛烈高潮激情| 国产欧美日韩高清| 狠狠色丁香久久综合频道| 欧美国产日本| 亚洲国产一区二区三区青草影视| 亚洲国产婷婷| 亚洲天堂av图片| 久久爱另类一区二区小说| 巨胸喷奶水www久久久免费动漫| 欧美承认网站| 国产精品欧美日韩一区| 激情另类综合| 亚洲午夜免费视频| 久久精品夜色噜噜亚洲a∨ | 久久超碰97人人做人人爱| 麻豆精品传媒视频| 亚洲免费高清视频| 国产综合色产在线精品| 免费成人黄色av| 欧美午夜欧美| 在线看无码的免费网站| 亚洲视频在线一区| 久久久一二三| 一本一本久久a久久精品综合妖精| 久久精品国产免费观看| 亚洲国产高清在线| 亚洲欧美日本精品| 欧美黑人在线播放| 国产一级精品aaaaa看| 亚洲最黄网站| 老妇喷水一区二区三区| 一区二区三区蜜桃网| 久久欧美肥婆一二区| 国产精品美女久久久浪潮软件| 亚洲国产精品美女| 午夜精品美女久久久久av福利| 久久香蕉国产线看观看网| 国产精品久久久久免费a∨| 亚洲国产合集| 久久精品欧洲| 亚洲调教视频在线观看| 欧美国产第一页| 悠悠资源网亚洲青| 久久国产精品高清| 一本久道久久久| 欧美国产第一页| 亚洲高清视频在线| 久久免费高清| 欧美一级专区免费大片| 国产精品成人aaaaa网站| 亚洲免费观看在线视频| 你懂的视频一区二区| 久久精品国产亚洲一区二区| 国产精品入口尤物| 亚洲一级免费视频| 日韩性生活视频| 欧美日韩国产影院| 99re6热只有精品免费观看 | 日韩视频在线播放| 欧美理论在线| 日韩一区二区免费高清| 欧美激情亚洲另类| 猫咪成人在线观看| 亚洲高清网站| 欧美激情一区二区| 久久久天天操| 91久久久在线| 亚洲国产精品久久人人爱蜜臀| 在线成人激情黄色| 免费亚洲电影在线| 久久尤物视频|