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

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

D3D Animation Basis(2)

Extending D3DXMESHCONTAINER

Whereas you might be used to using the ID3DXMesh object to contain your mesh data, you may have found
it a pain to store the mesh's material and effects data separately. Not only that, but what about using the other
D3DX mesh objects, such as ID3DXPMesh and ID3DXSkinMesh? Why not just create a single mesh
object that represents all mesh types and contains all material data along with it?

In fact, there is such an object−it's called D3DXMESHCONTAINER! The D3DXMESHCONTAINER object
stores a pointer to your mesh data (regardless of the mesh type used) and all material and effects data. It also
contains pointers to your mesh's adjacency buffer and skinned mesh data object. And as if that wasn't enough,
the D3DXMESHCONTAINER contains pointers to form a linked list of mesh objects.

typedef struct D3DXMESHCONTAINER {
LPSTR Name;
D3DXMESHDATA MeshData;
LPD3DXMATERIAL pMaterials;
LPD3DXEFFECTINSTANCE pEffects;
DWORD NumMaterials;
DWORD * pAdjacency;
LPD3DXSKININFO pSkinInfo;
D3DXMESHCONTAINER * pNextMeshContainer;
} D3DXMESHCONTAINER, *LPD3DXMESHCONTAINER;

What could I possibly do to extend the usefulness of the already nifty D3DXMESHCONTAINER, you ask?
Well, for one thing, D3DXMESHCONTAINER has no default constructor or destructor. Also, textures data is
missing−there's only a buffer that contains the names of the textures to use for the mesh. Last, there's no
support for storing skinned mesh animation data.

No problem, because extending the D3DXMESHCONTAINER is simple! The new version, which I call
D3DXMESHCONTAINER_EX, adds a total of four data objects and three functions. The data objects include
an array of texture objects, a skinned mesh object (to store an animated skinned mesh), and two arrays of
matrix objects.

Here's how I defined the D3DXMESHCONTAINER_EX object, as well as declaring the four variables I
mentioned:

//-------------------------------------------------------------------------------------------
// Declare an extended version of D3DXMESHCONTAINER that contains a constructor and destructor
// as well as an array of textures, a mesh object that contains the generated skin mesh, and
// matrices that map to the frame hierarchy's and for updating bones.
//-------------------------------------------------------------------------------------------
struct D3DXMESHCONTAINER_EX : public D3DXMESHCONTAINER
{
  IDirect3DTexture9** textures;
  ID3DXMesh* skin_mesh;

