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

天行健 君子當自強而不息

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


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   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>
            日韩午夜在线电影| 欧美日韩 国产精品| 蜜桃精品久久久久久久免费影院| 这里只有精品在线播放| 一区二区高清视频| 亚洲一级黄色片| 中日韩美女免费视频网站在线观看| 亚洲日本精品国产第一区| 91久久精品美女高潮| 一区二区精品国产| 亚洲尤物视频在线| 久久精品国产综合精品| 久久人人爽人人爽| 亚洲国产精品一区二区久| 你懂的国产精品| 亚洲日本理论电影| 亚洲尤物视频在线| 久久精品99久久香蕉国产色戒| 久久一区二区三区国产精品| 欧美大片一区二区三区| 欧美日韩三级视频| 国内精品嫩模av私拍在线观看 | 久久精品国产成人| 久久伊人一区二区| 国产精品igao视频网网址不卡日韩| 国产精一区二区三区| 在线观看91精品国产麻豆| 99re这里只有精品6| 另类欧美日韩国产在线| 日韩一级不卡| 欧美有码在线观看视频| 欧美国产国产综合| 国产精品伊人日日| 99国产精品99久久久久久| 欧美在线综合| 亚洲毛片视频| 久久亚洲精品一区| 国产农村妇女精品一区二区| 亚洲乱码久久| 欧美成人一区二区三区| 亚洲欧美中文在线视频| 欧美日韩国产综合视频在线观看中文 | 免费高清在线视频一区·| 国产精品萝li| 亚洲无线一线二线三线区别av| 男女激情久久| 久久国产精品久久精品国产| 国产精品第一页第二页第三页| 最新成人av网站| 欧美jizzhd精品欧美喷水| 性视频1819p久久| 欧美日韩精品免费在线观看视频| 在线观看亚洲视频| 久久久综合视频| 亚欧成人精品| 国产欧美一区二区精品仙草咪| 一区二区三区视频免费在线观看 | 美日韩精品视频| 欧美一区二区三区成人| 国产精品国产三级欧美二区| 一区二区三区蜜桃网| 亚洲国产一区二区视频| 久久夜色精品国产| 一区二区亚洲精品| 狂野欧美一区| 久久亚洲捆绑美女| 亚洲激情影视| 亚洲精品美女91| 欧美日韩视频免费播放| 这里只有视频精品| 亚洲香蕉在线观看| 国产日韩欧美在线一区| 久久国产精品网站| 久久精品国产视频| 亚洲欧洲日产国产网站| 亚洲欧洲日韩女同| 国产精品magnet| 欧美伊久线香蕉线新在线| 亚洲欧美另类中文字幕| 好男人免费精品视频| 免费久久久一本精品久久区| 在线午夜精品| 在线观看欧美黄色| 亚洲伦理在线| 欧美一区二区啪啪| 亚洲成色精品| 欧美1区2区| 亚洲女女做受ⅹxx高潮| 久久综合五月| 国内成人在线| 久久福利视频导航| 亚洲电影激情视频网站| 一本久久精品一区二区| 国产精品美女久久久免费| 欧美在线视频日韩| 亚洲国产福利在线| 欧美一区二区三区四区在线观看地址 | 精品二区久久| 美女国产一区| 亚洲宅男天堂在线观看无病毒| 久久久综合精品| 亚洲欧美高清| 一本色道久久综合亚洲91| 亚洲国产高清在线| 欧美视频不卡| 亚洲精品久久嫩草网站秘色| 国产精品扒开腿做爽爽爽软件| 久久久久久久性| 国产精品久久久一区二区| 99精品久久免费看蜜臀剧情介绍| 亚洲在线电影| 久久综合伊人77777蜜臀| 一区二区三区四区精品| 国产一区二区精品久久91| 亚洲一区二区在线免费观看| 欧美主播一区二区三区| 国产综合色产| 最新国产の精品合集bt伙计| 日韩亚洲国产欧美| 久久中文字幕一区二区三区| 国产日韩一区二区三区| 久久天堂国产精品| 国产麻豆视频精品| 欧美在线关看| 亚洲专区欧美专区| 欧美精品在线播放| 久久视频在线看| 亚洲视频网在线直播| 欧美日本韩国一区| 欧美国产日韩视频| 亚洲视频 欧洲视频| 精品69视频一区二区三区| 欧美中文字幕视频在线观看| 亚洲激情第一页| 91久久亚洲| 性久久久久久久久| 猛干欧美女孩| 国产精品久久国产三级国电话系列| 欧美视频在线视频| 一区二区在线不卡| 9色porny自拍视频一区二区| 午夜精品久久久久久久久久久久久 | 欧美在线欧美在线| 欧美日韩国产精品自在自线| 久久久久久久久久久久久久一区 | 国产欧美一级| 日韩写真视频在线观看| 久久全球大尺度高清视频| 一本色道久久综合狠狠躁篇的优点 | 久久久久网站| 亚洲视频在线观看| 欧美日韩综合网| 日韩一级在线观看| 亚洲电影在线| 老鸭窝亚洲一区二区三区| 国产日韩精品一区二区三区| 在线一区二区三区四区五区| 欧美多人爱爱视频网站| 久久精品亚洲国产奇米99| 国产亚洲人成a一在线v站| 久久精品色图| 麻豆av福利av久久av| 亚洲二区三区四区| 亚洲电影免费观看高清完整版在线观看 | 亚洲天堂偷拍| 亚洲视频大全| 国产日韩欧美自拍| 久久一综合视频| 免费在线国产精品| 亚洲一区二区少妇| 欧美专区第一页| 国产精品欧美日韩一区| 亚洲综合国产精品| 性欧美超级视频| 136国产福利精品导航网址| 亚洲国产欧美久久| 国产精品久久久一本精品| 久久久久国产精品午夜一区| 欧美成ee人免费视频| 国产精品盗摄久久久| 久久国产精品网站| 欧美黄色片免费观看| 欧美一区午夜视频在线观看| 老色批av在线精品| 亚洲欧美国产77777| 国产精品www994| 91久久精品久久国产性色也91| 亚洲精品视频在线播放| 在线播放一区| 久久激情视频免费观看| 午夜在线精品偷拍| 国产精品国产三级国产普通话99| 欧美成人午夜免费视在线看片| 国产日韩一区二区三区在线播放| 日韩午夜三级在线| 午夜精品视频| 国产精品一区二区久久久久| 亚洲视频精品| 久久久久久久国产| 亚洲高清一二三区|