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

天行健 君子當(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>
            国产亚洲精品久久久| 国产欧美日韩一区二区三区在线观看 | 亚洲美女尤物影院| 亚洲国产一区二区三区青草影视| 噜噜噜噜噜久久久久久91| 亚洲国产精品成人综合| 亚洲激情精品| 国产精品裸体一区二区三区| 久久激情视频| 欧美成人午夜剧场免费观看| 在线一区二区日韩| 午夜日韩在线| 日韩视频精品在线观看| 亚洲尤物精选| 亚洲激情六月丁香| 亚洲午夜电影在线观看| 亚洲成色www8888| 国产精品影片在线观看| 欧美激情成人在线视频| 亚洲免费成人av| 国产精品爽黄69| 一区二区三区免费网站| 国产精品久久午夜夜伦鲁鲁| 久久精品视频在线播放| 米奇777在线欧美播放| 亚洲天堂av综合网| 久久久久这里只有精品| 日韩午夜激情av| 久久不见久久见免费视频1| 亚洲日本无吗高清不卡| 亚洲永久精品大片| 亚洲免费观看| 久久丁香综合五月国产三级网站| 国产精品啊啊啊| 免费成人高清| 在线观看亚洲专区| 亚洲一区二区在线播放| 一区二区精品在线| 亚洲承认在线| 欧美一级视频免费在线观看| av成人手机在线| 欧美成人免费va影院高清| 欧美一区二区视频97| 欧美日韩国产va另类| 欧美大尺度在线| 国产在线拍偷自揄拍精品| 亚洲图片欧美午夜| 中文日韩欧美| 欧美激情中文字幕乱码免费| 免费h精品视频在线播放| 国产毛片精品国产一区二区三区| 亚洲激情另类| 99国产精品视频免费观看一公开| 理论片一区二区在线| 久久性色av| 国产在线欧美日韩| 久久精品亚洲精品| 久久人人爽人人| 激情一区二区三区| 久久精品日韩一区二区三区| 久久久www成人免费毛片麻豆| 国产伦精品一区二区三区高清版| 99精品视频免费观看视频| 99日韩精品| 欧美日韩亚洲成人| 99精品黄色片免费大全| 亚洲欧美资源在线| 国产精品区一区| 午夜伦理片一区| 蜜桃视频一区| 亚洲精品视频在线| 欧美视频网站| 亚洲伊人伊色伊影伊综合网| 亚洲欧美日韩国产一区二区三区| 国产精品日韩精品| 久久www成人_看片免费不卡| 久久久亚洲国产美女国产盗摄| 国产欧美一区二区三区沐欲| 欧美一区二区久久久| 欧美成人dvd在线视频| 久久er99精品| 最近中文字幕日韩精品 | 国产精品一香蕉国产线看观看 | 欧美a级片一区| 亚洲日韩欧美视频| 国产精品九九| 久久九九国产精品| 91久久午夜| 欧美在线播放| 最新69国产成人精品视频免费| 欧美精品一区二区三区在线看午夜| 99国产精品久久久久老师| 欧美中文字幕在线观看| 亚洲国内欧美| 国产精品久久久久久久久久免费| 性欧美办公室18xxxxhd| 欧美成人精品在线视频| 日韩视频在线一区二区| 国产精品国产三级国产普通话99| 欧美亚洲三区| 亚洲日本视频| 久久婷婷国产麻豆91天堂| 亚洲精品免费在线观看| 国产欧美三级| 欧美韩日一区| 久久精品欧洲| 亚洲在线不卡| 亚洲黄色成人| 久久综合网hezyo| 亚洲综合色自拍一区| 91久久久久久久久久久久久| 国产精品三级视频| 欧美人成在线| 久久久91精品国产一区二区三区| 欧美成人免费在线| 亚洲先锋成人| 亚洲人成网站999久久久综合| 国产伦精品免费视频| 欧美日韩精品久久| 美女亚洲精品| 久久久久久亚洲精品中文字幕| 夜夜躁日日躁狠狠久久88av| 欧美激情一区二区在线| 久久人人97超碰人人澡爱香蕉 | 国产精品亚洲а∨天堂免在线| 欧美成人精品在线观看| 久久久久久久999精品视频| 亚洲综合社区| 亚洲网站在线播放| 日韩午夜av| 亚洲精品国产系列| 亚洲国产91| 亚洲高清不卡在线| 欧美国产亚洲精品久久久8v| 久久婷婷影院| 久久天天躁夜夜躁狠狠躁2022 | 亚洲视频一区二区免费在线观看| 亚洲精品免费观看| 亚洲欧洲日本在线| 亚洲国产精品成人综合色在线婷婷| 国产亚洲欧洲997久久综合| 国产精品自在欧美一区| 国产伦精品一区二区| 国产欧美精品日韩区二区麻豆天美| 国产精品高潮呻吟视频| 国产精品高潮呻吟久久| 国产精品视频免费一区| 国产精品自拍在线| 黄色精品免费| 影音先锋日韩有码| 亚洲精品国产精品国自产观看浪潮| 在线观看日韩av| 亚洲韩日在线| 一区二区成人精品| 亚洲欧美日韩综合aⅴ视频| 欧美一站二站| 老牛嫩草一区二区三区日本| 免费日韩视频| 日韩视频一区二区在线观看| 亚洲视频中文字幕| 欧美制服丝袜| 欧美韩国日本一区| 国产精品乱码一区二三区小蝌蚪| 国产精品一区二区三区观看| 国产综合av| 亚洲剧情一区二区| 欧美一区二区三区在线看 | 日韩一级免费观看| 午夜精品一区二区三区在线播放| 久久精品视频网| 亚洲国产小视频| 亚洲欧美日韩一区二区| 久久婷婷国产麻豆91天堂| 欧美人与性禽动交情品 | 久久亚洲一区二区| 欧美日韩国产免费| 黄色资源网久久资源365| 一本不卡影院| 亚洲小少妇裸体bbw| 欧美 日韩 国产在线| av不卡在线观看| 亚洲成人在线视频播放| 亚洲日本va在线观看| 国产伦精品一区二区三区在线观看 | 国产精品免费在线| 狠狠久久亚洲欧美| 在线综合亚洲| 欧美激情第4页| 亚洲欧美中文日韩v在线观看| 男人的天堂亚洲| 国产欧美91| 亚洲午夜精品一区二区| 久久综合久色欧美综合狠狠 | 一区二区免费在线观看| 久久免费视频在线| 国产日韩综合| 亚洲欧美成人一区二区三区| 欧美激情第10页| 久久久综合精品| 国产午夜久久|