  D3DXMATRIX** frame_matrices;
  D3DXMATRIX* bone_matrices;

 

The textures array of pointers contains the texture objects used to render the mesh. I build the
textures array up by first loading a mesh and then querying the texture buffer
(D3DXMESHCONTAINER::pMaterials) for the file names of the textures to use.

As for skin_mesh, you only use it when you are using a skinned mesh  You see, when loading a skinned mesh, the actual mesh data is stored in D3DXMESHCONTAINER::MeshData::pMesh. The only problem is, you need another mesh container to store the skinned mesh as it is animated. That is the purpose of skin_mesh.

Last, you'll find frame_matrices and bone_matrices. Not to drag it out, but these are also used for
skinned meshes. Just so it makes sense at this point, a skinned mesh animates by attaching the vertices of the mesh to an underlying hierarchy of bones. As the bones move, so do the vertices. ppFrameMatrices and pBoneMatrices are used to map the vertices to
the bones.

Aside from the variables in D3DXMESHCONTAINER_EX, there are also a few functions. The first two are the
constructor and destructor:

D3DXMESHCONTAINER_EX()
{
  ZeroMemory(this, sizeof(*this));
}

~D3DXMESHCONTAINER_EX()
{
if(textures && NumMaterials)
{
  for(DWORD i = 0; i < NumMaterials; i++)
    release_com(textures[i]);
}

delete[] textures; textures = NULL;
NumMaterials = 0;

delete[] Name; Name = NULL;
delete[] pMaterials; pMaterials = NULL;
delete pEffects; pEffects = NULL;

delete[] pAdjacency; pAdjacency = NULL;
delete[] frame_matrices; frame_matrices = NULL;
delete[] bone_matrices; bone_matrices = NULL;

release_com(MeshData.pMesh);
release_com(pSkinInfo);
release_com(skin_mesh);

delete pNextMeshContainer; pNextMeshContainer = NULL;
}

The constructor and destructor have the task of initializing the data to a known state and releasing the data
used by the object, respectively.  Basically, release_com is a macro that safely releases a COM interface and sets the interface pointer to NULL.

The third function in D3DXMESHCONTAINER_EX is find, which lets you scan the linked list of meshes for
a specifically named mesh, much like D3DXFRAME_EX::find. A quick string compare is used to check the
names, and a recursive call to find is used to scan the entire linked list.

D3DXMESHCONTAINER_EX* find(const char* mesh_name)
{
// return this mesh instance if name matched
if(Name && mesh_name && !strcmp(mesh_name, Name))
  return this;

// scan next in list
if(pNextMeshContainer)
  return ((D3DXMESHCONTAINER_EX*) pNextMeshContainer)->find(mesh_name);

return NULL; // no found
}

And that does it for the helper objects! The D3DXFRAME_EX and D3DXMESHCONTAINER_EX objects are
extremely helpful when it comes to dealing with Direct3D; as such, you should spend as much time as you
can getting used to these two objects. I think you'll find them very useful in your own projects.

Aside from the helper objects, there are a number of helper functions that I'd like to introduce to you, which
should help you alleviate the mundane tasks common to most Direct3D−related projects.


posted on 2008-04-14 09:55 lovedday 閱讀(539) 評論(0)  編輯 收藏 引用


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


公告

導(dǎo)航

統(tǒng)計(jì)

常用鏈接

隨筆分類(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>
            在线免费观看日本欧美| 最新日韩精品| 欧美在线啊v一区| 亚洲欧美日韩精品久久奇米色影视| 欧美日韩免费精品| 亚洲欧美日韩国产另类专区| 亚洲午夜羞羞片| 国产麻豆成人精品| 欧美一区二区三区啪啪| 欧美一区二区三区日韩| 狠狠操狠狠色综合网| 欧美成人精品一区二区| 欧美黑人国产人伦爽爽爽| 亚洲特级毛片| 在线视频欧美一区| 狠狠色丁香婷婷综合| 欧美激情精品久久久六区热门 | 亚洲电影免费在线| 欧美电影电视剧在线观看| 一区二区三区黄色| 亚洲专区在线视频| 亚洲激情成人在线| 亚洲桃色在线一区| 悠悠资源网亚洲青| 亚洲美女黄色片| 国产欧美 在线欧美| 欧美护士18xxxxhd| 国产精品素人视频| 欧美激情网站在线观看| 国产精品日韩在线一区| 欧美高清你懂得| 国产精品国内视频| 欧美激情亚洲一区| 国产日韩1区| 亚洲免费电影在线观看| 伊人精品久久久久7777| 99视频国产精品免费观看| 国语对白精品一区二区| 最新国产成人在线观看| 精品不卡一区| 午夜精品国产| 亚洲视频一二| 99精品视频一区二区三区| 亚洲制服少妇| 欧美激情第六页| 国产精品一区二区你懂得| 亚洲国产精品va在线看黑人 | 在线一区二区三区四区五区| 在线观看久久av| 亚洲欧美另类综合偷拍| 亚洲午夜久久久久久尤物 | 亚洲欧洲午夜| 亚洲国产成人tv| 久久久91精品国产一区二区精品| 在线中文字幕日韩| 欧美剧在线观看| 亚洲国产综合在线看不卡| 在线日韩精品视频| 欧美在线一二三四区| 亚洲欧美日韩一区在线观看| 欧美日韩视频| 日韩视频一区二区| 一区二区成人精品| 欧美日韩国产精品 | 久久裸体视频| 国产欧美欧美| 欧美一区91| 久久综合给合久久狠狠狠97色69| 国产网站欧美日韩免费精品在线观看 | 狠狠色伊人亚洲综合网站色| 西瓜成人精品人成网站| 欧美一区国产一区| 国产精品自拍在线| 欧美一区二区视频在线观看| 久久狠狠一本精品综合网| 国产亚洲成av人在线观看导航| 亚洲综合色激情五月| 欧美在线1区| 在线观看日韩av先锋影音电影院| 久热精品视频在线| 亚洲国产精品高清久久久| 91久久精品久久国产性色也91| 欧美91福利在线观看| 亚洲乱码国产乱码精品精天堂| 亚洲一区二区三区视频| 国产精品久久久久久亚洲调教| 亚洲欧美日韩综合国产aⅴ| 欧美在线一级va免费观看| 国产欧美视频在线观看| 久久久久久一区| 亚洲激情亚洲| 香蕉成人久久| 亚洲高清不卡在线| 欧美日本二区| 欧美一区激情| 亚洲黄色免费网站| 亚洲女女女同性video| 黄网动漫久久久| 欧美精品免费观看二区| 亚洲欧美国产一区二区三区| 蜜桃av一区| 亚洲午夜激情网站| 狠狠做深爱婷婷久久综合一区| 欧美激情1区2区| 欧美在线一二三| 亚洲精品乱码久久久久久日本蜜臀 | 亚洲人永久免费| 国产精品亚洲视频| 欧美成人性生活| 欧美在线视频在线播放完整版免费观看| 欧美大片在线观看一区| 亚洲无线视频| 亚洲国产日韩欧美在线动漫| 国产精品日韩精品| 欧美大片免费观看| 香蕉国产精品偷在线观看不卡| 欧美激情91| 久久综合给合久久狠狠狠97色69| 亚洲天堂黄色| 91久久综合亚洲鲁鲁五月天| 国产精品午夜在线| 欧美日韩成人综合| 久久综合五月天婷婷伊人| 亚洲午夜精品17c| 亚洲区在线播放| 免费av成人在线| 久久久久久久精| 亚洲欧美春色| 亚洲一二三区在线| 99精品国产一区二区青青牛奶| 一区精品久久| 国产亚洲一区精品| 国产九九精品| 国产精品综合| 国产精品日韩电影| 国产精品mm| 国产精品高精视频免费| 欧美日韩小视频| 欧美视频不卡| 欧美午夜在线视频| 欧美性色aⅴ视频一区日韩精品| 欧美另类变人与禽xxxxx| 理论片一区二区在线| 久久综合九色综合久99| 久久婷婷丁香| 六月天综合网| 欧美高清你懂得| 欧美人成在线视频| 欧美日韩精品欧美日韩精品| 欧美激情视频在线免费观看 欧美视频免费一| 久久亚洲一区二区| 久久综合狠狠综合久久综青草| 久久久久久久波多野高潮日日 | 亚洲一区二区伦理| 亚洲一区二三| 欧美综合二区| 麻豆精品视频在线观看视频| 美女尤物久久精品| 欧美久久久久免费| 欧美日韩亚洲视频| 国产精品视频大全| 韩国一区电影| 亚洲美女福利视频网站| 一区二区三区高清在线观看| 亚洲一区免费视频| 欧美影院精品一区| 美女视频黄a大片欧美| 亚洲黄一区二区| 亚洲夜间福利| 老司机免费视频久久| 欧美美女日韩| 国产欧美一区二区精品忘忧草 | 国产精品日韩电影| 伊人久久综合| 国产精品99久久久久久人| 欧美在线视频观看| 欧美激情综合| 亚洲一区二区三区久久 | 91久久精品一区| 亚洲视频综合| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美三级网页| 在线观看欧美日本| 亚洲午夜激情网页| 玖玖玖国产精品| 一区二区三区精品久久久| 久久久久久久高潮| 欧美性jizz18性欧美| 伊人成人在线| 亚洲免费视频中文字幕| 欧美风情在线| 亚洲综合成人婷婷小说| 欧美mv日韩mv国产网站| 国产又爽又黄的激情精品视频| 99视频在线观看一区三区| 欧美一级理论片| av成人免费观看| 欧美1区免费| 一区二区三区中文在线观看| 亚洲男同1069视频|