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

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

Working with skeletal animation(6)

Mapping Bones to Frames

If you peruse an .X file, you might notice some similarities between the Frame data objects and the SkinWeights objects. For every bone in your skeletal structure, there is a matching SkinWeights object embedded inside a Mesh object that contains the name of a Frame object (or a reference to a Frame object). That's right−each bone is named after its corresponding Frame data object!

After you load your skinned mesh, you need to connect each bone to its corresponding frame. This is simply a matter of iterating all bones, getting the name of each, and searching the list of frames for a match. Each matching frame pointer is stored in a special bone structure of your design.

I embedded the bone−mapping data in the D3DXMESHCONTAINER_EX structure. The D3DXMESHCONTAINER_EX structure adds an array of texture objects, a secondary mesh container object, and the bone−mapping data to the D3DXMESHCONTAINER structure.

struct D3DXMESHCONTAINER_EX : D3DXMESHCONTAINER
{
  IDirect3DTexture9 **pTextures;
  ID3DXMesh *pSkinMesh;
  D3DXMATRIX **ppFrameMatrices;
  D3DXMATRIX *pBoneMatrices;

  // .. extra data and functions to follow
};

For this chapter, the important variables are ppFrameMatrices and pBoneMatrices. The pBoneMatrices array contains the transformations from your bone hierarchy; one transformation matrix is applied to each vertex belonging to the appropriate bone. The only problem is, the transformations from your bones are not stored in an array; they're stored as a hodgepodge of single transformations spread throughout the hierarchy.

The D3DXMESHCONTAINER_EX structure provides a pointer to each bone transformation matrix contained within the hierarchy of D3DXFRAME_EX objects inside an array of pointers (ppFrameMatrices). Using these pointers, you can pull each bone transformation and place it into the pBoneMatrices array you'll create and use during the call to update your skinned mesh.

You can create the array of pointers and the array of matrices after you load the bone hierarchy by taking the number of bones from the hierarchy and allocating an array of D3DXMATRIX pointers and D3DXMATRIX objects, like this:

// pSkinInfo = skinned mesh object

// Get the number of bones in the hierarchy
DWORD NumBones = pSkinInfo−>GetNumBones();

// Allocate an array of D3DXMATRIX pointers to point to each bones' transformation.
D3DXMATRIX *ppFrameMatrices = new D3DXMATRIX*[NumBones];

// Allocate an array of D3DXMATRIX matrix objects to contain the actual transformations
// used to update the skinned mesh.
D3DXMATRIX *pBoneMatrices = new D3DXMATRIX[NumBones];

After you load your skinned mesh, you can set up the pointers to each bone transformation by querying the skinned mesh info object for each bone name. Using that, you can scan the list of frames for a match. For each matched bone, set the pointer to that frame's transformation matrix. When all bones and frames are matched up, you can then iterate the entire list and copy the matrices to the pBoneMatrices array.

First let me show you how to match up the bones and frames. Remember that earlier in this chapter I mentioned that the bones are named after the frames. Using the ID3DXSkinInfo::GetBoneName function, you can obtain the name of the bone and frame to match.

// Go through each bone and grab the name of each to work with
for(DWORD i=0;i<pSkinInfo−>GetNumBones();i++) {
  // Get the bone name
  const char *BoneName = pSkinInfo−>GetBoneName(i);

When you have the bone's name, you can scan through the list of frames in the hierarchy to look for a match. To do so, you use the recursive FindFrame function developed in the "Modifying Bone Orientation" section earlier in this chapter, as follows.

// pRootFrame = D3DXFRAME_EX root frame object

// Find matching name in frames
D3DXFRAME_EX *pFrame = pRootFrame−>Find(BoneName);

If a frame with the name provided by the bone is found, you can link to the frame's combined transformation matrix. If no match is found, then the link is set to NULL.

// Match frame to bone
if(pFrame)
  pMesh−>ppFrameMatrices[i] = &pFrame−>matCombined;
else
  pMesh−>ppFrameMatrices[i] = NULL;
}

You might not understand the exact reasons for mapping the bones to the frame at this moment, but it will make more sense when you get into manipulating the skinned mesh and rebuilding the mesh to render it. For now, take each step in stride, and start by learning how to manipulate the skinned mesh.

 

Manipulating the Skinned Mesh

Now nothing is stopping you from twisting up that skeletal structure and going crazy. Just make sure it's your mesh's imaginary skeletal structure you're manipulating and not your own−I just hate it when I accidentally manipulate my bones into a pose I can't get out of for an hour! Kidding aside, you can now alter the frame orientations in your frame hierarchy. It's those frames that represent your bones.

Speaking of altering the frame orientations, be aware that you should only rotate your bones; you should never translate them. Scaling is acceptable, but be careful−remember that all transformations propagate throughout the hierarchy. If you were to scale your character's upper arm, the lower arm would be scaled as well.

I covered changing the orientations of the various bones earlier in this chapter, in the "Modifying Bone Orientation" section, so I won't rehash anything here. After you've loaded the skeletal structure and skinned mesh, feel free to start working with the bone transformations using those techniques covered earlier. When you're ready, you can update the skinned mesh and prepare it for rendering.


