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

天行健 君子當(dāng)自強(qiáng)而不息

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


只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


公告

導(dǎo)航

統(tǒng)計

常用鏈接

隨筆分類(178)

3D游戲編程相關(guān)鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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久久久综合| 久久9热精品视频| 欧美中文字幕| 亚洲国产精品激情在线观看| 在线观看日韩欧美| 欧美精品粉嫩高潮一区二区| 国产精品99久久久久久www| 国产精品欧美经典| 欧美日韩调教| 久久精品亚洲热| 亚洲国产电影| 欧美影院在线| 亚洲六月丁香色婷婷综合久久| 亚洲欧美在线另类| 亚洲久久一区二区| 在线免费精品视频| 欧美高清自拍一区| 最近看过的日韩成人| 欧美中文字幕精品| 亚洲一区国产精品| 中日韩视频在线观看| 亚洲大片av| 国产一区二区三区四区| 国产精品一区视频| 麻豆精品精品国产自在97香蕉| 久久国内精品自在自线400部| 羞羞色国产精品| 亚洲制服av| 亚洲欧美日韩区| 亚洲一区二区免费在线| 99精品欧美一区二区蜜桃免费| 亚洲免费成人av| 久久国产精品99国产| 亚洲一区二区伦理| 欧美大胆a视频| 午夜精品久久久久久久久 | 亚洲欧美久久久| 久久综合九色欧美综合狠狠| 日韩一级欧洲| 美女视频网站黄色亚洲| 国产欧美一二三区| 亚洲午夜电影| 亚洲电影欧美电影有声小说| 亚洲欧美日韩视频一区| 欧美日韩在线视频首页| 亚洲国产精品成人va在线观看| 午夜精品久久久久久久白皮肤| 欧美激情日韩| 久久精品国产99国产精品| 国产精品久久久久久影视 | 久久久国产精品亚洲一区| 亚洲精品中文字幕有码专区| 久久综合色8888| 国产一区二区三区日韩| 羞羞视频在线观看欧美| 一区二区三区av| 欧美日韩久久精品| 99精品免费| 亚洲精品乱码久久久久久黑人| 久久中文精品| 在线免费高清一区二区三区| 久久久一二三| 久久都是精品| 国产午夜亚洲精品羞羞网站| 一区二区三区四区五区视频| 欧美激情一区二区三区全黄| 亚洲国产精品v| 免费黄网站欧美| 欧美专区第一页| 狠狠色狠色综合曰曰| 久久只精品国产| 久久亚洲国产精品一区二区 | 欧美网站在线| 亚洲欧美国产一区二区三区| 亚洲视频视频在线| 国产目拍亚洲精品99久久精品| 香蕉成人久久| 久久久无码精品亚洲日韩按摩| 亚洲电影欧美电影有声小说| 欧美a级在线| 欧美区高清在线| 午夜久久影院| 久久精品国产久精国产一老狼| 极品av少妇一区二区| 欧美成人中文字幕| 欧美日韩国产精品一区| 亚洲伊人久久综合| 欧美在线高清| 99国产欧美久久久精品| 亚洲制服av| 亚洲国产经典视频| 一区二区三区视频在线观看| 国产精品国产三级欧美二区| 欧美在线视频免费观看| 狼人社综合社区| 亚洲一区二区3| 久久精品成人一区二区三区| 亚洲精品国产欧美| 亚洲欧美日韩成人高清在线一区| 国内精品嫩模av私拍在线观看| 欧美成人一二三| 国产精品成av人在线视午夜片| 久久久综合免费视频| 欧美区二区三区| 久久精品最新地址| 欧美日韩免费区域视频在线观看| 欧美一区二区视频免费观看| 久久人人看视频| 性欧美xxxx视频在线观看| 六月婷婷一区| 欧美一区二区日韩| 欧美日韩国产a| 欧美96在线丨欧| 国产一区二区三区久久久| 日韩一本二本av| 亚洲日韩视频| 久久不射网站| 欧美一区二区三区四区夜夜大片| 欧美激情aⅴ一区二区三区| 玖玖视频精品| 国产日韩欧美在线| 亚洲视频欧美在线| 亚洲天堂av在线免费| 老牛嫩草一区二区三区日本 | 亚洲电影网站| 欧美视频中文一区二区三区在线观看| 久久免费黄色| 国产精品视频你懂的| 99re6这里只有精品| 亚洲人成人一区二区三区| 欧美一区午夜精品| 欧美一区在线直播| 国产精品一区一区三区| 亚洲精品乱码久久久久久蜜桃91 | 久久久久一区二区三区| 午夜国产精品视频免费体验区| 免费视频最近日韩| 久久久国产精品亚洲一区 | 亚洲欧洲日韩在线| 久久精品亚洲一区二区| 久久久999| 国产精品视频观看| 99视频在线精品国自产拍免费观看| 亚洲黄色成人| 欧美成人精品影院| 欧美jizz19性欧美| 亚洲成人自拍视频| 蜜桃久久av一区| 欧美成人免费全部| 亚洲成色最大综合在线| 久久综合色影院| 欧美成人第一页| 亚洲成人影音| 久久夜色精品国产亚洲aⅴ| 欧美黄色网络| 一本一本大道香蕉久在线精品| 欧美久久综合| 亚洲一区二区三区免费视频| 欧美一区中文字幕| 影院欧美亚洲| 欧美黑人多人双交| 亚洲视频欧美视频| 久久久国产精品一区二区中文| 在线成人欧美| 欧美黄色一级视频| 亚洲美女精品久久| 欧美一区高清| 亚洲黄色天堂| 国产精品第13页| 久久精品国产v日韩v亚洲| 亚洲黄色在线观看| 午夜精品久久久久久久99樱桃| 韩日精品视频一区| 欧美日韩1区2区3区| 亚洲欧美日韩国产综合精品二区| 久久午夜国产精品| 正在播放欧美一区| 国产一区二区三区直播精品电影| 蜜臀91精品一区二区三区| 中日韩视频在线观看| 开元免费观看欧美电视剧网站| 亚洲精品久久久久久久久| 国产精品一区二区三区久久 | 一区二区三区视频在线播放| 狂野欧美一区| 这里只有精品电影| 亚洲国产精品电影| 国产精品五月天| 欧美本精品男人aⅴ天堂| 亚洲先锋成人| 亚洲大胆在线| 国内精品久久久| 国产精品久久激情| 女人天堂亚洲aⅴ在线观看| 亚洲天堂成人| 亚洲精品视频一区| 欧美国产三级| 久久久亚洲成人| 午夜伦理片一区| 一区二区高清|