DirectX9 D3DX几何体对象

来源:互联网 发布:免费淘宝海报在线制作 编辑:程序博客网 时间:2024/04/27 23:20

D3DX几何体对象

The D3DX library provides the following six mesh creation functions:

 D3DXCreateBox
 D3DXCreateSphere
 D3DXCreateCylinder
 D3DXCreateTeapot
 D3DXCreatePolygon

 D3DXCreateTorus


For now, we ignore their details and concentrate on using them in the simplest way. 

HRESULT D3DXCreateTeapot(
LPDIRECT3DDEVICE9 pDevice, // device associated with the mesh
LPD3DXMESH* ppMesh, // pointer to receive mesh
LPD3DXBUFFER* ppAdjacency // set to zero for now
);


An example of using theD3DXCreateTeapotfunction:
ID3DXMesh* mesh = 0;
D3DXCreateTeapot(_device, &mesh, 0);


The meshes generated by the aboveD3DXCreate*functions create a mesh with only one subset, so zero can be specified for this parameter. An example of rendering the
mesh:
_device->BeginScene();
mesh->DrawSubset(0);
_device->EndScene();


When you are done with the mesh, you must release it:
_mesh->Release();
_mesh = 0;

0 0
原创粉丝点击