D3D Animation Basis(10)

D3D Animation Basis(10)

The remaining two draw_meshes functions duplicate the exact features of the first two, except that all meshes in the linked list of mesh objects are rendered.


HRESULT draw_meshes(D3DXMESHCONTAINER_EX *  mesh_container)
{
    D3DXMESHCONTAINER_EX
*  container_ptr  =  mesh_container;

    
//  loop through all meshes in list
     while (container_ptr)
    {
        HRESULT hr 
=  draw_mesh(container_ptr);

        
if (FAILED(hr))
            
return  hr;

        container_ptr 
=  (D3DXMESHCONTAINER_EX * ) container_ptr -> pNextMeshContainer;
    }

    
return  S_OK;
}

HRESULT draw_meshes(D3DXMESHCONTAINER_EX
*  mesh_container,
                    IDirect3DVertexShader9
*  vertex_shader,
                    IDirect3DVertexDeclaration9
*  vertex_decl)
{
    D3DXMESHCONTAINER_EX
*  container_ptr  =  mesh_container;

    
//  loop through all meshes in list
     while (container_ptr)
    {
        HRESULT hr 
=  draw_mesh(container_ptr, vertex_shader, vertex_decl);

        
if (FAILED(hr))
            
return  hr;

        container_ptr 
=  (D3DXMESHCONTAINER_EX * ) container_ptr -> pNextMeshContainer;
    }

    
return  S_OK;
}

你可能感兴趣的:(D3D Animation Basis(10))