当前位置: 首页 > >

DirectX9 D3DX几何体对象

发布时间:

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;



友情链接: