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

天行健 君子當自強而不息

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


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   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>
            亚洲福利国产精品| 性欧美video另类hd性玩具| 亚洲乱亚洲高清| 欧美激情网站在线观看| 91久久中文| 一区二区三区免费观看| 欧美视频在线视频| 亚洲自拍偷拍视频| 蜜桃伊人久久| 99精品欧美| 国产伦一区二区三区色一情| 久久成人免费电影| 欧美va日韩va| 亚洲视屏一区| 国产欧美一区二区三区久久 | 91久久久久| 亚洲综合国产| 激情视频亚洲| 欧美日韩国产一区二区三区地区| 一区二区三区国产盗摄| 欧美片在线观看| 一本色道久久99精品综合| 欧美国产成人在线| 一区二区高清视频在线观看| 国产精品制服诱惑| 免费亚洲一区| 午夜免费久久久久| 亚洲第一中文字幕在线观看| 亚洲欧美大片| 亚洲精品三级| 国产一区二区精品丝袜| 欧美精品国产一区| 欧美自拍偷拍午夜视频| 亚洲精品一区二区三区福利| 欧美一区免费| 一区二区三区欧美视频| 黄网站色欧美视频| 国产精品欧美日韩久久| 欧美成人视屏| 久久精品亚洲| 亚洲免费视频一区二区| 亚洲国产美女| 老司机aⅴ在线精品导航| 亚洲男人的天堂在线观看| 亚洲国产精品va在线看黑人| 国产欧美日本一区二区三区| 欧美成人精品在线观看| 欧美中文字幕在线视频| 亚洲一区3d动漫同人无遮挡| 亚洲黄色免费网站| 蜜桃精品一区二区三区 | 性欧美1819sex性高清| 亚洲另类春色国产| 欧美激情第4页| 久久综合激情| 久久精品一区二区国产| 亚洲欧美国产77777| 一片黄亚洲嫩模| 亚洲精品一区二区三区福利| 亚洲高清视频一区二区| 国产综合激情| 国产一区二区在线观看免费播放| 国产精品久久久久久久久借妻| 欧美日韩国产不卡在线看| 蜜臀久久99精品久久久画质超高清| 欧美在线国产| 久久精品国产99| 久久欧美肥婆一二区| 欧美中文字幕在线播放| 久久国产福利| 欧美在线免费观看| 欧美一区影院| 久久久久国产精品一区| 久久精品国亚洲| 久久久亚洲综合| 噜噜噜久久亚洲精品国产品小说| 久久一区二区三区超碰国产精品| 久久精品国产亚洲一区二区三区| 久久成人免费日本黄色| 久久精品91久久香蕉加勒比| 久久成人免费| 欧美1区3d| 欧美激情精品久久久久久免费印度| 欧美福利网址| 欧美日韩一区三区| 国产精品国产三级国产普通话蜜臀| 欧美日韩精品久久久| 欧美性猛交xxxx乱大交退制版 | 亚洲美女在线国产| 亚洲伦伦在线| 亚洲小说区图片区| 午夜精品一区二区在线观看| 久久精品国产免费观看| 美日韩免费视频| 欧美日韩视频在线一区二区观看视频 | 亚洲桃色在线一区| 欧美亚洲一区二区三区| 久久综合给合| 亚洲欧洲在线免费| 亚洲一区二区成人| 久久久久久婷| 欧美日韩精品欧美日韩精品| 国产精品乱码| 在线日韩欧美视频| 亚洲视频精选| 久久深夜福利免费观看| 亚洲高清视频在线观看| 亚洲婷婷在线| 麻豆精品在线视频| 国产精品久久久久国产a级| 韩日欧美一区| 亚洲午夜国产成人av电影男同| 久久国产精品99精品国产| 欧美高清在线一区| 亚洲自拍偷拍网址| 欧美国产在线观看| 国产精品永久免费视频| 亚洲人精品午夜| 欧美在线播放一区| 亚洲国产一区二区三区高清| 午夜精品一区二区三区电影天堂 | 欧美人成在线| 国产一区自拍视频| 一区二区福利| 欧美高清自拍一区| 欧美一区二区三区日韩视频| 欧美国产日韩亚洲一区| 国产视频精品xxxx| 一本色道久久综合亚洲精品不卡| 久久久国产一区二区三区| 亚洲精品在线观看免费| 久久亚裔精品欧美| 国产区精品视频| 亚洲一区二区伦理| 亚洲国产成人av| 久久精品中文| 国产欧美日韩亚州综合| 亚洲视频欧美视频| 亚洲高清视频中文字幕| 久久久噜噜噜久久狠狠50岁| 国产美女诱惑一区二区| 中文精品视频| 亚洲三级色网| 牛牛国产精品| 在线免费观看欧美| 久久国产主播精品| 亚洲一级黄色片| 欧美网站在线观看| 野花国产精品入口| 91久久精品国产91性色tv| 久久资源在线| 在线免费观看视频一区| 久久久久久亚洲精品杨幂换脸 | 欧美日韩精品一区二区三区| 亚洲国产成人久久综合一区| 久久嫩草精品久久久精品| 亚洲欧美日本伦理| 国产精品爽爽爽| 午夜精彩视频在线观看不卡| 日韩视频在线一区二区三区| 欧美激情综合色综合啪啪| 亚洲精品久久久久久久久久久久久| 女主播福利一区| 看欧美日韩国产| 亚洲国产精品毛片| 欧美黄网免费在线观看| 美日韩精品免费观看视频| 亚洲激情电影中文字幕| 欧美国产亚洲视频| 免费在线观看日韩欧美| 亚洲茄子视频| 亚洲人成网站777色婷婷| 欧美乱人伦中文字幕在线| 99ri日韩精品视频| 99精品视频网| 国产精品欧美在线| 欧美在线亚洲在线| 久久成人久久爱| 亚洲激情av| 一区二区毛片| 国产婷婷色一区二区三区在线 | 欧美激情综合色| 欧美精品一区二区三| 亚洲午夜精品| 欧美一区二区播放| 亚洲二区在线| 亚洲精品在线免费| 国产精品久久精品日日| 欧美在现视频| 欧美电影专区| 欧美一级黄色网| 久久亚洲精品一区| 一区二区动漫| 欧美影片第一页| 亚洲乱码日产精品bd| 亚洲小说欧美另类婷婷| 在线看日韩av| 艳妇臀荡乳欲伦亚洲一区| 国产日韩欧美成人| 亚洲高清在线精品|