Skip to main content
GameDev.net gamedev.net
🔒 Locked

More mesh problems...

Started by laeuchli May 14, 2003 at 9:27 AM 0 replies 450+ views
Original Post
laeuchli
laeuchli
Dear All, I finally fixed my previous mesh loading problem(for some reason the artist has materials that where not being used in the X file, hence interating by the number of materials got me trash data at the end.), but now I have another problem. When I load some X files, some of the Texture files are null. In the ms mesh viewer is shows up ok, and there is nothing in the debug output. When I open up the file in notepad, I see the texture file name, but when I try and load it with my mesh loader, the file path is "", and so I get get a null texture :-(. Below is my code: Meshes[index]=new MeshInfo; hr = D3DXLoadMeshFromX( Filename, D3DXMESH_MANAGED, m_pd3dDevice, &m_pbufAdjacency, &m_pbufMaterials, &Meshes[index]->m_dwNumMaterials, &Meshes[index]->m_pMesh ); D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)m_pbufMaterials->GetBufferPointer(); Meshes[index]->m_pMaterials = new D3DXMATERIAL[Meshes[index]->m_dwNumMaterials]; Meshes[index]->m_ppTextures = new LPDIRECT3DTEXTURE8[Meshes[index]->m_dwNumMaterials]; Meshes[index]->m_ppBumpTextures = new LPDIRECT3DTEXTURE8[Meshes[index]->m_dwNumMaterials]; for( UINT ii=0; iim_dwNumMaterials; ii++ ) { Meshes[index]->m_pMaterials[ii].MatD3D=d3dxMaterials[ii].MatD3D; Meshes[index]->m_pMaterials[ii].pTextureFilename=d3dxMaterials[ii].pTextureFilename; Meshes[index]->m_pMaterials[ii].MatD3D.Ambient=Meshes[index]->m_pMaterials[ii].MatD3D.Diffuse; if( FAILED( D3DXCreateTextureFromFile( m_pd3dDevice, Meshes[index]->m_pMaterials[ii].pTextureFilename, &Meshes[index]->m_ppTextures[ii] ) ) ) { #ifdef DEBUG MessageBox(0,"Failed to load Texture file",Meshes[index]->m_pMaterials[ii].pTextureFilename,MB_OK); #endif Meshes[index]->m_ppTextures[ii] = NULL; Meshes[index]->m_ppBumpTextures[ii] = NULL; } ...... What could be causing this? Thanks, Jesse

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.