8,304
社区成员
发帖
与我相关
我的任务
分享
struct Mesh
{
LPDIRECT3DVERTEXBUFFER9 m_pVB = NULL;
LPDIRECT3DINDEXBUFFER9 m_pIB = NULL;
D3DXMATRIX m_transform;
int n_vtx, n_primcount;
};
Mesh meshes[5];
void Render()
{
pDevice->BeginScene();
for( int i = 0; i < 5; i++ )
{
pDevice->SetStreamSource(0,meshes[i].m_pVB,0,stride);
pDevice->SetIndices(meshes[i].m_pVB);
pDevice->SetTransform(D3DTS_WORLDMATRIX, meshes[i].m_transform);
pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,meshes[i].n_vtx,0,meshes[i].n_primcount);
}
pDevice->EndScene();
}
SetTransform(matrx_of_mesh0);
DrawMesh(mesh0);
SetTransform(matrx_of_mesh1);
DrawMesh(mesh1);
SetTransform(matrx_of_mesh2);
DrawMesh(mesh2);
SetTransform(matrx_of_mesh0);
DrawMesh(mesh0);
DrawMesh(mesh1);
DrawMesh(mesh2);