posted on 2008-04-23 19:39 lovedday 閱讀(271) 評論(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>
            久久青青草综合| 亚洲精品一区二区三区婷婷月| 国产精品一区二区三区观看| 亚洲国产精品一区二区三区| 久久这里只有| 欧美成人综合网站| 亚洲欧洲日产国码二区| 欧美黄色精品| 欧美日韩国产综合久久| 亚洲欧美不卡| 欧美在线不卡视频| 国产毛片精品国产一区二区三区| 韩国美女久久| 亚洲三级免费电影| 欧美日韩免费在线| 欧美一级免费视频| 亚洲欧美日韩另类| 欧美一区二区在线播放| 伊人一区二区三区久久精品| 欧美成人高清视频| 国产精品国产三级欧美二区| 欧美一区二区国产| 欧美久久影院| 另类av导航| 国产精品乱码妇女bbbb| 免费亚洲婷婷| 欧美手机在线| 欧美激情亚洲激情| 一区二区在线视频播放| 亚洲精品乱码| 亚洲精品男同| 久久精品亚洲一区二区| 国模精品一区二区三区| 欧美综合第一页| 一区二区三区四区五区精品视频 | 亚洲国产高清视频| 欧美韩日一区二区三区| 性久久久久久久久久久久| 久久夜色精品国产欧美乱极品 | 香蕉久久一区二区不卡无毒影院| 午夜免费在线观看精品视频| 欧美+亚洲+精品+三区| 欧美专区一区二区三区| 欧美剧在线免费观看网站| 老色批av在线精品| 黑人中文字幕一区二区三区| 久久精品视频va| 国产精品成人v| 亚洲欧洲精品成人久久奇米网 | 亚洲无亚洲人成网站77777 | 国内精品久久久久影院 日本资源| 亚洲国产精品一区| 日韩亚洲视频在线| 欧美成年人网站| 最近看过的日韩成人| 日韩亚洲欧美高清| 国产精品一区二区三区四区五区 | 欧美激情在线| 亚洲欧美日韩中文视频| 国产日韩欧美综合精品| 乱码第一页成人| 亚洲免费视频网站| 久久五月激情| 亚洲影音一区| 亚洲国内精品| 国产亚洲第一区| 欧美日本精品一区二区三区| 亚洲精品一区中文| 亚洲第一伊人| 欧美日韩国产123| 性色av一区二区三区在线观看| 蜜桃av一区二区| 久久成人免费电影| 亚洲一区二区在线视频| 亚洲三级影片| 伊人久久亚洲美女图片| 国产婷婷一区二区| 国产精品国产三级国产专播精品人| 欧美不卡三区| 老司机精品导航| 亚洲一区免费观看| 亚洲欧美高清| 亚洲一区一卡| 久久精品一区二区| 久久久久久久久蜜桃| 久久激情五月激情| 久久爱www久久做| 久久免费高清视频| 欧美成人免费大片| 91久久精品国产91久久| 亚洲人体大胆视频| 一区二区三区三区在线| 性做久久久久久久免费看| 午夜视频久久久久久| 久久久久免费视频| 欧美激情偷拍| 国产欧美精品va在线观看| 好吊一区二区三区| 亚洲乱码精品一二三四区日韩在线| 亚洲最新视频在线播放| 欧美一区免费| 亚洲三级性片| 久久久视频精品| 欧美丝袜一区二区| 91久久久亚洲精品| 欧美一级片一区| 亚洲福利在线视频| 久久精品1区| 欧美日韩一区自拍| 在线日韩av片| 午夜宅男欧美| 日韩亚洲国产欧美| 欧美精品电影| 亚洲精品婷婷| 亚洲第一免费播放区| 99精品视频免费| 欧美岛国在线观看| 黄色国产精品| 中国av一区| 日韩一区二区久久| 久久久久久久久久久久久久一区| 一个色综合av| 亚洲精品乱码久久久久久蜜桃麻豆 | 亚洲免费不卡| 蜜桃精品一区二区三区| 亚洲国产精品久久久| 欧美搞黄网站| 美女91精品| 亚洲精品激情| 夜色激情一区二区| 国产精品婷婷午夜在线观看| 一区二区三区国产精品| 99v久久综合狠狠综合久久| 欧美日韩精品一区二区在线播放 | 欧美国产精品人人做人人爱| 国产精品永久在线| 性色av香蕉一区二区| 欧美呦呦网站| 亚洲动漫精品| 欧美大片在线看免费观看| 久久久久国色av免费观看性色| 在线日韩电影| 亚洲理论在线观看| 国产视频一区二区在线观看| 免播放器亚洲| 国产精品久久久久久久一区探花 | 一本久道久久久| 性欧美videos另类喷潮| 亚洲国产美国国产综合一区二区| 亚洲免费观看高清完整版在线观看熊| 国产精品日产欧美久久久久| 欧美成人资源| 狠狠色狠狠色综合日日五| 99视频日韩| 一区二区日韩精品| 老司机免费视频久久| 欧美亚男人的天堂| 亚洲毛片网站| 日韩手机在线导航| 免费日本视频一区| 欧美成人精品不卡视频在线观看| 国产精品天美传媒入口| 免费在线成人av| 国产精品美女黄网| 久久一综合视频| 欧美韩日高清| 91久久国产综合久久蜜月精品| 小嫩嫩精品导航| 久久久.com| 激情五月婷婷综合| 久久精品在线| 亚洲高清激情| 99综合视频| 国产精品私房写真福利视频| 99综合精品| 亚洲欧美日韩网| 国产色爱av资源综合区| 午夜视频在线观看一区| 久热精品视频在线观看| 日韩午夜电影| 国产精品国产三级国产aⅴ入口| 亚洲欧美视频一区| 美女国产一区| 一区二区三区www| 国产欧美日韩一区二区三区在线| 亚洲综合导航| 91久久夜色精品国产网站| 日韩一级欧洲| 黑丝一区二区| 国产精品欧美一区喷水| 久久九九免费视频| 一区二区三区|亚洲午夜| 老鸭窝毛片一区二区三区 | 一区二区三区精品久久久| 国产亚洲美州欧州综合国| 欧美成人精品激情在线观看| 亚洲视频在线播放| 亚洲三级免费电影| 亚洲第一久久影院| 欧美激情精品久久久久久|