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

天行健 君子當自強而不息

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>
            欧美一区中文字幕| 国产精品高潮呻吟| 亚洲免费观看高清完整版在线观看| 久久亚洲欧美国产精品乐播| 欧美一区影院| 久久久999精品| 久久久噜噜噜久久| 亚洲第一区在线观看| 欧美成人久久| 亚洲成色999久久网站| 欧美日韩午夜| 欧美精品久久99久久在免费线| 欧美日韩成人激情| 国产精品日本一区二区 | 欧美日韩精品免费观看视一区二区 | 欧美在线播放| 欧美国产日韩一区二区| 一本色道久久综合亚洲精品不| 午夜影院日韩| 欧美91大片| 国产精品日韩高清| 亚洲国产精品综合| 亚洲欧美成aⅴ人在线观看| 久久综合电影| 亚洲一区二区视频在线| 欧美韩国日本综合| 国产精品午夜视频| 亚洲美女精品成人在线视频| 久久久亚洲国产美女国产盗摄| 免费国产一区二区| 亚洲一区二区三区四区在线观看| 久久一区亚洲| 国产午夜精品久久久久久久| 一本到高清视频免费精品| 久久久久九九九| 9久草视频在线视频精品| 欧美尤物巨大精品爽| 欧美日韩国产首页在线观看| 影音先锋亚洲精品| 欧美一区深夜视频| 新67194成人永久网站| 一区二区三区高清视频在线观看 | 美女91精品| 亚洲欧美久久久久一区二区三区| 欧美大片免费久久精品三p | 久久久久久夜| 国产精品美女www爽爽爽视频| 亚洲高清在线观看一区| 欧美伊久线香蕉线新在线| 日韩视频久久| 欧美另类变人与禽xxxxx| 在线观看日韩| 久久久久国产一区二区| 午夜精品福利在线| 国产精品一区二区在线观看不卡| 99这里只有精品| 亚洲国产天堂久久综合网| 久久久精品国产免大香伊| 国产手机视频精品| 午夜精品婷婷| 午夜精品福利视频| 国产精品夜色7777狼人| 亚洲欧美综合网| 亚洲一区二区在线播放| 国产精品一区二区三区观看| 欧美一区二区三区男人的天堂| 一区二区三区欧美激情| 欧美日韩理论| 亚洲视频在线观看三级| 99riav国产精品| 国产精品久久久久久亚洲毛片 | 美女国内精品自产拍在线播放| 影音先锋日韩有码| 欧美sm视频| 欧美激情按摩在线| 亚洲永久视频| 欧美一级免费视频| 曰本成人黄色| 亚洲三级电影在线观看| 欧美色图五月天| 久久精品国产亚洲一区二区三区| 欧美一区二区三区在线| 在线成人小视频| 亚洲破处大片| 国产精品一区视频网站| 久热精品在线| 欧美极品aⅴ影院| 欧美亚洲免费高清在线观看| 久久久噜噜噜久久| 日韩一级黄色片| 亚洲一区日韩在线| 伊人久久久大香线蕉综合直播| 日韩亚洲国产精品| 亚洲精品在线观看视频| 欧美黄色一区| 欧美一级久久久久久久大片| 久久久久久九九九九| 一区二区三区精品久久久| 欧美一级视频免费在线观看| 亚洲国产日韩欧美在线99| 日韩一级黄色大片| 影音先锋久久久| 99国产精品久久久| 最新亚洲电影| 亚洲在线视频观看| 亚洲裸体视频| 久久九九免费| 欧美一区不卡| 欧美经典一区二区三区| 久久久久.com| 国产精品久久午夜夜伦鲁鲁| 欧美激情一区在线| 国产亚洲一区在线| 在线一区二区日韩| 亚洲免费不卡| 毛片一区二区| 美女视频黄 久久| 国产欧美亚洲日本| 中日韩午夜理伦电影免费| 日韩一级在线| 欧美黄色一区二区| 亚洲国产91| 亚洲精品女av网站| 久久亚洲国产成人| 久久久精品国产免费观看同学| 国产精品日韩欧美大师| 日韩手机在线导航| 一区二区三区国产盗摄| 欧美激情中文字幕一区二区| 亚洲国产精品久久| 欧美激情视频网站| 欧美成人亚洲成人日韩成人| 黑人一区二区三区四区五区| 亚洲欧美在线一区| 欧美一级大片在线免费观看| 国产精品国产三级国产| 亚洲深夜福利网站| 欧美一级免费视频| 国产精品亚洲а∨天堂免在线| 亚洲伦理在线| 99视频有精品| 欧美午夜美女看片| 亚洲婷婷在线| 欧美一级大片在线观看| 国产日韩欧美一区在线| 欧美一区=区| 噜噜爱69成人精品| 狠狠色噜噜狠狠狠狠色吗综合| 欧美在线一二三| 精品成人一区二区| 欧美亚洲视频在线看网址| 久久精品中文字幕一区| 在线亚洲精品福利网址导航| 欧美精品久久天天躁| 亚洲黄色视屏| 一区二区三区免费观看| 国产精品免费观看视频| 亚洲免费在线观看视频| 久久久国产午夜精品| 亚洲日本欧美| 国产精品乱码| 久久久夜夜夜| 亚洲日韩欧美视频一区| 午夜免费日韩视频| 国产亚洲永久域名| 欧美成人午夜视频| 亚洲女人小视频在线观看| 久久人体大胆视频| 亚洲美女视频网| 国产精品久久久久77777| 久久精品成人欧美大片古装| 欧美高清视频在线播放| 亚洲一区精品电影| 精品91久久久久| 欧美午夜大胆人体| 久久久久久久久久久久久9999| 亚洲国产精品va| 欧美在线观看视频一区二区三区 | 欧美日韩的一区二区| 亚洲欧美综合精品久久成人| 亚洲欧洲精品成人久久奇米网| 久久精品30| 一区二区三区四区五区在线| 国产午夜精品麻豆| 欧美四级在线| 裸体一区二区| 欧美在线你懂的| 欧美成人精品三级在线观看 | 欧美激情一区在线| 久久久久久久成人| 亚洲一区二区欧美日韩| 久久精品国产999大香线蕉| 亚洲高清不卡在线| 久久久久久久97| 性色av一区二区三区| 一本不卡影院| 亚洲九九精品| 亚洲人成在线观看一区二区| 在线国产日韩| 在线观看日韩一区|