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

天行健 君子當自強而不息

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>
            久久精品五月婷婷| 欧美成年视频| 国产亚洲精品一区二区| 亚洲人体大胆视频| 米奇777在线欧美播放| 亚洲一区二区三区精品视频| 美女主播一区| 黄色日韩网站| 牛人盗摄一区二区三区视频| 欧美一区免费| 红桃视频成人| 久久婷婷久久| 久久欧美肥婆一二区| 国产一区二区精品丝袜| 久久大逼视频| 久久国产66| 亚洲高清av在线| 亚洲国产高清在线观看视频| 欧美亚洲尤物久久| 一区二区视频欧美| 欧美成人一区二区| 欧美精品一区二区三区视频| 亚洲天堂男人| 欧美一区二区三区精品| 在线观看视频一区| 91久久精品国产91久久性色| 欧美日韩卡一卡二| 亚洲视频日本| 亚洲欧美在线高清| 在线观看91精品国产麻豆| 欧美aaa级| 欧美午夜精品理论片a级大开眼界 欧美午夜精品理论片a级按摩 | 一区二区在线免费观看| 欧美成年人网| 欧美日韩美女在线| 久久久999| 蜜桃精品久久久久久久免费影院| 亚洲乱码国产乱码精品精天堂| 亚洲久久在线| 国产精品综合av一区二区国产馆| 久久久噜噜噜久噜久久| 男人的天堂亚洲在线| 亚洲综合不卡| 久久久久久久一区二区| 日韩午夜在线视频| 欧美一级视频| 一区二区国产日产| 久久久精品免费视频| 亚洲午夜一区二区三区| 久久综合亚州| 小处雏高清一区二区三区| 久久综合一区| 久久精品一本久久99精品| 欧美精品在线免费| 久久亚洲综合色一区二区三区| 欧美激情1区| 久久蜜臀精品av| 国产精品久久久久久久久婷婷| 噜噜噜在线观看免费视频日韩| 亚洲欧美日韩一区二区在线 | 亚洲欧美日韩国产另类专区| 在线成人国产| 亚洲欧美日韩爽爽影院| 亚洲精品麻豆| 久久精品视频在线观看| 日韩西西人体444www| 久久精品亚洲一区| 欧美一级成年大片在线观看| 欧美激情国产日韩精品一区18| 久久精品人人做人人综合| 欧美日韩另类视频| 免费看精品久久片| 国产夜色精品一区二区av| 99精品福利视频| 999亚洲国产精| 久久精品夜色噜噜亚洲a∨| 一本色道久久| 欧美黄色一区| 蜜桃av一区二区| 国产精品自拍小视频| 一本色道久久综合亚洲精品不卡| 亚洲精品久久久久中文字幕欢迎你| 亚洲男人影院| 午夜电影亚洲| 国产精品大片| 亚洲美女精品成人在线视频| 最新日韩av| 欧美h视频在线| 欧美插天视频在线播放| 黄色精品免费| 久久国产精彩视频| 久久精品视频在线观看| 国产精品久久久久久久久| 亚洲第一黄色| 亚洲精品久久久久久久久久久久久| 久久婷婷蜜乳一本欲蜜臀| 欧美一区国产在线| 国产精品免费福利| 亚洲欧美综合精品久久成人| 午夜精品一区二区三区电影天堂 | 免费视频最近日韩| 黄色成人av网站| 久久精品网址| 久久久久久香蕉网| 亚洲二区免费| 蜜桃久久精品乱码一区二区| 欧美/亚洲一区| 亚洲人成艺术| 国产精品高潮呻吟久久av黑人| 一区二区三区波多野结衣在线观看| 日韩一级黄色大片| 欧美日韩精品| 制服丝袜亚洲播放| 久久精品国产一区二区电影| 国产日本精品| 久久婷婷国产麻豆91天堂| 欧美成人免费全部| 亚洲区在线播放| 国产精品久久久久久模特| 亚洲欧美日韩精品综合在线观看| 国内欧美视频一区二区| 蜜桃av一区二区三区| 一区二区三区在线看| 久久久久久一区| 亚洲电影第三页| 亚洲欧美激情精品一区二区| 久久影音先锋| 亚洲另类春色国产| 欧美三区免费完整视频在线观看| 日韩视频在线一区二区三区| 亚洲影视在线播放| 在线看一区二区| 欧美日韩性视频在线| 亚洲在线中文字幕| 久久一区二区三区超碰国产精品| 亚洲国产一成人久久精品| 欧美日韩一区二区三区| 欧美亚洲视频在线观看| 亚洲大片一区二区三区| 亚洲在线观看| 亚洲第一二三四五区| 欧美日本国产视频| 欧美在线看片a免费观看| 亚洲黑丝在线| 久久激情中文| 一本久久综合| 亚洲经典一区| 国产区亚洲区欧美区| 欧美精品成人一区二区在线观看 | 香蕉久久久久久久av网站| 亚洲成色777777女色窝| 久久久久**毛片大全| 99这里只有精品| 黄色一区二区在线观看| 欧美日韩精品国产| 久久偷看各类wc女厕嘘嘘偷窃| 亚洲字幕一区二区| 亚洲国产午夜| 免费一区二区三区| 久久狠狠一本精品综合网| 亚洲精选视频免费看| 国产视频一区免费看| 欧美日韩免费高清| 欧美成人午夜剧场免费观看| 香港成人在线视频| 亚洲图片欧洲图片日韩av| 亚洲免费观看| 亚洲欧洲日本专区| 欧美成人精品h版在线观看| 久久精品国产91精品亚洲| 一区二区三区高清| 一卡二卡3卡四卡高清精品视频| 在线精品高清中文字幕| 国产美女精品视频免费观看| 国产精品高清一区二区三区| 欧美男人的天堂| 欧美成年人网站| 久久精品在线播放| 久久精品99国产精品日本| 亚洲女人天堂av| 一本久久青青| 亚洲小说区图片区| 一区二区三区高清| 一片黄亚洲嫩模| 亚洲一区二区三区在线观看视频 | 久久男女视频| 午夜一区不卡| 噜噜爱69成人精品| 久久香蕉国产线看观看网| 久久亚洲色图| 欧美高清免费| 亚洲国产欧美一区二区三区久久 | 蜜桃久久av一区| 免费不卡中文字幕视频| 亚洲精品激情| 日韩视频欧美视频| 一区二区三欧美| 午夜精品福利电影| 久久成人这里只有精品| 久久www成人_看片免费不卡|