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

天行健 君子當自強而不息

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 閱讀(275) 評論(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>
            国产精品精品视频| 欧美激情第1页| 国产日韩av一区二区| 一区二区免费在线视频| 亚洲美女免费精品视频在线观看| 蜜臀va亚洲va欧美va天堂| 亚洲国产日本| 91久久久精品| 欧美日韩国产综合久久| 一区二区欧美在线| 亚洲一区在线直播| 激情欧美日韩| 亚洲精品乱码久久久久久| 欧美日韩裸体免费视频| 午夜精品一区二区三区在线| 亚洲欧美日本另类| 影音先锋一区| 亚洲欧洲一区二区三区| 国产精品入口尤物| 欧美日韩国产一区| 亚洲主播在线播放| 欧美影片第一页| 亚洲乱码国产乱码精品精| 宅男精品视频| 在线观看免费视频综合| 亚洲日本激情| 国产午夜精品全部视频在线播放| 久久综合九色综合欧美就去吻| 美女免费视频一区| 欧美诱惑福利视频| 欧美成va人片在线观看| 午夜激情久久久| 老鸭窝毛片一区二区三区| 在线亚洲成人| 麻豆91精品91久久久的内涵| 亚洲图片在线| 美女999久久久精品视频| 亚洲永久精品国产| 麻豆精品网站| 欧美一区日韩一区| 欧美日韩一卡二卡| 欧美jizzhd精品欧美巨大免费| 亚洲天堂av高清| 亚洲国产清纯| 欧美一区二区日韩一区二区| 99热这里只有成人精品国产| 久久久久久伊人| 欧美一级播放| 国产精品v一区二区三区 | 欧美美女日韩| 久久伊人一区二区| 国产精品视频九色porn| 亚洲精品在线一区二区| 亚洲国产女人aaa毛片在线| 午夜国产精品视频| 亚洲欧美在线一区| 欧美日韩喷水| 亚洲精品国产拍免费91在线| 在线成人亚洲| 欧美中文在线字幕| 久久精品一二三| 国产色婷婷国产综合在线理论片a| 亚洲精品自在在线观看| 亚洲免费av观看| 欧美成人激情在线| 亚洲国产视频一区| 亚洲国产婷婷香蕉久久久久久| 久久久久久69| 麻豆91精品| 亚洲电影免费在线观看| 久久免费精品视频| 免费成人美女女| 亚洲第一精品福利| 另类专区欧美制服同性| 欧美激情精品久久久久久蜜臀| 在线免费一区三区| 麻豆成人在线| 亚洲日韩视频| 亚洲一区二区三区视频播放| 欧美日韩精品伦理作品在线免费观看| 亚洲国产精品久久久久秋霞蜜臀| 亚洲日本欧美| 欧美日韩国产在线观看| 一区二区三区视频在线播放| 亚洲欧美www| 国内成人自拍视频| 老司机精品福利视频| 亚洲黄页视频免费观看| 亚洲一区二区在线| 国产日韩一区二区三区在线| 久久国内精品自在自线400部| 蜜臀av性久久久久蜜臀aⅴ四虎| 亚洲国产成人不卡| 欧美日韩福利| 性欧美在线看片a免费观看| 麻豆精品一区二区综合av| 亚洲日韩欧美视频| 国产精品成人一区二区艾草| 亚洲欧美日韩人成在线播放| 久久裸体艺术| 一区二区激情视频| 国语自产在线不卡| 欧美精品粉嫩高潮一区二区| 在线亚洲+欧美+日本专区| 久久久亚洲综合| 日韩网站在线| 黄色精品一区| 欧美午夜剧场| 久久夜色精品国产欧美乱极品| 99国产欧美久久久精品| 久久久久久久久综合| 亚洲精品综合| 国内精品视频一区| 欧美日韩欧美一区二区| 久久久久中文| 亚洲一区二区在线免费观看视频| 欧美国产先锋| 久久久精品日韩| 亚洲一区亚洲二区| 亚洲人精品午夜| 国产一区久久| 国产精品私拍pans大尺度在线| 麻豆精品传媒视频| 欧美一区久久| 亚洲一区二区三区高清| 亚洲国产一区二区三区在线播 | 国产精品一二三四| 欧美大片在线观看一区| 久久精品人人| 亚洲欧美综合精品久久成人| 亚洲精品日本| 亚洲国产日韩欧美一区二区三区| 久久激情五月婷婷| 午夜精品福利电影| 亚洲影院色无极综合| 99综合在线| 9l国产精品久久久久麻豆| 在线观看福利一区| 在线观看欧美亚洲| 激情久久五月| 伊人久久久大香线蕉综合直播| 国产欧美日韩视频一区二区| 国产精品多人| 国产精品www| 国产精品免费看久久久香蕉| 欧美日韩在线不卡一区| 欧美日一区二区三区在线观看国产免| 亚洲国产精品99久久久久久久久| 久久免费黄色| 久久香蕉国产线看观看av| 久久资源在线| 亚洲国产精品一区二区www| 亚洲欧美三级在线| 亚洲欧美一区二区三区在线| 一区二区日韩免费看| 一区二区三区国产盗摄| 夜夜夜久久久| 亚洲一区二区少妇| 午夜天堂精品久久久久| 欧美影院在线| 老司机一区二区| 亚洲电影成人| 在线亚洲观看| 欧美在线高清| 欧美成人在线网站| 欧美性猛交xxxx乱大交退制版| 国产精品家庭影院| 狠狠色噜噜狠狠狠狠色吗综合| 韩日欧美一区| 日韩午夜av电影| 香蕉久久国产| 欧美ed2k| 一本色道久久加勒比88综合| 午夜精彩国产免费不卡不顿大片| 久久成人羞羞网站| 欧美激情一区二区三区在线| 欧美视频在线免费| 韩国久久久久| 亚洲视频在线观看视频| 欧美在线日韩| 亚洲国产精品一区二区第一页 | 欧美高清不卡| 一区二区久久| 久久久久欧美精品| 欧美日韩在线直播| 红桃视频亚洲| 在线亚洲一区| 欧美不卡一卡二卡免费版| 日韩视频在线免费| 久久综合色天天久久综合图片| 欧美日韩综合精品| 亚洲高清在线观看一区| 亚欧成人在线| 最新日韩av| 久久精品国产99| 国产精品乱码久久久久久| 亚洲成人资源网| 久久成人免费电影| 妖精视频成人观看www| 美女视频黄免费的久久|