#include "Globals.h" HRESULT LoadD3DMeshNew( IDirect3DDevice9* g_pDirect3DDevice, DWORD dwNumMaterials, LPD3DXMESH pMesh, D3DMATERIAL9* pMeshMaterials, LPDIRECT3DTEXTURE9* pMeshTextures ) { LPD3DXBUFFER pD3DXMtrlBuffer; if( FAILED( D3DXLoadMeshFromX( "airplane 2.x", D3DXMESH_SYSTEMMEM, g_pDirect3DDevice, NULL, &pD3DXMtrlBuffer, NULL, &dwNumMaterials, &pMesh ) ) ) { MessageBox(NULL, "Could not find tiger.x","Meshes.exe", MB_OK); return E_FAIL; } else { // MessageBox(NULL, "Loaded tiger.x","Meshes.exe", MB_OK); } // We need to extract the material properties and texture names from the // pD3DXMtrlBuffer D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)pD3DXMtrlBuffer->GetBufferPointer(); pMeshMaterials = new D3DMATERIAL9[dwNumMaterials]; pMeshTextures = new LPDIRECT3DTEXTURE9[dwNumMaterials]; char buf[64]; sprintf(buf , "%s %d" , "dwNumMaterials is" , dwNumMaterials); // MessageBox(NULL, buf,buf, MB_OK); for( DWORD i=0; iRelease(); return S_OK; }